DHCP can also be set for routing and switching. So how to set it? Sometimes, some medium and high-end network equipment routers and switches have already integrated the DHCP service, so we can implement the DHCP service on the network equipment without using a dedicated host as the DHCP server, to save costs.
The following is an instance for configuring DHCP on a cisco router.
1. Specify the range of IP addresses that are not automatically allocated
- Ip dhcp excluded-address 10.1.1.1 10.1.1.19 // the ip address from 10.1.1.1 to 10.1.1.19 is manually assigned.
2. Set the DHCP address pool
- Ip dhcp pool global // This command specifies the name of the DHCP address pool
- Network 10.1.0.0 255.255.0.0 // dynamically assigned IP address range, except for the non-automatically assigned IP addresses specified before all IP addresses in the 10.1.0.0 segment)
3. Set DHCP Additional information
- Domain-name client.com//configure the domain suffix for the customer's machine
- Dns-server 10.1.1.1 10.1.1.2 // configure the DNS server address for the client, which is 10.1.1.1 and 10.1.1.2
- Netbios-name-server 10.1.1.5 10.1.1.6 // configure the WINS server address for the client, which is 10.1.1.5 and 10.1.1.6
- Netbios-node-type h-node // configure the node mode for the client to affect the name interpretation. For example, h-node is explained by the wins server first)
- Default-router 10.1.0.100 10.1.0.101 // configure the default gateway for the client
4. Set the lease term
- Lease 8 // set the lease time to 8 days
5. Sometimes we need to set the DHCP server sub-address pool. For example, we want the client gateway of 10.1.1.0/24 to be 10.1.1.100. We set it as follows:
- Ip dhcp pool subglobal
- Network 10.1.1.0 255.255.255.0 // The Sub-address pool of global, which inherits domain name and other options from global
- Default-router 10.1.1.100 10.1.1.101 // configure the default gateway for the client
6. Related DHCP Debugging commands
- No service dhcp // stop the DHCP service
- Show ip dhcp binding // display Address Allocation
- Show ip dhcp conflict // displays ip address conflicts.