3

I'm running an Ubuntu 9.10 server that has multiple NICs in it. I'd like to make sure that each time the kernel boots up, the NIC with MAC address 01:23:45:67:89:ab gets assigned to eth0 and the one with MAC address ba:98:76:54:32:10 gets assigned to eth1.

On Fedora, I was able to do this by specifying the MAC address in /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=01:23:45:67:89:ab
# the rest of the configuration goes here

(and similarly for ifcfg-eth1).

Is there something equivalent syntax in /etc/network/interfaces for doing this on Ubuntu?

5

Ubuntu uses udev for hardware detection. Everytime a new NIC is found, udev generates a rule for it so it will use the same physical interface eth0, eth1, ...

If you do not change your hardware, you do not have to care about the interface names, they will stay the same. Should you replace a NIC, it will get the next free interface, eg. eth2. To re-assign eth0 to the new NIC you will have to edit /etc/udev/rules.d/70-persistent-net.rules and delete the old MAC and change eth2 to eth0.

For more information on udev and networking see here.

4

I think you want to look at mapping in /etc/network/interfaces.

Stanzas beginning with the word "mapping" are used to determine how a logical interface name is chosen for a physical interface that is to be brought up.

There's an example interfaces file here. Scroll down and there's:

mapping eth0 eth1
script /path/to/get-mac-address.sh
map 11:22:33:44:55:66 lan
map AA:BB:CC:DD:EE:FF internet

  • This will work if you use additional "logical" interfaces, but it cannot change the physical interface. – touchstone Jan 16 '10 at 3:22
-2

Can I use the mapping option to create multiple logical interfaces for multiple physical interfaces? Example, I have 2 physical ifaces (eth0, eth1) and I want to add 2 logical interfaces to each of them. So far I have been unsuccessful in this

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.