Tuesday, 16 October 2012

How to configure Linux DHCP server for multiple VLAN?

Recently i was working on VLAN and DHCP.

  The setup was something like this :

              PC1------------VLAN Switch1 -----------VLAN Switch 2---------------DHCP Server

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

The DHCP server was supposed to server both the VLAN.

DHCP Server is Linux PC.

How to do this?

1) VLAN S/W 1 will be connected to VLAN S/W 2 "trunk Port".

2) DHCP Server should be connected to VLAN S/W 2 "trunk port".

3) All trunk port should expect tagged traffic

4) PC1 and PC2 will send untagged traffic to VLAN  S/W 1 , the switch will tag with respective vlan id and send to switch 2.

5) The DHCP Server should support both VLAN otherwise it will drop the packets. The DHCP Server should be configured for both VLAN.

Command to enable multiple VLAN on Linux:

                  ifconfig eth0 
                  vconfig add eth0 100
                  ifconfig add eth0.100 netmask

                  vconfig add eth0 200
                  ifconfig add eth0.200 netmask
Command to enable DHCP

           Vim /etc/dhcp/dhcpd.conf

 Add both subnets

subnet netmask {
option routers;
option broadcast-address;

subnet netmask {

option routers;
option broadcast-address;


Run dhcp server :

           dhcpd &

6) Now make PC1 and PC2 as DHCP client

  Both should be able to get IP address from DHCP server in their respective VLAN.


1 comment:

  1. Please don't use, it's not private!



Related Posts Plugin for WordPress, Blogger...