Renaming NIC Name In CentOS 7

Home » CentOS » Renaming NIC Name In CentOS 7
CentOS 12 Comments

All,

I am trying to understand better how you give an interface a more descriptive name and get it all working without a reboot, if possible.

We have 1G and 10G interfaces, and I

12 thoughts on - Renaming NIC Name In CentOS 7

  • udev is in control. You need a
    /etc/udev/rules.d/70-persistent-net.rules like:

    # net device ()
    SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”02:8b:02:81:f4:4a”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

    Then I think you first restart udev then network.

  • Thanks to everyone who responded. This led to some interesting reading and learning, but it hasn

  • Of course, I found a page with a solution that worked right after sending the last email. However, without pointing to me to search for pages in google on reloading udev rules, I wouldn

  • I learned this to control the MAC address so that the IPv6 suffix for my servers was more to my liking and I could use an RA prefix.

  • Of course if you don’t mind rebooting the system, this will work as well:
    http://wiki.CentOS.org/FAQ/CentOS7#head-31ebc6642958a0df12304d6aab9a49034a3b7802

    [root@entos7 ~]# ifconfig

    eth0: flags=4163 mtu 1500

    inet 10.30.1.100 netmask 255.255.255.0 broadcast 10.30.1.255

    inet6 fe80::a00:27ff:fe54:1d2d prefixlen 64 scopeid 0x20

    ether 08:00:27:54:1d:2d txqueuelen 1000 (Ethernet)

    RX packets 64 bytes 7690 (7.5 KiB)

    RX errors 0 dropped 0 overruns 0 frame 0

    TX packets 74 bytes 11580 (11.3 KiB)

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    eth1: flags=4163 mtu 1500

    inet 172.16.154.10 netmask 255.255.255.0 broadcast 10.30.1.255

    inet6 fe80::a00:27ff:fe54:1d3d prefixlen 64 scopeid 0x20

    ether 08:00:27:54:1d:3d txqueuelen 1000 (Ethernet)

    RX packets 64 bytes 7690 (7.5 KiB)

    RX errors 0 dropped 0 overruns 0 frame 0

    TX packets 74 bytes 11580 (11.3 KiB)

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


    George Kontostanos

  • Hey Mark,

    You can use “ip” tools to do the trick. For Ubuntu I wrote this upstart script that helps with it without touching udev. You can see it here:
    http://www1.ngtech.co.il/paste/1175/

    You can run this function at runtime and it will change the interface name.

    —–BEGIN PGP SIGNATURE—

  • I really don’t get it. Why get into so much fuss just to rename your interfaces????


    George Kontostanos

  • To answer this question using my use-case;

    I build HA clusters, and I want to make sure that physical port X on all nodes have the same device name. Biosdevname tries to address this, but doesn’t work all the time.

    Further, in my case, I’ve got a minimum of six interfaces in each node, paired into three bonded groups. Having the device name reflect the purpose in the node is very helpful 12~24 months down the road when I
    need to fix a network problem.

    There *are* cogent arguments for renaming interfaces.

    cheers

    digimer


    Digimer Papers and Projects: https://alteeve.ca/w/
    What if the cure for cancer is trapped in the mind of a person without access to education?

  • No argument here. I just though that it is much easier to simply pass the following options to grub –> “net.ifnames=0 biosdevname=0”
    Then you manually edit the interface(s) name.