Automatically Simple Since 2002
19 November 2013
CentOS ties your ethernet interfaces to their MAC addresses. This is problematic when using CentOS in a virtualized environment, because it ends up preserving old ethernet interfaces. Fortunately, there is a quick fix.
ifconfig only shows eth1 - where is eth0?
$ ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:50:56:B0:54:7E
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)
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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:260 (260.0 b) TX bytes:260 (260.0 b)
Remove the files that have eth0’s hardware address and UUID, and then reboot. If using templates, run this command, shut down, and then create the template before rebooting.
rm /etc/udev/rules.d/70-persistent-net.rules
rm /etc/sysconfig/network-scripts/ifcfg-eth0
reboot
Alternatively, edit ifcfg-eth0 and remove the lines with MAC and UUID.
ifconfig should now show eth0.
$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:B0:54:7E
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)
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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:260 (260.0 b) TX bytes:260 (260.0 b)