Check for running DHCP daemon?

sohcahtoa82 at gmail.com sohcahtoa82 at gmail.com
Sat Jan 24 00:21:34 CET 2015


On Friday, January 23, 2015 at 2:50:12 PM UTC-8, Chris Angelico wrote:
> 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

I forgot that DHCP uses UDP.  My mistake.



More information about the Python-list mailing list