POX DHCP Server
This week, POX’s betta branch gained a simple DHCP server. I’m actually aware of at least three other POX DHCP servers(!), but this is the first one in the mainline. It’s pretty bare-bones, but it might Do The Job for you (and if it doesn’t maybe it’s at least a start). It also demonstrates a rarely seen POX feature: multiple launch functions.
There’s an entry on the POX Wiki describing usage of the DHCP server, but it’s basically pretty simple. To get it to serve addresses in the range 192.168.0.100 through 192.168.0.199, you can simply start it with:
(For the curious, that “
:default” is the aforementioned multiple launch function bit.)
There are also a number of options. For example, to serve 10.0.0.x from 10.0.0.1 without specifying a default gateway (router) to clients and specifying 22.214.171.124 as the DNS server:
./pox.py misc.dhcpd --network=10.0.0.0/24 --ip=10.0.0.1 --router=None --dns=126.96.36.199
When the server issues an address, it raises an event. Your components can handle this event to monitor or cancel it:
def _I_hate_00_00_00_00_00_03 (event): if event.host_mac == EthAddr("00:00:00:00:00:03"): event.nak() # Deny it! core.DHCPD.addListenerByName('DHCPLease', _I_hate_00_00_00_00_00_03)
For further information, check the manual.
Hopefully this will satisfy some users’ needs for a DHCP server. If not, please feel free to file issues, chat about it on pox-dev, or submit pull requests!