Chapter 17. DHCP

This chapter provides information and commands concerning the following topics:

Configuring a DHCP Server on an IOS Router

Router(config)# ip dhcp pool INTERNAL Creates a DHCP pool named INTERNAL. The name can be anything of your choosing
Router(dhcp-config)# network 172.16.10.0 255.255.255.0 Defines the range of addresses to be leased
Router(dhcp-config)# default-router 172.16.10.1

Defines the address of the default router for the client

One IP address is required; however you can specify up to eight IP addresses in the command line. These are listed in order of precedence

Router(dhcp-config)# dns-server 172.16.10.10 Defines the address of the Domain Name System (DNS) server for the client.
Router(dhcp-config)# netbios-name-server 172.16.10.10 Defines the address of the NetBIOS server for the client
Router(dhcp-config)# domain-name fakedomainname.com Defines the domain name for the client
Router(dhcp-config)# lease 14 12 23 Defines the lease time to be 14 days, 12 hours, 23 minutes
Router(dhcp-config)# lease infinite Sets the lease time to infinity; the default time is 1 day
Router(dhcp-config)# exit Returns to global configuration mode
Router(config)# ip dhcp excluded-address 172.16.10.1 172.16.10.10 Specifies the range of addresses not to be leased out to clients
Router(config)# service dhcp Enables the DHCP service and relay features on a Cisco IOS router
Router(config)# no service dhcp Turns the DHCP service off. The DHCP service is on by default in Cisco IOS Software

Using Cisco IP Phones with a DHCP Server

Note

This section is not part of the CCNA vendor exam topics.

Enterprises with small branch offices that implement a VoIP solution may choose to implement Cisco Unified Communications Manager, often referred to as CallManager, at a central office to control Cisco IP Phones at small branch offices. This design allows for centralized call processing and reduces equipment and administration required (especially at the branch office).

Cisco IP Phones download their configuration from a TFTP server. When a Cisco IP Phone starts, if it does not have its IP address and TFTP server IP address preconfigured, it sends a request with option 150 or 66 to the DHCP server to obtain this information.

  • DHCP option 150 provides the IP address of a list of TFTP servers.

  • DHCP option 66 gives the IP address of a single TFTP server.

Note

Cisco IP Phones may also include DHCP option 3 in their requests, which sets a default route.

Router(dhcp-config)# option 66 ip 10.1.1.250 Provides the IP address of a TFTP server for option 66
Router(dhcp-config)# option 150 ip 10.1.1.250 Provides the name of a TFTP server for option 150
Router(dhcp-config)# option 150 ip 10.1.1.250 10.1.1.251 Provides the names of two TFTP servers for option 150
Router(dhcp-config)# option 3 ip 10.1.1.1 Sets the default route

Verifying and Troubleshooting DHCP Configuration

Router# show ip dhcp binding Displays a list of all bindings created
Router# show ip dhcp binding w.x.y.z Displays the bindings for a specific DHCP client with an IP address of w.x.y.z
Router# clear ip dhcp binding a.b.c.d Clears an automatic address binding from the DHCP server database
Router# clear ip dhcp binding * Clears all automatic DHCP bindings
Router# show ip dhcp conflict Displays a list of all address conflicts that the DHCP server recorded
Router# clear ip dhcp conflict a.b.c.d Clears an address conflict from the database
Router# clear ip dhcp conflict * Clears conflicts for all addresses
Router# show ip dhcp database Displays recent activity on the DHCP database
Router# show ip dhcp pool Displays information about DHCP address pools
Router# show ip dhcp pool name Displays information about the DHCP pool named name
Router# show ip dhcp server statistics Displays a list of the number of messages sent and received by the DHCP server
Router# clear ip dhcp server statistics Resets all DHCP server counters to 0
Router# debug ip dhcp server {events | packet | linkage | class} Displays the DHCP process of addresses being leased and returned

Configuring a DHCP Helper Address

Router(config)# interface gigabitethernet 0/0 Moves to interface configuration mode
Router(config-if)# ip helper-address 172.16.20.2 Forwards DHCP broadcast messages as unicast messages to this specific address instead of having them be dropped by the router

Note

The ip helper-address command forwards broadcast packets as a unicast to eight different UDP ports by default:

  • TFTP (port 69)

  • DNS (port 53)

  • Time service (port 37)

  • NetBIOS name server (port 137)

  • NetBIOS datagram server (port 138)

  • Boot Protocol (BOOTP) client and server datagrams (ports 67 and 68)

  • TACACS service (port 49)

If you want to close some of these ports, use the no ip forward-protocol udp x command at the global configuration prompt, where x is the port number you want to close. The following command stops the forwarding of broadcasts to port 49:

Router(config)# no ip forward-protocol udp 49

If you want to open other UDP ports, use the ip forward-helper udp x command, where x is the port number you want to open:

Router(config)# ip forward-protocol udp 517

Configuring a DHCP Client on a Cisco IOS Software Ethernet Interface

Router(config)# interface gigabitethernet 0/0 Moves to interface configuration mode
Router(config-if)# ip address dhcp Specifies that the interface acquire an IP address through DHCP

Configuration Example: DHCP

Figure 17-1 illustrates the network topology for the configuration that follows, which shows how to configure DHCP services on a Cisco IOS router using the commands covered in this chapter.

Image

Figure 17-1 Network Topology for DHCP Configuration

Edmonton Router

Router> enable Moves to privileged EXEC mode
Router# configure terminal Moves to global configuration mode
Router(config)# hostname Edmonton Sets the host name
Edmonton(config)# interface gigabitethernet 0/0 Moves to interface configuration mode
Edmonton(config-if)# description LAN Interface Sets the local description of the interface
Edmonton(config-if)# ip address 10.0.0.1 255.0.0.0 Assigns an IP address and netmask
Edmonton(config-if)# no shutdown Enables the interface
Edmonton(config-if)# interface serial 0/0/0 Moves to interface configuration mode
Edmonton(config-if)# description Link to Gibbons Router Sets the local description of the interface
Edmonton(config-if)# ip address 192.168.1.2 255.255.255.252 Assigns an IP address and netmask
Edmonton(config-if)# clock rate 2000000 Assigns the clock rate to the DCE cable on this side of link
Edmonton(config-if)# no shutdown Enables the interface
Edmonton(config-if)# exit Returns to global configuration mode
Edmonton(config)# ip route 192.168.3.0 255.255.255.0 serial 0/0/0 Creates a static route to the destination network
Edmonton(config)# service dhcp Verifies that the router can use DHCP services and that DHCP is enabled
Edmonton(config)# ip dhcp pool 10NETWORK Creates a DHCP pool called 10NETWORK
Edmonton(dhcp-config)# network 10.0.0.0 255.0.0.0 Defines the range of addresses to be leased
Edmonton(dhcp-config)# default-router 10.0.0.1 Defines the address of the default router for clients
Edmonton(dhcp-config)# netbios-name-server 10.0.0.2 Defines the address of the NetBIOS server for clients
Edmonton(dhcp-config)# dns-server 10.0.0.3 Defines the address of the DNS server for clients
Edmonton(dhcp-config)# domain-name fakedomainname.com Defines the domain name for clients
Edmonton(dhcp-config)# lease 12 14 30 Sets the lease time to be 12 days, 14 hours, 30 minutes
Edmonton(dhcp-config)# exit Returns to global configuration mode
Edmonton(config)# ip dhcp excluded-address 10.0.0.1 10.0.0.5 Specifies the range of addresses not to be leased out to clients
Edmonton(config)# ip dhcp pool 192.168.3NETWORK Creates a DHCP pool called the 192.168.3NETWORK
Edmonton(dhcp-config)# network 192.168.3.0 255.255.255.0 Defines the range of addresses to be leased
Edmonton(dhcp-config)# default-router 192.168.3.1 Defines the address of the default router for clients
Edmonton(dhcp-config)# netbios-name-server 10.0.0.2 Defines the address of the NetBIOS server for clients
Edmonton(dhcp-config)# dns-server 10.0.0.3 Defines the address of the DNS server for clients
Edmonton(dhcp-config)# domain-name fakedomainname.com Defines the domain name for clients
Edmonton(dhcp-config)# lease 12 14 30 Sets the lease time to be 12 days, 14 hours, 30 minutes
Edmonton(dhcp-config)# exit Returns to global configuration mode
Edmonton(config)# exit Returns to privileged EXEC mode
Edmonton# copy running-config startup-config Saves the configuration to NVRAM

Gibbons Router

Router> enable Moves to privileged EXEC mode
Router# configure terminal Moves to global configuration mode
Router(config)# hostname Gibbons Sets the host name
Gibbons(config)# interface gigabitethernet 0/0 Moves to interface configuration mode
Gibbons(config-if)# description LAN Interface Sets the local description of the interface
Gibbons(config-if)# ip address 192.168.3.1 255.255.255.0 Assigns an IP address and netmask
Gibbons(config-if)# ip helper-address 192.168.1.2 Forwards DHCP broadcast messages as unicast messages to this specific address instead of having them be dropped by the router
Gibbons(config-if)# no shutdown Enables the interface
Gibbons(config-if)# interface serial 0/0/1 Moves to interface configuration mode
Gibbons(config-if)# description Link to Edmonton Router Sets the local description of the interface
Gibbons(config-if)# ip address 192.168.1.1 255.255.255.252 Assigns an IP address and netmask
Gibbons(config-if)# no shutdown Enables the interface
Gibbons(config-if)# exit Returns to global configuration mode
Gibbons(config)# ip route 0.0.0.0 0.0.0.0 serial 0/0/1 Creates a default static route to the destination network
Gibbons(config)# exit Returns to privileged EXEC mode
Gibbons# copy running-config startup-config Saves the configuration to NVRAM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.196.175