Ubuntu Changing Network Device ID udev/rules.d

I do quite a bit of work with Virtual machines based on an ESX platform. One of the advantages of such a platform is the ability to create a template server, then duplicate copies as and when you need one. With most operating systems it’s just a question of changing the IP and hostname and you are in business.

In the case of Ubuntu Linux a udev rule is created for each network interface and which is bound to the MAC address of the card. Which makes loads of sense in the “Real World” but when you create a new VM an additional MAC address is generated. This can be a little frustrating as the first machine would have an eth0 the second an eth1 the third and eth2 and so on.

The database which stores these values is located in a file :

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

An example of one of mine – on a third install.

# 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:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c9:f4:13", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
#
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c9:f3:19", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
#
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:fd:fa", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

In this case whilst I would prefer the device to be known as eth0 it is in fact known as eth2.

# 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:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:fd:fa", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

If the file is amended to the following and a reboot done all is sorted.
Don’t forget to amend the network configuration to reflect the change of device ID. In the case of UBUNTU this would be /etc/network/interfaces.

112 Comments »

 
  1. FRED says:

    Purchase@Advair.Online” rel=”nofollow”>..

    Buyno prescription jui…

  2. VINCENT says:

    Purchase@Generic.Advair” rel=”nofollow”>.

    Buynow it lmg…

  3. ANGELO says:

    aciphex@cancer.buy” rel=”nofollow”>..

    Buygeneric drugs…

  4. REX says:

    abilify@and.sleep.issues” rel=”nofollow”>..

    Buydrugs without prescription…

  5. BRYAN says:

    can@you.get.acai.berries.in.the.grocery.store” rel=”nofollow”>.

    Buydrugs without prescription…

  6. JOHNNY says:

    aloe@vera.juice.for.sale” rel=”nofollow”>..

    Buyit now…

  7. JULIUS says:

    ..

    Buyit now…

  8. BOB says:

    side@effects.of.aricept” rel=”nofollow”>..

    Buyit now…

  9. TYLER says:

    buy@real.strong.armour” rel=”nofollow”>.

    Buydrugs without prescription…

  10. ALAN says:

    honey for diabetes

    Buy_generic meds…

  11. MATT says:

    warfarin sod

    Buy_drugs without prescription…

  12. EDWIN says:

    verapamil side effects

    Buy_drugs without prescription…

  13. JEFFERY says:

    red wine and lipitor

    Buy_no prescription…

  14. JAY says:

    effexor xr 75

    Buy_generic pills…

  15. DENNIS says:

    low fat diets history

    Buy_drugs without prescription…

  16. WALLACE says:

    diabetes popcorn

    Buy_generic pills…

 

Leave a Reply

You must be logged in to post a comment.