I've been meaning to write up on this for quite some time now, but always have something seemingly more important things to do.
Most modern Linux distributions offer ways to manage network interfaces via some kind of abstraction. Usually this abstraction allows one to dynamically rename and add network interfaces. For Debian family management is done with ifupdown, while with RedHat family it's sysconfig. In addition there is NetworkManager which is a cross platform solution for dynamic network configuration (which eliminates the need to rename interfaces).
Usually this comes in rather handy, but on other occasions it can be a pain. A while I was helping out with an installation of a XenServer instance. This server had, for some reason, ethernet interfaces reversed in comparison to the other XenServers on the site. Luckily the service console has the network configuration in ifcfg scripts. We were easily able to reverse the interfaces by binding the interfaces to certain hardware addresses.
The only problem is that the interface is renamed only when the
interface is brought up. What's worse the interfaces were
enumerated before the server would bring up all of the interfaces.
Only eth0 was brought up for management purposes before
enumerating. This means that the original eth0 was renamed to
_tmp_xxxxxx. The (oh so elegant) solution was to
create a script that does
ifup eth1; ifdown eth1.
I also experienced similar problems when I was setting up my
OpenVPN tunnel. I wanted to use a
bridged connection to my network, but for that I needed to create a
br0 interface with
tap0 as a member.
It's easy enough to create ifupdown
configuration to set up
tap0. Hook that up to
br0 and you are all set. The same problem will bite
you here. The interface
tap0 is actually created only
tap0 is brought up and
members are added only if they are present.
The solution? In my case, create a custom script that adds the device manually after it's been created properly. I was unable to find anything that works without using a custom script =(
Looking back at these cases, I should have known better. The problem was obvious and it took me way too long to figure out the cause for my problems. Then again, the utilities should be able to create a reasonable abstraction for themselves that they use to determine the actual status of the whole system. This way the trickery needed for setting up simple interface would be obsolete.
You can't have it all, but you can always hope.