Monday, March 29, 2010

Misc 17

DHCP stands for Dynamic Host Configuration Protocol. DHCP is typically used for large implementations where manually typing in IP addresses for individual hosts are not feasible. DHCP is used to configure hosts for basic connectivity by setting up its IP address and subnet mask. DHCP Options can also be employed to push information such as the default gateway and domain name-server.
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 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:
conf t
ho DHCPServer
ip dhcp pool POOL01
network /24
domain-n syraxius.ath.cx
ip dhcp excluded

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 (the DHCP Server), use:
conf t
ho DHCPRelay
in f0/1
ip add
no shut
ip helper

No comments :

Post a Comment