Posted by endecotp
on Tue 10 Jul 2007 at 23:15
My box has a single network interface and two IP addresses. It is currently working fine with just the first of them configured.
Now I think that I should be able to bring up the second one using an alias, something like this:
ifconfig eth0:0 netmask <something> x.y.z.2
but I'm having trouble with the netmask setting. The netmask that I've been told applies to the two (neighbouring) addresses is 255.255.255.224. This is what the first interface is configured with. Trying to use the same netmask on the alias gives an error (below) - but I'm not sure that I should be using the same netmask for the alias anyway; one search result told me that the alias should always have the netmask 255.255.255.255. I tried that, but I still get this same error:
# ifconfig eth0:0 netmask 255.255.255.224 x.y.z.2
SIOCSIFNETMASK: Cannot assign requested address
Actually although that looks like an error, it seems that it does bring up the interface alias and it is pingable, but it gives it a netmask of 255.0.0.0, which looks very wrong.
Can anyone explain what needs to happen here, and how to achieve it?
One possible answer would be "just add another section to /etc/network/interfaces and ifup eth0:0". Maybe ifup can do all this automagically for me. But I hesitate to do that, because I don't have physical access to this machine. At the moment, if I accedentally "ifdown eth0" I can remotely power-cycle it. However, if I screw up editing /etc/network/interfaces then a power-cycle might not help. So I'm only going to touch that file when I'm really confident that I have it correct.
In fact that's an interesting thought: could /etc/network/interfaces, and other critical configuration files, be set up with known-good fallbacks, used a bit like those "screen mode changed, click here within 10 secs if you can read this." dialogs?