Configuring DHCP

Configuring DHCP
Cisco routers can be DHCP clients, servers, or relay agents. To configure an
IOS device as a DHCP client, use the ip address dhcp command on the
interface that needs to obtain the DHCP address. To configure a router as a
DHCP server, you must create an IP address pool and assign a network or
subnet to that pool. You can optionally add information, such as default
gateway, DNS server, lease duration, or options such as Option 150 for
Cisco IP phones. Exclude any static IP addresses within the pool, such as
the router’s address. You may also want to identify an external server to hold
the DHCP database of IP address bindings.
Cisco routers have an auto-configuration feature that allows the downloading
of some DHCP information from a central server. This saves the trouble of
configuring every router with complete DHCP information. To do this, one
interface on the router must have a DHCP address. The following example
shows a router configured as a DHCP server that imports its domain name,
DNS servers, and other information from another DHCP server off interface
Gi0/0. The IP address range of 10.6.3.1–10.6.3.5 is excluded from the pool.
Router(config)#ip dhcp excluded-address 10.6.3.1 10.6.3.5
!
Router(config)#ip dhcp pool Gator
Router(dhcp-config)#network 10.6.3.0 /24
Router(dhcp-config)#default-router 10.6.3.1
Router(dhcp-config)#import all
!
Router(config)#int gi 0/0
Router(config-if)#ip address dhcp