Monday, November 3, 2008

DHCP Scope Subinterfaces

How to get DHCP forwarding working with Cisco Router Subinterfaces
Configure subinterfaces on your Cisco Router, and ensure they each have an IP address in their subnet they will operate in.

eg,
FastEthernet 0/1.10
encapsulation dot1Q
ip address 192.168.0.1 255.255.255.0

Now we are using a Windows Server 2008 machine to handle the DHCP scopes and leases, here is what our DHCP looks like.


So we have created a scope, like any other scope, for the 192.168.0.0 range. Now the thing about the leases is, you will only get a lease from a range you are in, so while your pc might be in a 172. range, you will never get a lease from the 192 range, as the router passes its own subinterface ip to the dhcp server and lets it know which subnet its from.

To enable the router to pass the DHCP requests onto the Server you must put this commnd on each of your subinterfaces.

Its called 'ip helper-address " where the is the IP of your DHCP server

so enter the subinterface configuration on the router and enter that command with your DHCP server in place.

So for us, it is

Router(config-subif)# ip helper-address 172.16.99.2

This will enable the subinterface to pass DHCP (and a few other broadcast based protocols, for a full list see here: http://www.ciscopress.com/articles/article.asp?p=330807&seqNum=9 ) through the router to our DHCP server, so that your clients in their VLAN can get valid IP addresses!