Multiple VLAN DHCP in 10 Minutes

Multiple VLAN DHCP in 10 Minutes

Defining Some Terms

VLAN: Virtual Local Area Network. I've discussed VLANs extensively before. They are a way to keep traffic separated on different networks. In order for a host on one VLAN to communicate with hosts in another VLAN (and thus another network), there needs to be a router (or a layer-3 capable switch) configured to route traffic between networks. Without a router, hosts in different VLANs will be unable to communicate.

DHCP: Dynamic Host Configuration Protocol. There are several options available through DHCP, but for this exercise, we will focus on DHCP's ability to assign IP addresses in what are called DHCP leases. The opposite of a DHCP-configured IP address is a static address. As the name implies, a static IP address does not change; it is manually configured and will be updated only when an administrator decides. This stands in contrast to DHCP in that the DHCP lease will eventually expire, and the IP address will be returned to the pool of available addresses. It may be assigned to a different host in the future.

With that difference between DHCP and static IP addressing in mind, it should be easy to understand the reason for assigning servers static addresses. When end-users access the resources on the servers, they need to know which IP address to use when connecting to those servers. It would not be ideal to have a server's address change when the DHCP lease expires.

DORA: Discover, Offer, Request, Acknowledge. This is the process devices go through when first attaching to a network. A DHCP host joining a network will send out a discovery message, essentially asking if there is a DHCP server configured on the network. The DHCP server will respond with an offer. Offers are so named because the DHCP server is offering its services to the end device. Once an offer is received by the end host, the host will send a request for any of the configured options available from the DHCP server. The DHCP server, in turn, sends an acknowledgment along with the appropriate configuration options.

Let's Get Down to It

We know that there is separation between networks when implementing VLANs. We also know it is possible to set up a DHCP server to assign IP addresses within a single network. But what if there are multiple subnets (and thus multiple networks)? Is it possible to configure ONE SINGLE DHCP server to assign IP addressing for multiple networks? The short answer is yes. It's pretty straightforward, too.


What You'll Need

- A VLAN-aware switch

- A VLAN-aware router

- A DHCP server

- At least 2 VLANs

- Some hosts in both VLANs


Configuration Overview

I like to start with the router. Configure subinterfaces, one for each VLAN. Ensure you are using modern encapsulation methods (dot1q encapsulation). Assign IP addresses as the default gateways for each of the VLANs. Inform each subinterface of the "helper-address." Enable the interface.

Move to the switch. Enable VLANs and assign interfaces to the appropriate VLAN. Enable a trunk link to the router and allow the appropriate VLANs to traverse the trunk link.

On the DHCP server, set up the server pools. Set the default gateways and the scope of the DHCP address pools. Configure the server's static IP address. Enable the DHCP services.

Enjoy.