Friday, February 24, 2012

Configuring Cisco Router as a DHCP server

If you want to configure Dynamic Host Configuration Protocol (DHCP) on PC clients, you currently have multiple options to choose for your DHCP server. One of the more common ways to accomplish this is by using a Windows or Linux server. However, most home networks get DHCP from their DSL or cable router.
Many administrators forget or don't even realize that DHCP is also available on Cisco IOS routers and switches. Keep in mind that DHCP is only available on newer IOS-based switches.
Using a router as a DHCP server has its pros and cons.

Pros -
Ø  One benefit of running DHCP on a routers is that it doesn't require any extra hardware (like a Windows server does).
Ø  running DHCP on a router can save your organization the cost of a dedicated DHCP server.
Ø  It also provides DHCP locally at each site regardless of whether the WAN is operational.

Cons -
Ø  Some administrators might not be too comfortable monitoring and troubleshooting DHCP from a router they may prefer to use Windows DHCP Manager rather than Cisco IOS commands  status of client leases, manually terminate a DHCP lease, or assign a static reservation.
Ø  In addition, some administrators might prefer implementing a centralized DHCP server in order to have one place to monitor and troubleshoot DHCP.

1. Define the DHCP address pool

Router(config)#ip dhcp pool POOLNAME
Router(dhcp-config)#network XXX.XXX.XXX.XXX YYY.YYY.YYY.YYY
where, XXX.XXX.XXX.XXX is the network address to be used by the DHCP pool YYY.YYY.YYY.YYY is the subnet mask for the network.
You can replace the subnet mask by a (/PREFIX) to provide the subnet mask.

2. Configure the parameters to be sent to the client

Router(dhcp-config)#dns-server XXX.XXX.XXX.XXX
To provide the DNS server IP address
Router(dhcp-config)#default-router XXX.XXX.XXX.XXX
To provide the IP address of the default gateway
Router(dhcp-config)#domain-name NAME
To provide the name of the domain of the network (if in a domain environment)
Router(dhcp-config)#netbios-name-server XXX.XXX.XXX.XXX
To provide the IP address of the NetBIOS name server
Router(dhcp-config)#lease DAYS HOURS MINUTES/ lease infinite
To define the lease time of the addresses given to the client. You can make it infinite by using this command instead.
There is a large group of settings that you can configure to be sent to the clients, and I have only mentioned the most frequently used.
3. Configure the IP addresses to be excluded from the pool. This is usually done to avoid the conflicts caused by the DHCP with servers and printers. Remember to give ALL servers and network    printers static IP addresses in the same range of the DHCP pool. And then exclude these addresses from the pool to avoid conflicts.

Router(config)#ip dhcp excluded-address XXX.XXX.XXX.XXX
Use the command in the previous form to excluded a single address. You can repeat it as much as you see fit for the IP addresses you want to exclude. Or,
Router(config)#ip dhcp excluded-address YYY.YYY.YYY.YYY ZZZ.ZZZ.ZZZ.ZZZ
where, YYY.YYY.YYY.YYY is the start of the range to be excluded from the pool ZZZ.ZZZ.ZZZ.ZZZ is the end of the range
This way you can exclude a range or ranges of IP addresses and reserve them for static addresses use.

4. Enable the DHCP service in the router

Router(config)#service dhcp
To disable it use
Router(config)#no service dhcp
Usually the DHCP service is enabled by default on your router.
5. Use the following commands to check the DHCP operation on the router:
Router#show ip dhcp binding
This command shows the current bindings of addresses given to clients
Router#show ip dhcp server statistics
This command show the DHCP server statistics.
Router#debug ip dhcp server
This debug command is used to troubleshoot DHCP issues.

6. Configuring statically assigned IP via DHCP

ip dhcp pool STATIC
            host X.X.X.X /24
            hardware-address xxxx.xxxx.xxxx
            host Y.Y.Y.Y /24  
            hardware-address xxxx.xxxx.xxxx

Specials Requirements: DHCP server software is supported for these series; 800, 1000, 1400, 1600, 1700 series (support for the Cisco 1700 series was added in Cisco IOS Release 12.0[2]T), 2500, 2600, 3600, 3800, MC3810, 4000, AS5100, AS5200, AS5300, 7000, 7100, 7200, MGX 8800 with an installed Route Processor Module, 12000, uBR900, uBR7200, Catalyst 5000 family switches with an installed Route Switch Module, Catalyst 6000 family switches with an installed MultiLayer Switch Feature Card, and Catalyst 8500.

No comments:

Post a Comment