Wednesday, July 24, 2013

Adding VLAN information in Linux

One day I had a need to add a VLAN tag to one of my Linux test PC. Basically I wanted traffic generated by my linux to be tagged with a VLAN. That's where I found some information and the easiest way worked for me was to use 'vconfig' command. Following is the procedure:

Add VLAN ID 5 with follwing command for eth0:
# vconfig add eth0 5
The vconfig add command creates a vlan-device on eth0 which result into eth0.5 interface. You can use normal ifconfig command to see device information:# ifconfig eth0.5Use ifconfig to assign IP address to vlan interfere :
# ifconfig eth0.5 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 upGet detailed information about VLAN interface:
# cat /proc/net/vlan/eth0.5If you wish to delete VLAN interface delete command:
# ifconfig eth0.5 down
# vconfig rem eth0.5

No comments:

Post a Comment