1. Install DHCP Server
sudo apt-get install dhcp3-server
2. Configure DHCP Server
sudo vim /etc/dhcp3/dhcpd.confAdd following:
Add following
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.200;
option routers 192.168.1.254;
}
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.1 192.168.2.200;
option routers 192.168.2.254;
}
3. Add VLAN to ethernet card (VLAN 10 : eth0.10 ; VLAN 11 : eth0.11)
4. Use Ifconfig to set eth0.10, eth0.11 to different network segment
sudo ifconfig eth0.10 192.168.1.1 netmask 255.255.255.0
sudo ifconfig eth0.11 192.168.2.1 netmask 255.255.255.0
5. Enable/ Disable DHCP Server
sudo /etc/init.d/dhcp3-server start
sudo /etc/init.d/dhcp3-server stop
sudo /etc/init.d/dhcp3-server restart
6. Test by DHCP Clients
dhclient eth0.10
dhclient eth0.11