#779890 udhcpd: Support for multiple interfaces/udhcpd processes

Package:
udhcpd
Source:
busybox
Description:
Provides the busybox DHCP server implementation
Submitter:
Elliott Mitchell
Date:
2015-03-07 03:30:05 UTC
Severity:
wishlist
#779890#5
Date:
2015-03-05 23:57:36 UTC
From:
To:
The documentation seems to suggest udhcpd can only handle binding to one
interface and using one IP address range per udhcpd process.  Due to
this, it would be handy if Debian's init scripts had support for
starting/stopping multiple udhcpd processes (this would mean require
multiple .conf and .pid files).

When reading the man page I was wondering, could multiple configuration
files be specified on udhcpd's command-line and would this have the
effect of starting multiple udhcpd processes?  (I rather doubt it, but
the man page could be read that way)

#779890#10
Date:
2015-03-06 03:27:46 UTC
From:
To:
Upon a bit more thinking about the situation, I must suggest the
overlapping feature of adding a hook script to allow udhcpd to be
started/stopped by `ifupdown` instead of only by init script.  This ends
up dovetailing into support for multiple interfaces.

#779890#15
Date:
2015-03-06 06:02:39 UTC
From:
To:
06.03.2015 02:57, Elliott Mitchell wrote:

I suggest using some more advanced dhcp servers for this, for
example there's an excellent piece of software named dnsmasq
which is small and has other useful functionality.  Udhcpd
scripts can be extended to support multiple interfaces, but
I think at this time, it is better to use, say, systemd
service files for that, which should be trivial to write
and drop to the right location (and no, I don't know off
my head how to do that ;).

One invocation handles one interface, I think.  But you can try :)

Thanks,

/mjt

#779890#20
Date:
2015-03-07 02:11:36 UTC
From:
To:
I'm undecided on systemd right now, but the controversy has me rather
concerned right now.  dnsmasq may well be used in the future, but right
now I still suspect udhcpd can readily take care of my current needs.

I doubt it would work, just the man page could be interpreted to suggest
this.

I'm unsure whether it is good or bad news, but with some adjustments the
/etc/init.d/udhcpd script can be rewritten as an ifupdown hook script.
I'm attaching the script, place it in /etc/network/if-up.d/udhcpd, stick
a symbolic link in /etc/network/if-down.d/ and the attached script will
start/stop udhcpd when a given interface is brought up or down.

This adds 3 settings to /etc/network/interfaces.  "dhcpd-enable",
"dhcpd-config" and "dhcpd-pidfile".  Setting "dhcpd-enable" to "true",
"yes", "1", or "udhcpd" will make udhcpd to be started when a given
interface is brought up.  If set, "dhcpd-config" will specify the
configuration filename, DHCPD_CONFIG_DIR (set in /etc/default/udhcpd)
will be added as a prefix if this is not an absolute path; otherwise it
will look for /etc/udhcpd.<logical interface name>.conf then
/etc/udhcpd.<physical interface name>.conf and finally fall back to
/etc/udhcpd.conf.  The "dhcpd-pidfile" can tell it where the .pid file
is, though it will try to find it in the configuration file.  Hopefully
this works for others as a way to start udhcpd.

#779890#25
Date:
2015-03-07 03:22:55 UTC
From:
To:
Grr, final bit of confirmation has a shell quirk show up.  I suspect
there likely should be more backslashes on the sed command, but the
attached is what is confirmed to work.