6

When I run ifconfig in one of my machine I saw these.

The Q is where does the index eth3 and eth4 from? Is there a way to change them to eth0 and eth1?

$ ifconfig
eth3      Link encap:Ethernet  HWaddr 00:1a:a0:9d:c9:90  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fddc:2a53:4ad:0:a412:573:557c:ce58/64 Scope:Global
          inet6 addr: fddc:2a53:4ad:0:21a:a0ff:fe9d:c990/64 Scope:Global
          inet6 addr: fe80::21a:a0ff:fe9d:c990/64 Scope:Link
          inet6 addr: fddc:2a53:4ad::c68/128 Scope:Global
          inet6 addr: fddc:2a53:4ad:0:41f0:3be9:2668:e5b/64 Scope:Global
          inet6 addr: fddc:2a53:4ad:0:4daf:e298:e54c:2540/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:217764 errors:0 dropped:0 overruns:0 frame:0
          TX packets:402733 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:21329905 (21.3 MB)  TX bytes:40208000 (40.2 MB)
          Interrupt:20 Memory:fdfc0000-fdfe0000 

eth4      Link encap:Ethernet  HWaddr e8:94:f6:02:eb:a7  
          inet addr:192.168.0.108  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ea94:f6ff:fe02:eba7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2604292 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2069814 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:486616623 (486.6 MB)  TX bytes:472115888 (472.1 MB)

Edit1:

$ grep 'eth' /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:6c:72:d2:46", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:c9:6c:8c:a3", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="30:b5:c2:03:46:4d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1a:a0:9d:c9:90", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e8:94:f6:02:eb:a7", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

(Yes I have two Eth cards, one 100 and the other 1000 Mbps).

  • 1
    Please edit your question and add the output of grep 'eth' /etc/udev/rules.d/70-persistent-net.rules – heemayl Aug 2 '15 at 23:48
  • I added the output of the command you suggested - thanks. – artm Aug 2 '15 at 23:53
  • It shows you have three other Ethernet cards too..check with ifconfig -a – heemayl Aug 2 '15 at 23:54
  • ifconfig -a shows only 02 Eth cards. Do I miss something? – artm Aug 3 '15 at 0:03
  • Ok..if you want to rename the interfaces, put a # before the lines of eth0, eth1 and eth2 and then replace the eth3 and eth4 at last of the relevant lines in /etc/udev/rules.d/70-persistent-net.rules with eth0 and eth1 ..now restart network-manager or any other process you are using to manage the networking..then check the names.. – heemayl Aug 3 '15 at 0:11
11

The interface names are assigned by udev dynamically or according to the rules declared in the file /etc/udev/rules.d/70-persistent-net.rules. Although udev manages devices dynamically, putting the rules in this file make udev to take persistent decisions about the interfaces defined here.

So to change the name of an interface, open the file /etc/udev/rules.d/70-persistent-net.rules, find the appropriate interface first by checking the MAC address e.g. ATTR{address}=="00:1a:XX:YY:c9:ZZ". After finding the interface you want to change the name, replace the name e.g. NAME="eth3" at last of the line with the name you want e.g. NAME="eth0"

So the line becomes :

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1a:XX:YY:c9:ZZ", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Also do the same for other interface rules too if you want to change their names too. After doing the renaming restart the computer and the interfaces should be renamed properly.

Also note that as you have interfaces defined already with names eth0 and eth1, disable those rules by deleting or commenting out the lines containing the rules first, otherwise there will be a conflict and renaming won't be done.

| improve this answer | |
  • 1
    Or sudo service udev restart? Would that be enough? – A.B. Aug 8 '15 at 17:25
  • @A.B. Yeah..that should do too..in that case the service managing networking needs to be restarted too.. – heemayl Aug 8 '15 at 17:32
2

I am attempting to answer only one part : "Where does eth3 & eth4 came from ?. Going by one of my experience, the mac addresses pointing to the names eth0,eth1, eth2 would have been become redundant by a mother board/network card replacement in the machine. So if this caused by a network interface going away from the machine, you can safely delete them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.