2

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?

Atilla Filiz
  • 1,116
  • 4
  • 14
  • 20
  • Sounds pretty close to what the [avahi](https://en.wikipedia.org/wiki/Avahi_(software)) project provides – dawud May 02 '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 02 '13 at 14:35

2 Answers2

1

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.

0

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.

Grodriguez
  • 495
  • 1
  • 5
  • 14