13

I have cloned a fedora and now trying to configure network interfaces. Every time i am adding a new NIC, it starts with number eth3 (rather eth0). i have tried removing and modifying the 70-persistent-net.rules as well as the network-scripts/eth0 but nothing seems to be fixing the issue. Here are some outputs from my machine

[root@abc ~]# ls /sys/class/net
eth3  eth4  lo  pan0
[root@abc ~]# cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x15ad:0x07b0 (vmxnet3)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:7f:eb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:7f:ff", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x15ad:0x07b0 (vmxnet3)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:7f:f5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:3e:16", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:3e:20", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:3e:2a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

[root@abc ~]# service network restart
Shutting down loopback interface:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  Device eth0 does not seem to be present, delaying initialization.
[FAILED]
[root@abc ~]#  
[root@abc network-scripts]# vi ifcfg-eth0 

# Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=00:0c:29:a3:3e:16
IPADDR=192.168.1.75
IPV6INIT=yes
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
NM_CONTROLLED=no
GATEWAY=192.168.1.1
~ 

Any suggestions on how can i fix it?

  • Do you have a list of the MAC addresses that vmware is assigning to your VM? – Mark Plotnick Apr 20 '15 at 22:20
  • ifconfig -a eth3 Link encap:Ethernet HWaddr 00:0C:29:A3:3E:16 inet addr:192.168.144.75 Bcast:0.0.0.0 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fea3:3e16/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:40997 errors:0 dropped:0 overruns:0 frame:0 TX packets:463 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2543682 (2.4 MiB) TX bytes:65822 (64.2 KiB) – user2896215 Apr 21 '15 at 14:54
  • eth4 Link encap:Ethernet HWaddr 00:0C:29:A3:3E:20 inet addr:10.10.10.1 Bcast:0.0.0.0 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fea3:3e20/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:198 errors:0 dropped:0 overruns:0 frame:0 TX packets:196 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:18378 (17.9 KiB) TX bytes:20271 (19.7 KiB) – user2896215 Apr 21 '15 at 14:54
  • 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:1241 errors:0 dropped:0 overruns:0 frame:0 TX packets:1241 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:72277 (70.5 KiB) TX bytes:72277 (70.5 KiB) – user2896215 Apr 21 '15 at 14:54
  • pan0 Link encap:Ethernet HWaddr 06:CB:63:1B:B6:10 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:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) – user2896215 Apr 21 '15 at 14:55
5

Empty /etc/udev/rules.d/70-persistent-net.rules:

[root@xxxsat601 ~]# echo > /etc/udev/rules.d/70-persistent-net.rules
[root@xxxsat601 ~]#

and reboot. It should repopulate the file for you. This file exists so that if you insert a new NIC into a machine such that it appears to be eth0 it doesn't take on your eth0's IP configuration (if you omitted the mac address from the config) and is instead called by a new name.

If you truncate the file, there's no way for all that information to be in there unless that's really what the hardware configuration looks like.

  • I tried but its not repopulating.... – user2896215 Apr 20 '15 at 21:26
  • 1
    Many udev implementations do not rebuild 70-persistent-net.rules if the MAC vendor portion is in a list that's considered to be used by popular virtual machine implementations. 00:0c:29 is one of them. – Mark Plotnick Apr 20 '15 at 22:24
  • If it isn't repopulating then I'd check to see if it still created it as eth0 even without the rules. Otherwise you should be able to just manually add the udev rule by copying/pasting the old eth0 rule and just updating the MAC address portion. – Bratchley Apr 20 '15 at 23:03
  • if i am adding another NIC, it is adding as eth3 (even without the rules). – user2896215 Apr 20 '15 at 23:36
  • What version of fedora are you on? I've never seen that behavior before so I'd like to set up a reproducer on my side. – Bratchley Apr 21 '15 at 12:36
4

When you boot to the cloned machine enter ifconfig -a you will see there is no eth0 but there should be an eth1. It is trying initiate eth0 because of the file /etc/sysconfig/network-scripts/ifcfg-eth0.

To fix this, edit /etc/udev/rules.d/70-persistent-net.rules. Remove the first block for eth0. Change the second block to NAME="eth0"

Copy the MAC and replace the MAC in /etc/sysconfig/network-scripts/ifcfg-eth0 and edit the IP if necessary.

Reboot the VM and you should be good to go. This worked for me.

  • Removing the first block and changing eth0 in the remaining block worked great for a VPS migration. – MIguelele Oct 11 '17 at 10:10

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.