You can have consistent network device naming create interface names based on the MAC address. For instance, with this method, an interface with the hardware address 68:05:ca:0e:74:c4 would be named enx6805ca0e74c4
.
On RHEL/CentOS 7, you need to change the udev naming rules just a bit. You can do that with these directions:
Copy the default file /usr/lib/udev/rules.d/80-net-name-slot.rules
to the directory /etc/udev/rules.d
, then edit the copy.
In the copied file, find these three lines:
NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
Replace these lines with:
NAME=="", ENV{ID_NET_NAME_MAC}!="", NAME="$env{ID_NET_NAME_MAC}"
Then reboot.
Before the change, the interface looks like:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:21:d1:84 brd ff:ff:ff:ff:ff:ff
inet 172.20.203.174/24 brd 172.20.203.255 scope global noprefixroute dynamic enx52540021d184
valid_lft 3588sec preferred_lft 3588sec
inet6 2001:db8:b0b9:0:3962::a1be/128 scope global noprefixroute dynamic
valid_lft 3591sec preferred_lft 3591sec
inet6 fe80::5054:ff:fe21:d184/64 scope link noprefixroute
valid_lft forever preferred_lft forever
After the change, it is now:
2: enx52540021d184: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:21:d1:84 brd ff:ff:ff:ff:ff:ff
inet 172.20.203.174/24 brd 172.20.203.255 scope global noprefixroute dynamic enx52540021d184
valid_lft 3588sec preferred_lft 3588sec
inet6 2001:db8:b0b9:0:3962::a1be/128 scope global noprefixroute dynamic
valid_lft 3591sec preferred_lft 3591sec
inet6 fe80::5054:ff:fe21:d184/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Remember that with this naming scheme, manual intervention is required to reconfigure networking if you have to replace a NIC.