This is perhaps an unusual request: I'm trying to get a Debian Linux box to always give itself a self-assigned IP address (i.e. 169.254.x.y) on boot. In particular, I want it to do that even when there is a DHCP server present on the LAN. That is, it should not request an IP address from the DHCP server.
From what I can see in the "man interfaces" text, there is an option for "manual", and an option for "dhcp". Manual assignment won't do, since I need multiple boxes to work on the same LAN without requiring any manual configuration… and "dhcp" does what I want, but only if there is no DHCP server on the LAN. (A requirement is that the functionality of these boxes should not be affected by the presence or absence of a DHCP server).
Is there a trick that I can use to get this behavior?
EDIT: By "no manual configuration", I mean that I should be able to take this box (headless) to any LAN anywhere, plug in the Ethernet cable, and have it do its thing. I shouldn't have to ssh to the box and edit files to get it working each time it is moved to a different LAN.
Best Answer
If you install the
avahi-autoipd
package, and run it with the--force-bind
option in a custom init or if-up.d script, you will always get a link-local address.You can then use
iface eth0 inet manual
in your interfaces(5) file, although you will need to edit/etc/network/if-up.d/avahi-autoipd
to addmanual
to the method lines.There is more information about avahi-autoipd on the Avahi wiki.
Personally, I would edit
/etc/network/if-up.d/avahi-autoipd
to with something like:You can then list interfaces as
iface eth0 inet linklocal
. The edits to be made to theif-down.d
script are left as an exercise to the reader.