Looking for simple ifplugd example script

Bryan Evenson bevenson at melinkcorp.com
Thu Feb 20 16:14:12 UTC 2014

I am using busybox-1.20.2 on an embedded Debian Linux machine, and I have configured Busybox to include ifplugd.  I would like ifplugd to do the following:

1. When the Ethernet cable is plugged in, attempt DHCP on eth0
2. If DHCP fails, use a set static IP address
3. When the Ethernet cable is unplugged, unconfigure eth0

At this point, ifplugd is not running.  After some poking around, I see that there is no default daemon script for ifplugd included with Busybox.  I'm assuming a script to do the above isn't that difficult, but I can't seem to find any examples on how to do this.  Does anyone have a simple example that I can go by?  I did see the example in the Busybox source under examples/var_service/ifplugd_if, but I couldn't make any sense of what that script did and how to make use of it.

On a related note, I have eth0 setup in /etc/network/interfaces as:
auto eth0
iface eth0 inet dhcp

If I want to use a static IP address if DHCP fails, do I need to add something to /etc/network/interfaces, or is that something that would belong in the ifplugd script?


More information about the busybox mailing list