0

I am setting up a virtual environment inside an ESXi server. I have a version of Ubuntu Server running isc dhcp.

When the server boots up I issue the command ifdown eth0 followed by the ifup eth0. At this point the server issues a DHCP request, but itself doesn't answer that request with an ip address. Is there a reason why?

I saw this post Can a DHCP server assign itself an IP address via DHCP but I am not convinced that it isn't possible for a DHCP server to assign itself an address.

How is a better way to see if your DHCP service is configured correctly? I followed this guide https://help.ubuntu.com/lts/serverguide/dhcp.html and wasn't able to make another client on the network get assigned an IP address.

Matthew
  • 103
  • 4
  • You say you're not convinced it's not possible to do this - fair enough. I don't know for sure. I do know that the answer to that other question is appropriate - this isn't standard practice, and if you manage to do it, it'll be a crazy kludge. Give your DHCP server a static IP. it's not clear that you need dhcp at all - if you have just a few machines, static IPs may be better. – Dan Pritts May 29 '15 at 21:34

1 Answers1

1

Yes it is possible. Assuming the ISC dhcp server in dhcpd.conf set server-identifier to 127.0.0.1. This will cause the DHCPOFFER to have DHCP option 54 set to 127.0.0.1 so the DHCPREQUEST will reach the server.

Note if you want this DHCP server to be useful (other clients can request IPs from it) you'll need to set this parameter in a host stanza that matches the server's eth0 MAC address.

A complication in Ubuntu (at least 12.04) is that there is a race condition between the DHCP server starting and the interface being brought up.

On boot, after the last filesystem is mounted, mountall will emit the filesystem event. The networking and rc-sysinit upstart jobs will start on this event (rc-sysinit also needs "net-device-up IFACE=lo").

The networking job brings up all the interfaces. The rc-sysinit job will emit a runlevel event which will cause the dhcp server to start.

All these events happen asynchronously: hence the race condition.

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47