Configure and verify IPv4 and IPv6 DHCP

Exam: Cisco 300-101 - CCNP Implementing Cisco IP Routing (ROUTE v2.0)


  • DHCP client, IOS DHCP server, DHCP relay
  • DHCP options (describe)

DHCP (Dynamic Host Configuration Protocol) allows DHCP server to pass configuration information to the host computers on a TCP/IP network. A Cisco IOS DHCP server supplies an IP addresses to DHCP client devices automatically from a pool of IP address. In addition to IP address, DHCP server can be configured to provide the IP address of the DNS server, default gateway, and the default router information to DHCP clients.

DHCP clients are the network devices that request configuration parameters from DHCP server and DHCP relay agents are the host servers on a network that capture and forward the DHCP packets between clients and servers in case the clients and the servers are on different subnet.

DHCP uses following types of address allocations:

  • Automatic allocation -This allows permanent IP address allocation
  • Dynamic allocation - This allows IP address to be assigned from a pool of IP addresses for a limited period.
  • Manual allocation - This allows IP address to be assigned by a network administrator.

DHCP IOS Server configuration with IPv4 commands

While configuring DHCP IOS server, you need to either configure DHCP Database Agents or disable conflict logging. When DHCP database agents such as FTP server or TFTP server are configured with same IP address, the address conflicts occur. To resolve these conflicts, you need to configure DHCP server to check for conflicts.

You can also choose to disable the logging of DHCP conflicts if you do not want to configure DHCP database agents.

To configure DHCP IOS server with IPv4 commands, you need to:

Enable the privileged Exec mode

RouterR1# enable

Enter into configuration mode

RouterR1# configure terminal

Configure database agent with following syntax

RouterR1 (config)# ipdhcp database url [timeout seconds | write-delay seconds]

RouterR1 (config)#ipdhcp database ftp://user:password@172.168.11.1/router-dhcp timeout 80

Or configure no logging using the following syntax:

RouterR1 (config)#no ipdhcp conflict logging

Excluding IP Addresses

You can exclude the IP address range that should not be used by the DHCP Server to assign to clients. To do so, the following command should be used in global configuration mode:

RouterR1 (config)# ipdhcp excluded-address low-address [high-address]

RouterR1 (config)#ipdhcp excluded-address 172.168.11.100 172.168.11.103

Exit configuration mode

RouterR1 (config)# end

Configuring DHCP Address Pools

Enable the privileged Exec mode

RouterR1# enable

Enter into configuration mode

Router# configure terminal

Create a DHCP server address pool name and enter into DHCP pool configuration mode using ipdhcp<pool name>command

RouterR1 (config)#ipdhcpmytestpool

Provide the subnet network number and mask for the DHCP address pool by using the network network-number [mask | /prefix-length] [secondary] command

RouterR1 (dhcp-config)# network 172.168.0.0 /16

Provide the domain name for the client using domain-name <domain> command

RouterR1 (dhcp-config)# domain-name mytestdomain.com

Specify upto eight DNS servers in the order of preference that can be used by a DHCP client by using the dns-server address [address2 ... address8] command.

RouterR1 (dhcp-config)#dns server 172.168.11.103 172.168.12.103

Return to privileged EXEC mode.

RouterR1 (dhcp-config)# end

Configuring the DHCPv6 Server Function

IPv6 is not supported on all Cisco routers. It is only supported on Gigabit Switch Routers (GSRs) and Cisco 10720 Internet routers with Cisco IOS Release 12.0S.

While configuring IPv6 on DHCP IOS server, you need to configure the Prefix Delegation feature that allows you to manage links, subnets, and site addressing changes.

DHCPv6 allows IP address assignment through stateful or stateless address information. The statefull address assignment is managed centrally for clients. The stateless address assignment is done on clients separately and the configuration server does not need to maintain dynamic state for individual clients.

Configuring the DHCPv6 Configuration Pool

Enable the privileged Exec mode

RouterR1> enable

Enter into global configuration mode

RouterR1# configure terminal

Configure DHCPv6 configuration information pool and enter into pool configuration mode

RouterR1 (config)# ipv6 dhcp pool mytestpoo1

Configure domain for IPv6 client

RouterR1 (config-dhcp)# domain-name mytestdomain.com

Configure the DHCP IPv6 servers available for the client

RouterR1 (config-dhcp)# dns-server2001:DB8:3000:3000::42

Configure a manually configured numeric prefix to be delegated to a specified client's IAPD (Association for Prefix Delegation), which is a set of prefixes assigned to a requesting router.

prefix-delegation ipv6-prefix/prefix-length client-duid [iaid iaid] [lifetime]

RouterR1 (config-dhcp)# prefix-delegation 2001:DB8:1284::/48 0005000400F1A4D070D03

Configure a local prefix pool that can be used to delegate prefixes to DHCPv6 clients with the following syntax.

prefix-delegation pool poolname [lifetime valid-lifetime preferred-lifetime]

RouterR1 (config-dhcp)# mytest-prefix-delegation-Poolmytestpool lifetime 1600 50

Exits DHCPv6 pool configuration mode configuration mode

RouterR1 (config-dhcp)# exit

Enable DHCP configuration pool

RouterR1 (config-if)# ipv6 dhcp server mytestpoo1

Configuring a Binding Database Agent for the Server Function

Each DHCPv6 configuration pool has an associated binding table. The binding table contains the records about all the prefixes in the configuration pool that have been explicitly delegated to clients.

Enable the privileged Exec mode

RouterR1> enable

Enter into global configuration mode

RouterR1# configure terminal

Configure DHCPv6 binding database agent parameters with the following syntax

ipv6dhcp database agent [write-delay seconds] [timeout seconds]

RouterR1 (config)# ipv6 dhcp database tftp://10.0.0.1/dhcp-binding

Configure DHCP client(IPv4/IPv6)

Enable the privileged Exec mode

RouterR1> enable

Enter into global configuration mode

RouterR1# configure terminal

Configure the interface type and number and place the router in interface configuration mode with the interface type number command

RouterR1 (config)# interface ethernet 0/0

Configure DHCPv6 client process and then enable a request for prefix delegation through a specified interface with the following command.

ipv6dhcp client pd {prefix-name | hint ipv6-prefix} [rapid-commit]

RouterR1 (config-if)# ipv6 dhcp client pd my-dhcp-prefix

IPv4 command to acquire an IP address on an interface from DHCP

RouterR1 (config-if)#ip address dhcp

Return to privileged EXEC mode.

RouterR1 (config-if)# end

Configure DHCP relay IPv4/IPv6

Enter into configuration mode

dhcphost/Admin#(config)

Enter configuration commands, one per line. End with CNTL/Z

dhcphost/Admin(config)#

Configure the host to accept DHCP packets from clients

IPv6 command

dhcphost /Admin(config)# ipv6 dhcp relay enable

IPv4 command

dhcphost /Admin(config)# ipdhcp relay enable

Configure the host with the DHCP server IP address to which the host will forward the client requests.

IPv6 command

dhcphost /Admin(config)# ipv6 dhcp relay server 2001:DB8:1::/64

IPv4 command

dhcphost /Admin(config)# ipdhcp relay server 192.168.20.1

Optionally configure the host with the IP address of a DHCPv6 server that is reachable on its link-local address on a specific VLAN.

IPv6 command

dhcphost /Admin(config)# ipv6 dhcp relay server

fe80::250:58ff:fe90:2cfwd-interface vlan 50

Optionally configure a relay agent information reforwarding policy on the host so that host should know what do if a forwarded message already contains relay information.

IPv4 command

dhcphost /Admin(config)# ipdhcp relay information policy replace

Exit configuration mode

host1/Admin(config)# exit

DHCP Options

DHCP provides configuration information to DHCP client computers on a TCP/IP network using a DHCP message that contain options field to store tagged data items. Using DHCP options, additional information can be sent to clients. For example, while sending DHCP information to TFTP server, you can use option 150 to customize it to support intelligent IP phones. The TFTP server stores Cisco IOS image.

Some default DHCP Server Options during lease negotiation are:

  • Subnet mask option: This option is used to specify the client's subnet mask. The code used for this option is 1
  • Router option: This option is used to specify list of routers IP addresses in the preference order on the client's subnet. The code used for this option is 3.
  • Domain name server option: This option is used to specify a list of DNS name servers available to the client. The code used for this option is 6.
  • Hostname option: This option is used to specify the name of the client. The code used for this option is 12.
  • Domain name option: This option is used to specify domain name to be used by client to resolve hostnames. The code used for this option is 15.
  • NetBIOS over TCP/IP name server option: This option is used to specify a list of RFC 1001/1002 NetBIOS name servers. The code used for this option is 44.
  • NetBIOS over TCP/IP node type option: This option is used to enable NetBIOS over TCP/IP clients. The code used for this option is 46.
  • IP address lease time option: This option is used to allow the client to request a lease for the IP address. The code used for this option is 51.
  • DHCP message type option: This option is used to specify the type of the DHCP message. The code used for this option is 53.
  • Server identifier option: This option is used to identify the IP address of the selected DHCP server. The code used for this option is 54.

Example question

Why do you need to configure a DHCP Database Agent?

  1. To resolve the conflicts that occurs due to the same IP configuration to the database agents.
  2. To resolve the conflicts that occurs due to the same IP configuration to the relay agents.
  3. To resolve the conflicts that occurs due to the same IP configuration to the DHCP clients.
  4. To resolve the conflicts that occurs due to the same IP configuration to the DHCP servers

Answer A

DHCP database agents are the host servers such as FTP server, TFTP server. When DHCP database agents are configured with same IP address, the address conflicts occur. To resolve these conflicts, you need to configure DHCP server to check for conflicts.


Related IT Guides

  1. Configure and verify default routing
  2. Configure and Verify network types, area types, and router types
  3. Configure and Verify RIPv2
  4. Configure and verify static routing
  5. Describe administrative distance
  6. Describe device security using IOS AAA with TACACS+ and RADIUS
  7. Describe DMVPN (single hub)
  8. Describe IPv6 NAT
  9. Describe, configure, and verify BGP peer relationships and authentication
  10. Explain BGP attributes and best-path selection
  11. Explain Frame Relay
  12. Explain general network challenges
  13. Layer 3 technologies - Describe administrative distance
  14. Use Cisco IOS troubleshooting tools