DHCP Configuration Parameters and Settings Explained
This tutorial explains the Cisco specific DHCP configuration parameters and settings in detail. Learn the configuration parameters and settings that you need to configure a Cisco device (router or switch) to act as the DHCP server.
To configure a Cisco router or switch as a DHCP server, we have to create and configure a DHCP pool on it. A DHCP pool is a collection of IP configurations that we want to assign to DHCP clients. Each IP configuration contains a unique IP address and a few common network settings and addresses such as the default gateway IP, DNS servers' IP addresses, and TFTP server's IP addresses.
Let's understand these settings and addresses in detail.
IP range (subnet or scope)
This is a range of IP addresses that we want to assign to clients. In each range, the first address and the last address have special meanings. The first address is known as the network ID (or address). The last address is known as the local broadcast ID (or address).
DHCP clients use the network address and broadcast address to request an IP configuration from DHCP servers, while the DHCP servers use the same addresses to offer the IP configuration to the DHCP clients. To learn how this process work in detail, please check the second part of this article.
This tutorial is the third part of the article 'DHCP (Dynamic Host Configuration Protocol) basic concepts, configurations, functions, and options Explained'. Other parts of this tutorial are the following.
What DHCP is and Types of DHCP Explained
How DHCP works explained with examples
How to Configure DHCP Server on Cisco Switches
Configure DHCP Server for multiple VLANs on the Switch
How to Configure DHCP Server on Cisco Routers
How DHCP Relay Agents work Explained
How to Configure DHCP Relay Agent on Cisco Routers
How DHCP Snooping works Explained
Configure DHCP Snooping on Cisco Switches
To define a range, we use the network ID and the subnet mask. For example, to define a range of IP addresses from 192.168.1.0 to 192.168.1.255, we would set the network ID to 192.168.1.0 and the subnet mask to 255.255.255.0.
The network ID 192.168.1.0 and the subnet mask 255.255.255.0 represent a range of IP addresses from 192.168.1.0 to 192.168.1.255. In this range, the network address is 192.168.1.0 and the local broadcast address is 192.168.1.255.
DHCP servers do not lease the network ID and broadcast ID. Except the network ID and broadcast ID, all addresses of the defined IP range can be leased to clients.
If you don't want to assign a few addresses from the range, you can configure them as excluded addresses. DHCP servers do not assign the excluded addresses. This feature allows us to configure static IP addresses on critical network resources such as servers, printers, and routers.
The default gateway IP address
If a local host wants to send a data packet to a host that is not available in the local network, it sends the data packet to the default gateway. This option allows us to set a default gateway IP address for hosts. Typically, this is the IP address of the router's interface that is directly connected to the local network.
DNS server IP addresses
DNS servers allow hosts to access network resources by using their names instead of their IP addresses. If a DNS server is configured, you can set its IP address in this option. If you have more than one DNS server, you can configure all of them on hosts through this option.
TFTP server IP address
A TFTP server allows hosts to download or store files. If a TFTP server is available in the network, you can use this option to provide the IP address of the TFTP server to all hosts.
The lease duration defines the validity of the IP configuration. A DHCP client can use the assigned IP configuration until its validity expires. Once the validity period is expired, the client needs to obtain a new IP configuration from the server. By default, an IP configuration remains valid for 24 hours. Depending on your requirement, you can increase or decrease it.
The following image shows how multiple IP configurations are stored in a DHCP pool.
DHCP pool configuration mode
Cisco routers and switches include a special configuration mode known as DHCP pool configuration mode. DHCP pool configuration mode allows us to create and configure DHCP pools. Except the command that defines the list of excluded or reserved addresses, all commands that are required to configure the DHCP server run in DHCP pool configuration mode.
DHCP configuration steps
To configure a DHCP server on a Cisco router or switch, use the following configuration steps.
- Create a list of addresses that you want to exclude or reserve. For this, use the command 'ip dhcp excluded-address [first-address last-address]' in global configuration mode.
- Create your DHCP pool using a unique name. To create a DHCP pool and to navigate to DHCP pool configuration mode, use the command 'ip dhcp pool [name]' in global configuration mode.
- Define the range of IP addresses that the DHCP server should provide to clients. Use the 'network [subnet-ID mask] or network [subnet-ID prefix-length]' command in DHCP pool configuration mode to define the range of IP addresses.
- Add the default gateway IP address. Use the 'default-router [ip-address]' command in DHCP pool configuration mode to define the default gateway IP address.
- Provide the DNS server addresses. Use the dns-server [address1 address2...] command in DHCP pool configuration mode to define the list of DNS server IP addresses used by clients in this pool.
- If you don’t want to use the default lease duration of 24 hours, set the lease duration. Use the lease [days hours minutes] command in DHCP pool configuration mode to define the length of the lease, in days, hours, and minutes.
- If you have a TFTP server in your network, set the IP address of it. Use the next-server [ip-address] command in DHCP pool configuration mode to define the TFTP server IP address.
That's all for this part. In the next part of this tutorial, we will take a packet tracer example to understand how to use or execute the above-explained commands to configure a Cisco switch to act as a DHCP server. If you like this tutorial, please don't forget to share it with friends through your favorite social channel.
By ComputerNetworkingNotes Updated on 2020-10-16 15:55:39 IST
- How Access Lists work on Cisco routers
- Malware, Spyware, Virus, Worm, and Trojan horse
- How RIP Routing Protocol Works
- Vulnerabilities, Exploits, and Threats Explained
- Reconnaissance attacks, Tools, Types, and Prevention
- How Reflection and Amplification Attacks work
- How Man-in-the-Middle Attacks work
- How Denial-of-Service Attacks work
- How IP Address Spoofing or Masquerading Works