Cisco IOS DHCP Relay Agent

This topic is to discuss the following lesson:

Hi rené, nice lab as usual, i have a question : don’t we have to exclude the ip address from the pool address defined on the DHCP router because it has already been taken by the fastethernet 0/0 of the middle router, in order to prevent address conflict when assigning an ip address to the client router ??

Thanks in advance.

Hi Mohamed,

Good question. If you try this with a few clients you’ll see that the DHCP server won’t give a lease for since it’s already in use. However, it is nicer to configure some excludes for the IP addresses that have been configured statically.


There is absolutely no better place on the internet to study CISCO related materials than here. I am in Ghana, how do I purchase your books.

Thanks for your kind words :slight_smile: The e-books are available through Clickbank and the hardcopies through, you can use a creditcard or paypal. If those are not accepted then we can always look for another online payment method that you can use…

Hi rené, i have another question: How can we use DHCP Relay when we have multiple subinterfaces for multiple VLANs on the fastethernet 0/0 ( ie: fastethernet 0/0.1, 0/0.2 and so on) of the middle router knowing that each VLAN has its own addressing scheme ??


I just found this and i think it solves the problem: while configuring the DHCP router for multiple VLANs, we must specify the default-router (it’s the gateway adress of each VLAN) from which the request is comming (as shown below). This way the DHCP router assigns IPs from the particular pools of each VLAN.

(config)# ip dhcp pool VLAN1
(dhcp-config)# network
(dhcp-config)# default-router
(dhcp-config)# exit

Hi Mohamed,

The default-router is only required if you want to include a default gateway for the DHCP clients so they know how to get out of their own subnet. It doesn’t have anything to do with DHCP relay.

When the DHCP relay forwards packets to the DHCP server, it will include its IP address of the interface where it received the DHCP broadcasts on in the GIADDR field. Because of this, the DHCP server will know what pool to use. It doesn’t matter if you are using physical or sub-interfaces, each interface has a different IP address.


Hi rené, i have a question: What would happen if you have two or more clients requesting at the same time? Who will be elected for first IP-address?

Hi Don,

Theoretically it could be possible that two clients send a DHCP discover at the same time but it’s unlikely that they are received at the exact same time at the DHCP server. Even if this would occur, one of the packets would be processed before the other.

Let’s say that it does happen then there are always some tools that we can use to prevent IP conflicts. For the DHCP server you can enable a check that pings the IP address before it is allocated (to make sure nobody is using it) or you can send an ARP request (if you get a reply, you know that it is in use).


Hi Rene,

Thanks much!!! Very nicely explained the concepts. I have a question, why would the router sends the DHCP packets to the server with the gateway ip address as the source address? is there any specific reason ?

Hi Lakshmi,

There’s a good reason for this, the DHCP server uses this information to figure out what DHCP pool to use.


Thanks for the reply Rene. but we have Gateway IP address field in the packet from which the DHCP server uses for the pool information. why would it check the source address of the packet for the pool information

Which DHCP packet do you refer to now and which source address? I think I didn’t understand your question then :slight_smile:

This giaddr field is required by the DHCP server or it won’t know from which pool it has to select an IP address.
>>> From the above statement I understood that DHCP server uses giaddr to select the pool.

Also, the source IP address of this unicast packet will be
>>> I didn’t understand why would it use instead of as the source ip.

Ok I get it.

The giaddr field is what the DHCP server actually uses to decide from which pool it should pick an IP address.

Cisco IOS routers will use the IP address on the incoming interface of the client as the source IP for the unicast packet to the DHCP server, I’m not really sure why they do this as this information isn’t required to relay the DHCP messages.

Some IOS versions support changing the source IP address with this command:

ip dhcp-relay source-interface loopback


Hi Rene,

Will the ip helper-address always be the address of the interface on the the DHCP server that connects to the DHCP relay?

Hi Adam,

Normally yes, the DHCP relay will add the IP address of the interface where it received the DHCP discover on in the “giaddr” field. It is possible though to leave it empty and use another field (option 82) with information that the DHCP server will use to decide what DHCP pool to use. (Large) ISPs might use this, on a normal network the IP address is probably enough.


Hi Rene,

Thanks a lot :slight_smile:

Rene I have a question…

What is the difference between DHCP relay and ip helper address.

I’m studying DHCP relay (IPv6) and that is a little confused.


Hi Diana,

A router becomes a DHCP relay when it “relays” DHCP broadcasts to another interface. We do this with the “IP helper-address” command.

This command, however, does more than just forwarding DHCP broadcasts, here’s a list:

  • UDP 69 - TFTP
  • UDP 67 - BOOTP Client
  • UDP 68 - BOOTP Server
  • UDP 37 - Time Protocol
  • UDP 49 - TACACS
  • UDP 53 - DNS
  • UDP 137 - NetBios
  • UDP 138 - NetBios Datagram

So by default, it will relay all broadcasts to these UDP destination ports. If you want you can also enable relaying for other destination ports. For example:

ip forward-protocol udp 3000

This would relay broadcast packets with destination UDP port 3000. You can also disable some of the default ports:

no ip forward-protocol udp 67
no ip forward-protocol udp 68
no ip forward-protocol udp 137
no ip forward-protocol udp 138

Hope this helps!