February 9, 2013 in News, POX

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 through, you can simply start it with:

./pox.py misc.dhcpd:default

(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 without specifying a default gateway (router) to clients and specifying as the DNS server:

./pox.py misc.dhcpd --network= --ip= --router=None --dns=

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!

Leave a reply

You must be logged in to post a comment.

Sign in using...

Skip to toolbar