Configuring the DHCP client

Last Updated : Mar 25, 2020 |

Procedure

  1. Enter the context of the FastEthernet interface.

    For example:

    Gxxx-001# interface fastethernet 10/2
    Gxxx-001(config-if:FastEthernet 10/2)#
  2. Optionally, configure DHCP client parameters.

    If you do not configure these parameters, their default values are used:

    • Use the ip dhcp client client-id command to set the client identifier for the DHCP client. By default, the client identifier is usually the MAC address of the Branch Gateway FastEthernet interface.

    • Use the ip dhcp client hostname command to set the hostname for the DHCP client. By default, the DHCP client uses the Branch Gateway’s hostname.

    • Use the ip dhcp client lease command to set the lease requested by the DHCP client. The lease is the length of time that the IP address provided by the DHCP server remains in effect. By default, the client does not request a specific lease from the DHCP server and uses the lease set by the DHCP server.

    • Use the ip dhcp client request command to determine which DHCP options the DHCP client requests from the DHCP server. By default, the DHCP client requests all DHCP options.

      For example:

      Gxxx-001(config-if:FastEthernet 10/2)# ip dhcp client client-id hex 
      01:00:04:0D:29:DC:68
      Done!
      Gxxx-001(config-if:FastEthernet 10/2)# ip dhcp client hostname Gxxx-A
      Done!
      Gxxx-001(config-if:FastEthernet 10/2)# ip dhcp client lease 1 4 15
      Done!
      Gxxx-001(config-if:FastEthernet 10/2)# no ip dhcp client request domain-name
      Done!
  3. Optionally, use the ip dhcp client route track command to apply an object tracker to monitor the DHCP client’s default route.

    The object tracker continuously checks the validity of the default route, that is, whether data can be transmitted over the default route. Whenever the object tracker determines that the default route has become invalid, the route is dropped from the routing table and traffic is routed to alternate routes. If the default route becomes valid again, it is added back to the routing table.

    Note that if several default routers are learned from a specific interface, the object tracker tracks only the first one.

    For example:

    Gxxx-001(config-if:FastEthernet 10/2)#ip dhcp client route track 3
    Done!
  4. Enable the DHCP client by entering ip address dhcp.

    A message appears, displaying the IP address and mask assigned by the DHCP server. For example:

    Gxxx-001(config-if:FastEthernet 10/2)# ip address dhcp
    Done!
    Interface FastEthernet 10/2 assigned DHCP address 193.172.104.161, mask 
    255.255.255.0
    Note:

    Whenever you change the value of a DHCP client parameter (such as, client-id, or client hostname), enter ip address dhcp again to re-initiate DHCP address negotiation using the new values.

  5. Use the show ip dhcp-client command to view the DHCP client parameters.