Cisco IOS DHCP Relay Agent

Rene

Hope you are well - hopelijk heb je veel snoepies gehad van dag !

Anyway, I tried the lab above for the DHCP but it din’t seem to work … so my client hasnt received an IP address seemingly here is what I got any ideas what is happening many thanks in advance:

Client#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES DHCP   up                    up
Client#sh ip int f0/0
FastEthernet0/0 is up, line protocol is up
  Internet address will be negotiated using DHCP

Client:

interface FastEthernet0/0
 ip address dhcp
Client#sh ip route

Gateway of last resort is not set
Router#
*Mar  1 00:33:56.775: DHCPD: setting giaddr to 192.168.12.2.
*Mar  1 00:33:56.775: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3230.312e.3062.3630.2e30.3030.302d.4661.302f.30 forwarded to 192.168.23.3.
*Mar  1 00:34:00.779: DHCPD: setting giaddr to 192.168.12.2.
*Mar  1 00:34:00.779: DHCPD: BOOTREQUEST from 0063.6973.636f.2d63.3230.312e.3062.3630.2e30.3030.302d.4661.302f.30 forwarded to 192 privilege level 15

Configuration applied as follows:

Router#

interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 ip helper-address 192.168.23.3
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.23.2 255.255.255.0
 duplex auto
 speed auto
Router#sh ip route

Gateway of last resort is not set

C    192.168.12.0/24 is directly connected, FastEthernet0/0
C    192.168.23.0/24 is directly connected, FastEthernet0/1

Debug:

Client#

*Mar  1 00:39:14.967: DHCPD: IP address change on interface FastEthernet0/0
DHCP#

ip dhcp pool NET12
   network 192.168.12.0 255.255.255.0

interface FastEthernet0/0
 ip address 192.169.23.3 255.255.255.0
 duplex auto
 speed auto

ip route 192.168.12.0 255.255.255.0 192.168.23.3
DHCP#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.169.23.0/24 is directly connected, FastEthernet0/0

Hi William,

I’m doing good, hope you as well :slight_smile: Been busy with Google translate? hehe

Your configuration is looking good. Looking at this line:

DHCPD: IP address change on interface FastEthernet0/0

I’d say that your client should have received an IP address. It still doesn’t have anything?

Rene

Renee

Ignore the last input from me (ik was helemaal gek!) … so i realised i made a typing error (typo) which meant i used the incorrect ip address on f0/0 on #DHCP … this meant i had no point to point since the ip address were discontigous furthermore i was never going to get my ip route in the routing table also on #DHCP … as soon as I corrected the interface and ensured the ip route configuration was correct all on #DHCP it worked - thanks very much Renee are great lab to simulate the DHCP process using the two additional routers (by proxy) as host and DHCP server respectively

Regards

Will

so i used a interface FastEthernet0/0
ip address 192.169.23.3 255.255.255.0

instead of 192.168 !!

Good to hear you found it Will!

Hi Rene,

Thanks, explained very well. It’s very easy to understand.

Regards,
M.Selvam

Hi Rene,

Can you explain the packet flow if the DHCP server is 3 routers away from the client network? In this scenario, what DHCP fields would change at every router?

Hi Shree,

Nothing will change. The router that is configured for DHCP relay will create these unicast packets. Other routers only have to route these packets to the DHCP server, that’s it. Here’s a packet capture of these unicast packets btw:

DHCP Relay Unicast Packets

Rene

Rene,
Thanks for the trace. It helped me understand packet flow better. But the intermediate routers add their address in gateway IP field or this field wont be changed? I think the hop count will increase for every router it traverses.

Hi,
Why after relaying,the source and destination port are the same (67)?

Thank you

When you use DHCP, the client might not have an IP address yet. That’s why it is using DHCP. Somehow, the server has to be able to reach the client (and vice versa). Using the same port number on both ends solves this issue.

Thank you for your support.

Hi Rene,

I had the same doubt as Lakshmi (9reply 11618)regarding the source ip for DHCP relay router to DHCP server.
But then if we think about it , the packets coming from dhcp sever will be destined to router interface and this is the interface where we will rebroadcast the dhcp packet.

In your example, if we use 23.2 as source-ip , then how will router know which interface to re-broadcast the DHCP packets ! We can have multiple relay configured for multiple networks.
Also, in most cases , the DHCP server will not be in connected segment so there will be routing.
By looking at the diagram , it feels that 23.2 source_ip is obvious to avoid static routes for reverse routing but in real life , you will need reverse routing for the relayed packets as DHCP server will be located centrally (most often for relays)

That’s what I could think of.

Please share your thoughts on the same.

Hi Rene,
1)I observed there are multiple “ip helper-address” configured on interface.Is it for redundancy or load sharing.
could you please clarify.

2)One more thing is that secondary IP address configured on same interface with different sub net what is the impact of it?

Thanks
Nilesh

Hi Nilesh,

Yes you can have more than a DHCP server in your network, and normally it should have non-overlapping scopes.
For example:
DHCP server 1: 192.168.0.1 - 192.168.0.150
DHCP server 2: 192.168.0.151 - 192.168.0.253

If you want to have 2 different networks with 2 different DHCP servers for each network, it is always recommended to use a VLAN for each of the network.

Not sure what your 2nd question for the secondary IP because I don’t have the full configuration of your router.

Hope this can help.

Thanks Rene!
could you please let me know how to configure the IP helper-address over the tunnel ? in case if I have two routers or more.

Regards
Mike

Dear Mike,

Such requests of new lessons, you can post them here: Lesson ideas
Lessons ideas will be voted and Rene can pick up the topics and write lessons.

Thanks

19 posts were merged into an existing topic: Cisco IOS DHCP Relay Agent

Rene,

I have one doubt :

When a DHCP Server is on the same subnet, only the Discover msg is a broadcast, the offer, request and the ack are unicast. But when the the DHCP Server is on a different subnet and therefore separated by a router, the DORA msgs between the DHCP client and the Relay agent are all broadcast ? and between the Relay agent and the DHCP server all unicast ?

Hello Juan

When the DHCP server is in the same subnet, the following communications take place:

  • DHCPDISCOVER is broadcast on both layer 2 and layer 3 (MAC and IP)
  • DHCPOFFER as a response to the discover is unicast. It uses the MAC address of the original sender as the destination MAC and the proposed IP address as the destination IP (even though the DHCP client does not yet have an IP address assigned. This doesn’t matter since communication is happening at Layer 2 for now since we are on the same subnet)
  • DHCPREQUEST is also broadcast on both Layer 2 and Layer 3. Take a look at this sample wireshark capture of a DHCP Request. Notice the destination MAC and the destination IP are broadcast addresses:
    image
  • DHCPACK from DHCP server to client is also unicast.

Now in the case of a relay agent, refer to the diagram from the lesson. All traffic between the relay agent R1 and the DHCP client H1 remains the same as that described above. However, as stated in the lesson by Rene, the traffic between the R1 and the DHCP server that exists on another subnet is unicast.
image

I hope this has been helpful!

Laz

2 Likes