Sunday, June 24, 2012

Redundant DHCP

Adventures in Networking - DHCP - Part 2:  Redundancy

In my last post, I described the simplest DHCP functionality.  Your computers can grab an IP from a DHCP server and boom, you're done.  What if you're an availability kind of guy and the idea of having a single point of failure for IP acquisition rustles your jimmies?  Have no fear, redundancy is totally a possibility.

Let's review what the server does during a DHCP request.
  1. Hear a DHCP discover.
  2. Reserve an available IP from a DHCP pool, recording the MAC of the requester.
  3. Offer the IP.
  4. Acknowledge that the IP was accepted.
Note in step 2 that the DHCP server records the DHCP binding; it associates an IP with a MAC address in its DHCP binding table.  In a redundant setup you wouldn't want two servers having mismatched bindings.  It would be really bad if Server A handed out 10.0.0.5 and then have Server B hand out the same IP to a different machine.  So to fix this issue, split the work.  Each server gets half of the original DHCP pool.

In my examples, I will use Cisco IOS's built-in DHCP running on a router or layer 3 switch.  I will post examples for dhcpd and Windows AD on another day.

Simple Setup - Single DHCP Server

This DHCP server will hand out IPs for the 10.0.0.0/24 network. It will use Google for DNS (8.8.8.8). We exclude the range 10.0.0.1 - 10.0.0.10 for our network equipment.

Router 1

Router(config)# ip dhcp excluded-addresses 10.0.0.1 10.0.0.10
Router(config)# ip dhcp pool david
Router(dhcp-config)# network 10.0.0.0 255.255.255.0
Router(dhcp-config)# domain-name example.davidisbad.com
Router(dhcp-config)# dns-server 8.8.8.8
Router(dhcp-config)# default-router 10.0.0.1

Redundancy Setup - Two DHCP Servers

Router 1 serves 10.0.0.11 - 10.0.0.127.
Router 2 serves 10.0.0.128 - 10.0.0.254.

Router 1

Router1(config)# ip dhcp excluded-addresses 10.0.0.1 10.0.0.10
Router1(config)# ip dhcp excluded-addresses 10.0.0.128 10.0.0.255
Router1(config)# ip dhcp pool david
Router1(dhcp-config)# network 10.0.0.0 255.255.255.0
Router1(dhcp-config)# domain-name example.davidisbad.com
Router1(dhcp-config)# dns-server 8.8.8.8
Router1(dhcp-config)# default-router 10.0.0.1

Router 2

Router2(config)# ip dhcp excluded-addresses 10.0.0.1 10.0.0.127
Router2(config)# ip dhcp pool david
Router2(dhcp-config)# network 10.0.0.0 255.255.255.0
Router2(dhcp-config)# domain-name example.davidisbad.com
Router2(dhcp-config)# dns-server 8.8.8.8
Router2(dhcp-config)# default-router 10.0.0.1

No comments:

Post a Comment