2

I've installed a new NIC. It shows up as eth2. I'd like it to be eth1. How I can do this?

d-_-b
  • 1,124
  • 3
  • 11
  • 23

2 Answers2

5

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

d-_-b
  • 1,124
  • 3
  • 11
  • 23
  • My 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.... – Michael Hampton Oct 05 '12 at 12:12
  • @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. – d-_-b Oct 06 '12 at 06:25
1

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.

Varkas
  • 11
  • 1