Leo’s Ramblings Rotating Header Image

Migrating Ubuntu Servers

Update: thanks to Charles (in comments) for reminding me about the extra MAC space VMware uses

Ever cold-migrated a Ubuntu VM or de-registered it, then re-registered it on another host?

You’ll know that what happens is that Ubuntu immediately loses network access because the underlying MAC has changed.

The way ESX generates MACs is based on its UUID and is in the format 00:0c:29:* or 00:50:56:* which are VMware’s OUIs – search 00-0C-29 and 00:50:56 here

This is because those MAC addresses are persistently bound in Ubuntu. What I’ve done previously is to simply edit the /etc/iftab file with the right MAC address as per ethernet0.generatedAddress in the VM’s .vmx file.

Interestingly however, I’ve found another solution – simply remove the persistent MAC bindings – thanks to the Professional VMware blog:

Edit by adding the following to /etc/udev/rules.d/70-persistent-net.rules:

# ignore VMware virtual interfaces
ATTR{address}=="00:0c:29:*", GOTO="persistent_net_generator_end"
ATTR{address}=="00:50:56:*", GOTO="persistent_net_generator_end"

That will permanently fix the issue – in fact, I’m adding this to my Linux Template best practices – as it simplifies deployment by a lot.

Cheers,

Leo

6 Comments

  1. [...] Ever cold-migrated a Ubuntu VM or de-registered it, then re-registered it on another host? You’ll know that what happens is that Ubuntu immediately loses network access because the underlying MAC has changed. More here [...]

  2. joshuadf says:

    Very nice, this has bit me as well! Any interest in posting the rest of your best practices?

  3. chukaman says:

    I was saying on the Professional VMware blog how my OUIs are totally different, but also with ESX. “…. my ESXs have OUI’s of 00-50-56-xx-yy-zz, which a search at ieee.org confirms is correct, so the above would not apply to me. Obviously I realise that, but somebody copying and pasting and not thinking might end up saying it doesn’t work for them.

    00-50-56 (hex) VMware, Inc.
    005056 (base 16) VMware, Inc.
    3401 Hillview Avenue
    PALO ALTO CA 94304
    UNITED STATES”

    Thanks for the post though, this will help. I used to ‘solve’ the problem by just zero sizing that file once I had moved or cloned the Ubuntu machine, then when it would reboot you would have your first NIC be eth0 as usual, etc.

  4. Leo says:

    Hey Charles/chukaman,

    The reason for that is because if you create the virtual machine directly in ESX Server your MAC will be 00:0C:29*. If you use VirtualCenter, ESX Server uses 00:50:56*

  5. Paul Dickson says:

    Hrm. I’ve tried adding it verbatim, replacing the end of two lines starting with addr, and removing everything and adding it in. I get the same error on boot trying all three ways and there is no network access. *scratches head*

    GOTO: “Persistent_net_generator_end” has no matching label in /etc/udev/rules.d/70-persistent-net.rules”

    Using ubuntu server 9.x on vsphere, hardware version 7.

    The main issue I’m trying to resolve is when I add a second NIC to the system I lose all network connectivity once I add it’s conf into /etc/network/interfaces. Whats really odd is if I down the new nic, the first one pings from both addresses.. WTF?

Leave a Reply