Problem
You want to configure multiple routers to act as DHCP servers for the same subnet to ensure availability.
Solution
You can configure multiple routers to act as DHCP servers for a single subnet, by ensuring that they don't use the same pool of addresses.
Here's Router1:
Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip dhcp pool 172.22.1.0/24 Router1(dhcp-config)#network 172.22.1.0 255.255.255.0 Router1(dhcp-config)#default-router 172.22.1.1 Router1(dhcp-config)#domain-name oreilly.com Router1(dhcp-config)#dns-server 172.25.1.1 10.1.2.3 Router1(dhcp-config)#exit Router1(config)#ip dhcp excluded-address 172.22.1.1 172.22.1.49 Router1(config)#ip dhcp excluded-address 172.22.1.150 172.22.1.254 Router1(config)#ip dhcp database ftp://dhcp:bindsave@172.25.1.1/dhcp-leases-rtr1 Router1(config)#end Router1#
And here's Router2:
Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config)#ip dhcp pool 172.22.1.0/24 Router2(dhcp-config)#network 172.22.1.0 255.255.255.0 Router2(dhcp-config)#default-router 172.22.1.1 Router2(dhcp-config)#domain-name oreilly.com Router2(dhcp-config)#dns-server 172.25.1.1 10.1.2.3 Router2(dhcp-config)#exit Router2(config)#ip dhcp excluded-address 172.22.1.1 172.22.1.149 Router2(config)#ip dhcp database ftp://dhcp:bindsave@172.25.1.1/dhcp-leases-rtr2 Router2(config)#end Router2#
Discussion
You can configure multiple DHCP servers to service the same subnet; in fact, we recommend it. However, you must take care to ensure that the two servers do not share the same dynamic pool of IP addresses.
In our example, we chose to let Router1 allocate the addresses between 172.25.1.50 and 172.25.1.149, Router2 allocates the pool from 172.25.1.150 to 172.25.1.254, and we reserve the range from 172.25.1.1 to 172.25.1.50 for static IP addresses.
You need to map out the allocated address space ahead of time and use the ip dhcp excluded-address configuration command to ensure that there is no overlap. The most critical thing about this type of configuration is to ensure that the allocated pool of DHCP addresses on a single router is sufficiently large to handle all of the DHCP clients on the segment if the other router fails. This way, although the two routers do not allocate addresses from the same pool, which would cause problems for the DHCP databases, you still have complete redundancy.
We have also configured the routers to store their DHCP binding databases to separate files on the same server. For added protection, you could opt to store the individual database files to different servers.
The rest of the option settings are identical, although they don't necessarily have to be. You might want to change the name server order, for instance, to help balance the load between DNS servers.
See Also
Recipe 20.4; Recipe 20.5
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index