Monday, May 24, 2010

Strange Linux error message on static and DHCP

I was modifying a /etc/networking/interfaces file to alias one NIC to have both a static and a DHCP address. I received a strange message:
SIOCSIFFLAGS: Cannot assign requested address
Surfing didn't find the exact answer, but lead to finding it. One must always have the DHCP address first and attached to the non-aliased interface. Ergo, this works:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
and this does not:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto eth0:0
iface eth0:0 inet dhcp 
And because I didn't want the DHCP interface to the the default, I added the following to that interface:
up route del -net 0.0.0.0 dev eth0

No comments: