2012-09-12

eth0+N headache in linux with virtual templates

If you keep getting eth1 instead of eth0 as your main ethernet interface on a (newer) linux template/clone in a virtualized environment it's most likely because your udev rules is in affect and creates a new eth1 since eth0 is already defined and bound to the clone/template source's MAC address.

This can be fixed in a couple of ways (in your template/clone source image):

1) You can delete the 'SUBSYSTEM' line in your /etc/udev/rules.d/70-persistent-net.rules:

Edit the rules files
  vi /etc/udev/rules.d/70-persistent-net.rules

Delete the SUBSYSTEM line(s), feel free to also delete the comment about PCI device just above:

# 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, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:4b:05:e0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

2) A more dirty hack would just be to delete the /etc/udev/rules.d/70-persistent-net.rules file and create a directory named as the file. This tip is taken from six degrees of fredom blog (link):

  rm /etc/udev/rules.d/70-persistent-net.rules
  mkdir /etc/udev/rules.d/70-persistent-net.rules





Post a Comment