A DHCP server is a server, which role is to lease IP addresses to DHCP clients over the network.

This series of labs are going to be sweet, please follow me as we are going to see several ways of configuring DHCP on a Cisco network. I have to be honest that this was one of my favourite topics when I first got into the CCNA exam track.

A DHCP relay agent allows DHCP clients to locate and obtain IP address configurations from a DHCP server, on a distinct subnet. This is seldom achieved through a router or a layer 3 switch.

Router do not forward broadcast messages, and DHCP uses broadcast in order to work! Yes, the DHCP relay agent makee it possible. It is a routing protocol that allows DHCP broadcast messages to traverse the router, thus allowing clients to obtain IP addresses lease from the server.

So without the DHCP relay agent settings, the client would not be able get a Dynamic Host Configuration Protocol address (DHCP) from a remote server, but only from a server that belongs to the same network. On Cisco IOS, DHCP relay agent is enabled by issuing the command ip helper [DHCP server address]

The lab below shows a sample network configuration. The client computers are members 1 single VLAn, VLAN1, and the DHCP server is isolated on its own subnet. The router is the "middle man" between the two subnets, the transmitter; it is the DHCP relay agent!

Topology

DHCP relay 1

Plan your physical topology on the paper first, make sure the required subnets are properly defined and configured before the implementation.

Router configuration

Router>enable
Router#config t

Router(config)#hostname R1
R1(config)#int f0/1
R1(config-if)#ip add 10.10.10.254 255.0.0.0

R1(config-if)#int f0/0
R1(config-if)#no shut

R1(config-if)#int f0/0.1 ///Creates a sub-interface
R1(config-subif)#encapsulation dot1Q 1 ///defines the encapsulation method, must match the encapsulation on the switch. 1 represents VLAN1
R1(config-subif)#ip add 172.16.1.254 255.255.0.0

R1(config-subif)#ip helper-address 10.10.10.1
R1(config-subif)#

Server Configuration

Configure the server as seen below

DHCP server ip

Configure the pool of addresses the DHCP sever is to lease to client, please see example below

DHCP server pool

Configure the PCs as DHCP clients, relax and wait until they obtain the lease from the server, please see below

Client 1

DHCP client1

Client 2

DHCP client2

Client 3

DHCP client3

To finish, ping test between the clients to make sure they can talk to each other. If it doesn't work, make sure the address pool on the server is properly configured. Here are some tips:
The pool IP address must be in the same subnet as the router's sub-interface
The default gateway address defined in the pool must be the router's sub-interface IP address. This address is the client's default gateway.

On the router, run the following commands for verification
show run, to examine the router's configuration in greater details
show ip interface brief, to ensure the required interfaces are up.

We have just learned how to configure a Cisco router as a DHCP relay agent. A DHCP relay agent is a routing protocol that allow DHCP clients to automatically obtain their IP address configuration from a DHCP server located on another subnet. Cisco IOS ip helper-address command enables the protocol on Cisco capable devices. In the subsequent labs, we will split the client into multiple subnets. Please don't miss out, it will be sweet!!!

Please, your comments are so valuable