When a host (which in this case would be the DHCP client) boots up, it sends a DHCPDISCOVER packet as a local broadcast packet to 255.255.255.255. If a DHCP server in the subnet (or VLAN) receives the DHCPDISCOVER packet, it would respond with a DHCPOFFER. The DHCPOFFER packet contains an unleased IP address, the subnet mask, and several other options like the default gateway, DNS server and so on. If the client is okay with it, he would reply with a DHCPREQUEST containing the IP address, which shows its acceptance of the IP address. The server finally sends a DHCPACK containing information similar to the ones contained in DHCPOFFER.
However, since a DHCPDISCOVER packet can only stay within its subnet, the client would not be able to obtain an IP address if there are no DHCP servers. This is where a relay comes in. A DHCP relay takes any DHCPDISCOVER packets it hears and convert it into unicast form, sending it to the DHCP server specified during configuration.
The process is similar. Any broadcast messages are relayed to the DHCP server via unicast. The replies are received via unicast and broadcasted back out to the originating subnet. The relay agent modifies the GIADDR field to reflect the IP address that it heard the broadcast from, so the DHCP server could properly allocate IP addresses from the correct subnet. Therefore, the DHCP server would need to have the scopes of all the subnets that it needs to serve.
Below is a simple topology to illustrate the setting up of a DHCP server and a relay agent through the IOS.
To set up a simple DHCP server using the IOS, use:
en
conf t
ho DHCPServer
ip dhcp pool POOL01
network 192.168.1.0 /24
default-g 192.168.1.1
dns-s 172.16.1.1
domain-n syraxius.ath.cx
ip dhcp excluded 192.168.1.1 192.168.1.10
Next we're going to set up the relay. The relay should be configured at the interface that the agent should be listening to. In this case, to give the host an IP, he should listen to the interface connected to the switch. To activate the relay pointing to 172.16.1.1 (the DHCP Server), use:
en
conf t
ho DHCPRelay
in f0/1
ip add 192.168.1.1 255.255.255.0
no shut
ip helper 172.16.1.1
end
No comments :
Post a Comment