This may seem a daft question (and i fear it might be), but would it be possible for a server acting as a network's sole DHCP server send out a request for an IP address to the network, then catch its own request and answer it?
All of my intuition points to a no answer and ideally i would test it out but i don't have the time/spare resources currently so i was hoping someone else may have had the same thought and tried it out.
This is meant to be a generic question but if anyone is interested i'm running isc-dhcp on ubuntu 11.04
Technically the specs would allow for that to happen but it would be beyond stupid to try to do so.
It's a bad idea in two ways but yes it is possible.
In theory I think it SHOULD be possible since most linux distros these come up with an apipa (169.254.0.1 to 169.254.255.254) address if none is configured or provided. Therefore the dhcp server should be able to run and possibly answer requests. Now if you configure a reserved (fixed) ip address for the server's own mac-address, and if the dhcp client daemon stays running and keeps trying, it should in theory be able to be answered by the dhcp server daemon. Then it should be able to set its own proper ip-address, and continue to answer dhcp requests from other machines.
I'm not sure if dhcp servers can have an apipa address, an I think the server daemon needs to be restarted after the ip change, but other than that... I still cannot think of any sensible use case for this.
As far as I know this is NOT possible. DHCP is not just broadcast based. The initial part of the DHCP protocol is broadcast based, but at some point the server and client talk using their IP-addresses.
If I recall correctly (don't have the RFC's at hand) the server is the first one in the conversation that needs to send real ip-address information.
This automatically makes it impossible to have the server serve itself.
Of course it is possible that the server itself is a DHCP client that receives it's DHCP config from ANOTHER DHCP server (usually a reserved-fixed ip). It's a bit odd, but I can imagine some use-cases for such a setup.
Perhaps you are looking for a single source of truth deployment strategy by using a single copy of dhcpd.conf to keep all network information like
option routers
,option domain-name-servers
,option domain-name
. You may try these steps (Debian):Define a static IP address for network interface
This is require or else dhcp server won't start.
Optional: Define a fixed ip address in DHCP client configuration
This step is optional unless you want the IP address for your DHCP host.
Define a DHCP pool range for the network
Restart the machine and check you have a static IP address and dhcp server running. Now execute these to get IP address from DHCP server:
A new IP address shall get allocate for the interface
eth0
with DHCP requested options.