Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing an embedded device based on Linux and Busybox, and trying to make it adaptable to different network configurations. I want to:

1- At boot time, if there is no DHCP reply, use an AutioIP address.
2- At run time, if a DHCP server become available, start using it.

Point 1 seems easy as I can set my eth0 to manual in my /etc/network/interfaces, and set up command to

udhcpc eth0 --now || zcip eth0 /etc/zcip.script

I am not sure of point 2. If I run both udhcpc and zcip daemons simultaneously, would they play well together?

share|improve this question
Sounds pretty close to what the avahi project provides – dawud May 2 '13 at 14:31
I am not looking for an AutoIP daemon, there are multiple on the market. My problem is detecting and acting on the presence of DHCP. cnnman see,s promising – Atilla Filiz May 2 '13 at 14:35

You can do this with udhcpc+avahi. Avahi is zeroconf implementation for linux. It provides autoip (giving an address without dhcp) and mDNS (name resolution withoud DNS server).

I got it working in an embedded system with buildroot. There's also a modified udhcpc start script that enable fallback to autoip when dhcp isn't available.

share|improve this answer

If you only need to use AutoIP as a fallback to DHCP at boot time, then perhaps instruct zcip to get an address and exit instead of running as a daemon.

At boot time you'd do:

udhcpc eth0 --now || zcip -f -q eth0 /etc/zcip.script

When this command completes, either udhcpc will be running, or you will have a link local address

Then when a DHCP server becomes available, start the udhcpc daemon.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .