Check for running DHCP daemon?

Chris Angelico rosuav at gmail.com
Fri Jan 23 23:49:18 CET 2015


On Sat, Jan 24, 2015 at 9:38 AM,  <sohcahtoa82 at gmail.com> wrote:
> Secondly, even if you find a module, keep in mind that the module probably won't stay in Python land.  It will probably call an external utility itself.
>
> If you REALLY wanted to check it without calling an external utility, you could connect to port 67 and see what happens, but that could cause problems.

We're talking UDP here, so there's no "connect to" concept. You have
to send a packet and listen for a reply, and that might have
consequences (eg if you send a DHCPDISCOVER just to find out if
there's a DHCP server, you potentially cause a temporary IP
allocation).

Reading from /proc or running an external program would be the best
ways to find out.

ChrisA



More information about the Python-list mailing list