8 Replies Latest reply: Mar 18, 2019 9:54 PM by Ing_Percy RSS

    DHCP Relay Agent

    nammon

      Hi all,

      I have a topology

      DHCP Client --- DHCP Relay Agent --- DHCP Server

      In renewing process, DHCP Client sends DHCP Request packet to DHCP server as a unicast packet (Destination IP is IP address on DHCP server). DHCP Relay Agent forward just this packet from DHCP client to DHCP server without any Relay Agent processing.

      But when DHCP server replies DHCP client:

      - First, the DHCP server sends a unicast reply packet to DHCP Relay Agent

      - After that, DHCP Relay Agent modify packet's Destination IP and Destination MAC as IP and MAC of DHCP client, then it sends to the DHCP client

      I wonder why the DHCP server doesn't send reply packets with Destination IP of DHCP client's IP (same as the DHCP client does)?

         
        • 1. Re: DHCP Relay Agent
          Ing_Percy

          Hi!

           

          In the DHCP process:

           

          The DHCP Client broadcasts a DHCP Discover message looking for a DHCP Server. When the DHCP Relay (Router, for example) receives this message, and with the DHCP Relay Agent feature enabled, it will forward the message to the DHCP Server as a Unicast Packet.

           

          The DHCP Relay will also add to this Unicast Packet a field called Giaddr in the DHCP Packet, this field will contains in our case the Gateway IP address of your Client DHCP (LAN interface), since the router receives the DHCP Discover message on its LAN interface the source IP address of this Unicast packet will be the LAN Interface of the DHCP relay. This Unicast Packet is sent to DHCP server.

           

          The another processes (Offer/Request/ACK) and renewing involve the information contained in the Giaddr

           

          More details:

          How to configure DHCP RELAY AGENT on CISCO Routers – ConfigNetworks

           

          https://www.petenetlive.com/KB/Article/0001168

           

          Best regards!

          • 2. Re: DHCP Relay Agent
            nammon

            Thank Ing_Perc,

            I see that in the renewing process, DHCP client sends unicast DHCP Request packet to DHCP server directly (Destination IP is IP address on DHCP server), DHCP Relay Agent forwards just this packet, doesn't add Giaddr to this packet (unchanged Giaddr so it still is 0.0.0.0).

            In response to the receipt of DHCP Request message from DHCP client, DHCP server will unicast ACK packet, but it encapsulates ACK packet with Destination IP of DHCP Relay Agent's IP.

            Why doesn't DHCP server send ACK message to DHCP client directly as same as the sending Request message of the client before?

            • 3. Re: DHCP Relay Agent
              Ing_Percy

              Hi!

              Nam Nguyen escribió:

               

              Thank Ing_Perc,

              I see that in the renewing process, DHCP client sends unicast DHCP Request packet to DHCP server directly (Destination IP is IP address on DHCP server), DHCP Relay Agent forwards just this packet, doesn't add Giaddr to this packet (unchanged Giaddr so it still is 0.0.0.0).

              Put the image of capture in Wireshark. Is the capture of packet between the DHCP Client and DHCP Relay or between the DCHP Relay and DCHP server?

              Nam Nguyen escribió:

              In response to the receipt of DHCP Request message from DHCP client, DHCP server will unicast ACK packet, but it encapsulates ACK packet with Destination IP of DHCP Relay Agent's IP.

              Why doesn't DHCP server send ACK message to DHCP client directly as same as the sending Request message of the client before?

              If in the DHCP packet is included the information of IP of DHCP Relay Agent, then the DHCP server got this information previously

              Put the captures in Wireshark


              Best regards!

              • 4. Re: DHCP Relay Agent
                nammon

                DHCPRA.PNG

                This is my topology

                - R1: DHCP client

                - R2: DHCP relay

                - R3: DHCP Server

                conf.PNG

                Packets captured by Wireshark

                https://drive.google.com/drive/folders/1NIw55vDsLqmkwciGILkGFEou1Vl4NMT8?usp=sharing

                 

                DHCP Relay Agent forwards just this packet, doesn't add Giaddr to this packet (unchanged Giaddr so it still is 0.0.0.0). DHCP Request packets on the link between R2 and R3 have the value of Giaddr field of 0.0.0.0.

                • 5. Re: DHCP Relay Agent
                  Ing_Percy

                  Hi!

                   

                  Very interesting!

                   

                  I implemented a topology in GNS3

                  DHCP capture-topo.JPG

                  RX#sh version | i IOS

                  Cisco IOS Software, 3700 Software (C3745-ADVIPSERVICESK9-M), Version 12.4(25d), RELEASE SOFTWARE (fc1)

                   

                  Configurations:

                   

                  R1

                  no ip routing

                  ip default-gateway 12.0.0.2

                  interface FastEthernet0/0

                  ip address dhcp

                  no shut

                   

                  R2

                  interface FastEthernet0/0

                  ip address 12.0.0.2 255.255.255.0

                  ip helper-address 23.0.0.3

                  no shut

                   

                  interface FastEthernet0/1

                  ip address 23.0.0.2 255.255.255.0

                  no shut

                   

                  R3

                  ip route 12.0.0.0 255.255.255.0 23.0.0.2

                  interface FastEthernet0/1

                  ip address 23.0.0.3 255.255.255.0

                  no shut

                   

                  DHCP capture0-2.JPG

                   

                  I captured from the interface f0/1 of R3

                  DHCP capture0-5.JPG

                   

                  After 5 minutes (lease): Packet captured

                  DHCP capture1.JPG

                   

                  DHCP Request

                  DHCP request R3-f0_1.JPG

                   

                  DHCP ACK

                  DHCP ack R3-f0_1.JPG

                   

                  I didn't see the information of Relay Agent IP address (the subsequent packets show the same of the  numbers 33 an 34)

                   

                  Check your IOS in your routers (probably a bug), or the capture in the interface of the DHCP server.

                   

                  Best regards!

                  • 6. Re: DHCP Relay Agent
                    nammon

                    This is IOS version used in my lab.

                    R1#show version | include IOS

                    Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 15.2(4)M7, RELEASE SOFTWARE (fc2)

                    • 7. Re: DHCP Relay Agent
                      Suresh Rewar

                      DHCP Relay Agent Overview

                       

                      A DHCP relay agent is any host that forwards DHCP packets between clients and servers. Relay agents are used to forward requests and replies between clients and servers when they are not on the same physical subnet. Relay agent forwarding is distinct from the normal forwarding of an IP router, where IP datagrams are switched between networks somewhat transparently. By contrast, relay agents receive DHCP messages and then generate a new DHCP message to send out on another interface. The relay agent sets the gateway IP address (giaddr field of the DHCP packet) and, if configured, adds the relay agent information option (option82) in the packet and forwards it to the DHCP server. The reply from the server is forwarded back to the client after removing option 82.

                      The Cisco IOS XE DHCP relay agent supports the use of unnumbered interfaces. An unnumbered interface can “borrow” the IP address of another interface already configured on the router, which conserves network and address space. For DHCP clients connected though the unnumbered interfaces, the DHCP relay agent automatically adds a static host route once the DHCP client obtains an address, specifying the unnumbered interface as the outbound interface. The route is automatically removed once the lease time expires or when the client releases the address.

                       

                      Source Cisco!! https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr_dhcp/configuration/15-sy/dhcp-15-sy-book/dhcp-relay-agent.html

                        

                      • 8. Re: DHCP Relay Agent
                        Ing_Percy

                        Hi!

                         

                        Maybe that IOS has a bug, try with another IOS or real devices

                         

                        Regards!