Recently i was working on VLAN and DHCP.
The setup was something like this :
PC1------------VLAN Switch1 -----------VLAN Switch 2---------------DHCP Server
|
|
PC2
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 0.0.0.0
vconfig add eth0 100
ifconfig add eth0.100 10.1.1.1 netmask 255.0.0.0
vconfig add eth0 200
ifconfig add eth0.200 20.1.1.1 netmask 255.0.0.0
Command to enable DHCP
Vim /etc/dhcp/dhcpd.conf
Add both subnets
subnet 10.1.1.0 netmask 255.0.0.0 {
range 10.1.1.10 10.1.1.20;
option routers 10.1.1.1;
option broadcast-address 10.1.1.255;
}
subnet 20.1.1.0 netmask 255.0.0.0 {
range 20.1.1.10 10.1.1.20;
option routers 20.1.1.1;
option broadcast-address 20.1.1.255;
}
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.
The setup was something like this :
PC1------------VLAN Switch1 -----------VLAN Switch 2---------------DHCP Server
|
|
PC2
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 0.0.0.0
vconfig add eth0 100
ifconfig add eth0.100 10.1.1.1 netmask 255.0.0.0
vconfig add eth0 200
ifconfig add eth0.200 20.1.1.1 netmask 255.0.0.0
Command to enable DHCP
Vim /etc/dhcp/dhcpd.conf
Add both subnets
subnet 10.1.1.0 netmask 255.0.0.0 {
range 10.1.1.10 10.1.1.20;
option routers 10.1.1.1;
option broadcast-address 10.1.1.255;
}
subnet 20.1.1.0 netmask 255.0.0.0 {
range 20.1.1.10 10.1.1.20;
option routers 20.1.1.1;
option broadcast-address 20.1.1.255;
}
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.