How do I rename a NIC: eth2 -> eth1
10,022
Solution 1
edit /etc/udev/rules.d/70-persistent-net.rules
You may have something like:
# PCI device 0x14e4:0x165a (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:22:19:07:90:e4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0a:79:b8:72:7d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x10ec:0x8169 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:24:a5:84:de:62", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
Remove the line ending with NAME="eth1"
and rename eth2
to eth1
as such:
# PCI device 0x14e4:0x165a (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:22:19:07:90:e4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8169 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:24:a5:84:de:62", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
reboot
Solution 2
The configuration for your interfaces on Red Hat distros, should be located in:
/etc/sysconfig/network-scripts
You will want to look for the appropriate script for your interface to modify.
Related videos on Youtube
Author by
d-_-b
Updated on September 18, 2022Comments
-
d-_-b over 1 year
I've installed a new NIC. It shows up as eth2. I'd like it to be eth1. How I can do this?
-
Michael Hampton over 11 yearsMy Fedora 17 box doesn't have this file anymore. Perhaps they have changed the way this is done? If that's the case, then this answer won't be useful anymore in a few years, after everybody adopts the new way....
-
d-_-b over 11 years@Michael Hampton, notice the tag
debian
. On Fedora it's probably named differently. Why don't you grep for the name of your device:grep -R eth0 /etc/udev/rules.d/
. AFAIK, Fedora does use udev, but I could be wrong.