How to Configure DHCP for Multiple VLANs?

Almost every device connected to the Internet needs an IP address. Previously, the countless IP addresses are assigned manually, which costs a lot of time and energy. As DHCP emerges, IT specialists are not required any longer to spend countless hours providing IPs for every device connected to the network device. But what is DHCP? How does it work and how to configure DHCP for multiple VLANs?

What Is DHCP?

DHCP – Dynamic Host Configuration Protocol is a network management protocol used on TCP/IP network. There may be at least a DHCP server and many DHCP clients. The DHCP server allows the client to request the IP addresses and other network configurations from the Internet service provider. This process eliminates the need for administrators or users to assign IP address to network devices one by one. Using this protocol, the network administrators will just set up the DHCP server with all the additional network information, and it will do its work dynamically. Both network switch and router can be configured as a DHCP server.

How Does the DHCP Process Look Like?

For the DHCP client that hasn’t accessed the Internet before, it will undergo 4 phases to connect the DHCP server.

dhcp process

Fig 1. DHCP process

1.Discover

DHCP client after being activated will first send a broadcast message to try to look for DHCP servers. In this way, the client request IP address from the DHCP server.

2.Offer

When the DHCP server gets the message from the client, it looks in its pool to find an IP address it can lease out to the client. It then adds the MAC address information of the client and the IP address it will lease out to the ARP table. When this is done, the server sends this information to the client as a DHCPOFFER message.

3.Selection

DHCP client chooses IP address. There may be several DHCP servers sending DHCP-Offer packet, the client only receives the first DHCP-Offer then sends back DHCP-Request packet in broadcast mode to all DHCP servers to request more information on the IP address lease time and verification. The packet includes the contents of the IP address requested from the selected DHCP server.

4.Acknowledge

When the DHCP server receives a DHCP-Request packet from the DHCP client, it confirms the lease and creates a new ARP mapping with the IP address it assigned to the client and the client’s MAC address. And then send this message as a unicast to the client as a DHCPACK.

How to Configure DHCP for Multiple VLANs?

The theory cannot be well digested unless it is combined with the practice. In this section, how to configure DHCP for multiple VLANs is introduced for your reference. Take the following picture as an example.

DHCP configuration

Fig 2. DHCP Configuration for Multiple VLANs

PC1 and PC2 are connected to access port of VLAN switch 1 with VLAN ID 100 and 200.

The DHCP server was supposed to serve both the VLANs.

Command to enable multiple VLANs.

DHCP configuration 1

Command to enable DHCP.

DHCP configuration 2

Add both subnets.

DHCP configuration 3

Run DHCP server.

DHCP configuration 4

Now make PC1 and PC2 as DHCP client. Both should be able to get IP address from DHCP server in their respective VLAN.

Conclusion

How to configure DHCP for multiple VLANs? This issue has been illustrated in the above content. DHCP configuration is worthy of being learned by those who are engaged in fiber optic communication field. You just need to know “How”, and let FS provide you with the best network devices. Ethernet switch like gigabit Ethernet switch and 10gbe switch, and routers are available in FS.