This How To will describe the most common configuration needed for Cisco IOS to create a DHCP (IPv4) server on your switch or router.
Before You Start
Before you configure the DHCP address pool, you need to:
•Identify DHCP options for devices where necessary, including the following:
–Default boot image name
–Default routers
–Domain Name System (DNS) servers
–NetBIOS name server
–Primary subnet
–Secondary subnets and subnet-specific default router lists
•Decide on a NetBIOS node type (b, p, m, or h).
•Decide on a DNS domain name.
Configuration Steps
Step 1: On your Cisco device, get into configuration mode:
enable
configure terminal
Step 2: We will create a DHCP “pool” – a pool of addresses that the DHCP server will pass out.
ip dhcp pool “name”
You will replace “name” (no quotes) with whatever you want to call the pool of addresses. Be descriptive here. You will now be in DHCP pool configuration mode.
Step 3: We will now add the subnet network number and mask of the DHCP address pool. You can have multiple of these.
network network-number [mask | /prefix-length]
Step 4: Specify the domain name for the clients. Replace [domain] with whatever you are using. Example: cellstream.com
domain-name [domain]
Step 5: DHCP supplies more than just the address to a client. Other critical things like DNS server, options, Network Time server can be configured and provided. Some of the are optional.
dns-server address [address2 … address8]
The above command specifies the IP address of a DNS server that is available to a DHCP client. One IP address is required; however, you can specify up to eight IP addresses in one command line. Servers should be listed in order of preference.
Optional Configurations
The following are optional further configuration for the DHCP server.
bootfile filename | Specifies the name of the default boot image for a DHCP client. The boot file is used to store the boot image for the client. The boot image is generally the operating system the client uses to load. |
next-server address [address2 … address8] | Configures the next server in the boot process of a DHCP client. If multiple servers are specified, DHCP assigns them to clients in round-robin order. The first client gets address 1, the next client gets address 2, and so on. If this command is not configured, DHCP uses the server specified by the ip helper address command as the boot server. |
netbios-name-server address [address2 … address8] | Specifies the NetBIOS Windows Internet Naming Service (WINS) server that is available to a Microsoft DHCP client. One address is required; however, you can specify up to eight addresses in one command line. Servers should be listed in order of preference. |
netbios-node-type type | Specifies the NetBIOS node type for a Microsoft DHCP client. |
default-router address [address2 … address8] | Specifies the IP address of the default router for a DHCP client. The IP address should be on the same subnet as the client. One IP address is required; however, you can specify a up to eight IP addresses in one command line. These default routers are listed in order of preference; that is, address is the most preferred router, address2 is the next most preferred router, and so on. When a DHCP client requests an IP address, the router—acting as a DHCP server—accesses the default router list to select another router that the DHCP client is to use as the first hop for forwarding messages. After a DHCP client has booted, the client begins sending packets to its default router. |
option code [instance number] {ascii string | hex string | ip-address} | Configures DHCP server options. |
lease {days [hours] [minutes] | infinite} |
Specifies the duration of the lease. The default is a one-day lease. The infinite keyword specifies that the duration of the lease is unlimited. |
network network-number [{mask | /prefix-length} [secondary]] |
Specifies the network number and mask of a secondary DHCP server address pool. Any number of secondary subnets can be added to the DHCP server address pool. During execution of this command, the configuration mode changes to DHCP pool secondary subnet configuration mode, which is identified by the (config-dhcp-subnet-secondary)# prompt. In this mode, the administrator can configure a default router list that is specific to the subnet. |
override default-router address [address2 … address8] |
Specifies the default router list that is used when an IP address is assigned to a DHCP client from this secondary subnet. If this subnet-specific override value is configured, it is used when assigning an IP address from the subnet; the network-wide default router list is used only to set the gateway router for the primary subnet. If this subnet-specific override value is not configured, the network-wide default router list is used when assigning an IP address from the subnet. |
Last Step:
end
Displaying DHCP Server status
Use the following commands to see various DHCP status:
- show ip dhcp binding [address]
Displays a list of all bindings created on a specific DHCP server. - show ip dhcp conflict [address]
Displays a list of all address conflicts. - show ip dhcp database [url]
Displays recent activity on the DHCP database. - show ip dhcp server statistics
Displays count information about server statistics and messages sent and received.
For more information on DHCP configuration in IOS see: https://www.cisco.com/en/US/docs/ios/12_4t/ip_addr/configuration/guide/htdhcpsv.html
We hope this helped.