Ubuntu – How do i change the ETH name

networkingUbuntu

I have an ubuntu server (meerkat) that I had to replace a NIC since it is failing. So I removed the failing NIC and replaced it with two NICs inserted into two PCI slots on my server.

Everything's well except that one of the NICs name is eth1-eth3. Please see ifconfig -a result below:

eth1      Link encap:Ethernet  HWaddr xx:xx:xx:xx:50:a5
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:16

eth2      Link encap:Ethernet  HWaddr xx:xx:xx:xx:50:a4
          inet addr:xxx.xxx.xxx.98  Bcast:xxx.xxx.xxx.255  Mask:255.255.255.0
          inet6 addr: fe80::204:23ff:fec8:50a4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18746 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25886 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3423836 (3.4 MB)  TX bytes:3148479 (3.1 MB)

eth3      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:51
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:24 Base address:0xe800

eth1-eth3 Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:63
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:28 Base address:0xec00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:116 errors:0 dropped:0 overruns:0 frame:0
          TX packets:116 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8124 (8.1 KB)  TX bytes:8124 (8.1 KB)

I googled on how to change the NICs name via 70-persistent-net.rules but I got the following:

# PCI device 0x1186:0x1300 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x1076 (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:a4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x11ab:0x4361 (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:a5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x1106:0x3106 (via-rhine)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:63", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x1106:0x3106 (via-rhine)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:51", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

How do I change eth1-eth3 to just eth4? And why did linux label my new NIC eth1-eth3?

Best Answer

Change the NAME argument of the second eth3 interface to eth4 in 70-persistent-net.rules, then restart your networking.