Configure and verify DHCP (IOS Router)

Exam: Cisco 200-120 - CCNA Cisco Certified Network Associate CCNA (803)


Configuring DHCP server on Router

DHCP provides an IP address automatically to client from a pool of IP address. Beside of an IP, it provides a lot of information to the client, such as DNS server IP address, Default gateway IP address, and much more. A router or a Layer 3 switch can be configured as:

  • DHCP server - provide an IP address when requested
  • DHCP client - when it requests IP address
  • DHCP relay agent - when it captures IP requests from client, add extra information to the request, and forward the request to the DHCP server.

The configuration of DHCP using SDM helps the user to configure the router quickly and easily without requiring the knowledge of command line interface (CLI). Instead of using telnet or SSH the user connects to the router using web browser. You can configure DHCP with SDM in following steps:

  • Establish IP connectivity by configuring the IP address on local LAN so that host on the LAN can ping the LAN interface of router.
  • Install the SDM software on the router so that user can access the router using web browser.
  • After accessing SDM, click on Configure near the top of SDM window and select the Additional Tasksresiding at the bottom of task pane.
  • In Additional Tasks, click on the plus (+) sign next to DHCP to expand the menu, and then click on DHCP pools.
  • In DHCP pools screen, click on the ADD button to create new DHCP pool. Define the DHCP pool name, network, subnet mask, start and end IP of address range, default gateway, DNS server address, and domain name. After entering all values click OK.
  • After clicking OK theDeliver Configuration to Router window appears, which shows the CLI commands generated by SDM that are delivered to the router to configure DHCP. Do not check on the box Save running config to router’s startup config. Click Deliver to finish configuring the router.
  • After commands are delivered, the final DHCP configuration showing details of DHCP pool is displayed. Choose File>Exit from the SDM main menu to end the SDM session and click Yes to confirm existing SDM.

The other way to configure DHCP on a router is through CLI mode.You can configure a router having hostname Donna with a DHCP scope as:

Donna>

Enable move to privilege mode

Donna>#conf t

Move to global configuration mode

Donna(config)#ip dhcp pool administrator

Creates DHCP pool called administrator

Donna(dhcp-config)#network 10.1.2.0 255.255.255.0

Defines the range of address to be leased

Donna(dhcp-config)#default-router 10.1.2.1

Defines address of the default router for client

Donna(dhcp-config)#dns-server 10.1.2.10

Defines the address of the DNS server for the client

Donna(dhcp-config)#lease 10 6 30

Defines the lease time 10 days, 6 hours, and 30 minutes.

Donna(dhcp-config)#lease infinite

Used to set the lease time to infinity, the default time is 1 day.

Donna(dhcp-config)#exi

Returns to global configuration mode

Donna(config)#ip dhcp excluded-address 10.1.2.1 10.1.2.9

Specifies the range of address that is not to be leased out to client.

Donna(config)#service dhcp

Enables the DHCP service and relay features on a Cisco IOS software.

Donna(config)#no service dhcp

Turns off the DHCP services. On Cisco IOS software DHCP service is enabled by default.

Creating DHCP pools on a Router is a simple process. For this, you just create the pool name, add the network, subnet mask and the default gateway, add DNS server, lease time, and exclude the IP addresses that you don’t want to handle out. The IP dhcp exclude- address command is one of the Cisco IOS IP commands that is configured globally rather than configuring it on an interface.

Verify and Troubleshoot DHCP

Once the configuration is done, you may face problems such as DHCP client does not have any IP address configured, DHCP client have automatically assigned an IP address itself which is not correct for the current network, DHCP client unable to get IP address from DHCP server and many more. For this you must use some commands that help you to troubleshoot and verify these kinds of problems.

Donna# showip dhcp binding

Shows the list of all bindings created

Donna# sh ip dhcp binding a.b.c.d

Shows the binding for specific DHCP client with an IP address of a.b.c.d

Donna# sh ip dhcp conflict

Shows the list of all address conflicts recorded by DHCP server.

Donna#clear ip dhcp binding

Clears the DHCP bindings created automatically

Donna# clear ip dhcp conflict x.y.z.w

Clears address conflicts from the database

Donna# clear ip dhcp conflict

Clears conflicts for all addresses

Donna# sh ip dhcp database

Shows the recent activity on DHCP database

Donna# sh ip dhcp server statistics

Shows list of the number of messages that are sent and received by DHCP server.

Donna# clear ip dhcp server statistics

Reset all DHCP server counter to 0

Donna# debug ip dhcp server

Shows the DHCP process of addresses leased and returned.

Configuration of DNS Server

DNS abbreviated as Domain Name System or Domain Name Server is basically an Internet service that converts domain name into IP address. Domain names are in the form of alphabets and are easy to remember. While using the internet, whenever user uses the domain name, a DNS service is required to translate that name to related IP address.

To configure Router as a DNS server using CLI mode use following configuration steps:

Router>

Enable enables privilege mode

Router# config t

Enters to global configuration mode.

Router (config)#ip dns server

Enables the DNS server.

Router# ip name-server server-address 1[address 2…….address n]

Configures Cisco IOS resolver name server and DNS server forwarder.

Router (config)# ip dns server queue limit {forwarder queue-size-limit | director queue-size-limit}

Configures a limit of size of the queue used by DNS server processes.

Router(config)# ip host [vrf X] [view Y] hostname {address1 [address2 ....addressn] | additional address4 [address5 ....addressn]}

Configures local hosts.

Router(config)# ip dns primary domain-name soa primary-server-name mailbox-name [refresh-interval [retry-interval [expire-ttl [ minimum-ttl ]]]]

Configures the device as the primary DNS name server for a domain and as the start of authority (SOA) record source.

Router(config)# ip host domain-name ns server-name

Configures the device to create a name server record resource to be returned when the DNS server is queried for the associated domain.

To configure Router as a DNS server using SDM mode use following steps:

  1. After accessing SDM, click on Configure at the top of SDM window and select the Additional Tasks at the bottom of task pane.
  2. In Additional Tasks, click on DNS tab. Check on the Configure DNS server and enter the primary DNS server IP address and domain name.
  3. Check on Configure WINS server and enter the primary server IP address and click OK.

Verify and Troubleshooting DNS

After configuring DNS there are different kinds of problem that user can face, such as the DNS server is not responding to client, or DNS server does not resolve names correctly. In that case user needs to check the network connectivity by log on to the DNS server and ping some machines. Also, ping DNS server from random machines. If DNS client can ping the DNS server computer, then verify that DNS server is started and able to listen and respond to client request. Use nslookup command to test whether server can respond to DNS clients. You can also use below mentioned commands to verify DNS configuration:

Device# ping hosts

This command is used to diagnose basic network connectivity. After the DNS configuration is set, user can verify the DNS server by using a hostname to ping or telnet to device.

Device# show hosts

Displays the default domain name, the style of name lookup service, a list of name server hosts, and the cached list of hostnames and addresses.

Exam Question

1. Which command does DHCP server use to check IP address conflict?

  1. Show ip dhcp binding.
  2. Show ip dhcp server pool.
  3. Show ip dchp conflict.
  4. Show ip dhcp database.

Answer: C

The show ipdchp conflict command is used by DHCP server use to check IP address conflict.

2. Which one of the following options allows client to update their DNS entry as their IP address changes?

  1. Dynamic DNS.
  2. Mail transfer agent.
  3. Authoritative name server.
  4. No of above.

Answer: A

Dynamic DNS allows client to update their DNS entry as their IP address changes.


Related IT Guides

  1. Configure and verify NAT for given network requirements
  2. Configure and verify network device security features
  3. Configure and verify switch port security
  4. Describe SNMP v2 and v3
  5. Describe the purpose and basic operation of the protocols in the OSI and TCP/IP models
  6. Identify enhanced switching technologies
  7. Troubleshoot and correct common problems associated with IP addressing and host configurations
  8. Troubleshoot and resolve Layer 1 problems
  9. Troubleshoot and resolve OSPF problems
  10. Troubleshoot and resolve VLAN problem