[Cialug] Networks service detection/configuration

kristau kristau at gmail.com
Fri Mar 2 13:31:44 CST 2012


A bit more information about your application may be helpful here. Why
would you ever want to become a DHCP server if one isn't available already?
At that point, you are basically hijacking any systems on that LAN which
happen to be configured for DHCP, and you aren't going to be able to talk
with any static IP devices without doing extensive discovery to determine
what network/networks are in use.

I would forgo the DHCP idea and focus on the following sequence:
1) Determine if DHCP is in use. If it is, obtain an address and be happy.
Done.
2) If DHCP isn't in use, perform exhaustive discovery (nmap) on the LAN to
determine what IP subnet(s) are in use and (if you require Internet access)
what the default GW is. Use that data to assign an "available" IP to your
appliance. This will, by no means, be fool proof as you may assign a
duplicate IP if another device that uses the chosen IP is powered down or
blocking your means of discovery (not responding to pings || no ports open).

-- 
Tired programmer
Coding late into the night
The core dump follows


More information about the Cialug mailing list