3

I have a scenario where I have two FreeBSD machines. I setup one to be a DHCP server so it can lease IP address. I have provided IP ranges, default DNS , host name , and all other settings in my dhcpd.conf file,

option domain-name "josh";
option domain-name-servers 192.168.234.129;

option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.234.0 netmask 255.255.255.0 {
  range 192.168.234.230 192.168.234.235;
  option routers 192.168.234.2;
}

and the second one to be a client. When I am running the FreeBSD client virtual machine, it has a static IP address of 192.168.234.128, but I want it to lease the IP address from the FreeBSD DHCP server that I setup.

I have done this in rc.d file,

ifconfig_em0="DHCP"

But how does it know the IP address of the DHCP server to lease from?

Both the machines are setup in VMWare environment, and are on the same network.

2 Answers 2

3

Client doesn't need to know IP address of the DHCP server. Client will send initial packet to all hosts within its subnet using broadcast address 255.255.255.255.
For further reading you may refer to official documentation of DHCP protocol https://www.rfc-editor.org/rfc/rfc2132
To restart dhcp client on particular network interface (em0in your case), you may run /etc/rc.d/dhclient restart em0

2

To answer your specific question 'But how does it know whats the IP address of the DHCP server to lease from ? Can someone please help me with that ?', the answer is whichever DHCP server gets a packet to your machine first.

If you're running in vmware, it would also be running a DHCP server – you'll need to work out how configure it to not provide an address for this vm.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .