Install the userspace tool
sudo apt-get install vlan
load the module
sudo modprobe 8021q
Create the vlan interface
sudo vconfig add eth0 10
Assign an IP address if required
sudo ifconfig eth0.10 10.1.1.1 netmask 255.255.255.0
or sudo ip address 10.1.1.1/24 dev eth0.10 label eth0.10
The label keyword is necessary for the interface to show up in ifconfig
add the module 8021q to load at boot time
nano /etc/modules
Make IP configuration permanent
nano /etc/network/interfaces and add
auto eth0.10
iface eth0.10 inet static
address 10.1.1.1
netmask 255.255.255.0
network 10.1.1.0
broadcast 10.1.1.255
gateway 10.1.1.254
vlan-raw-device eth0 (ignored if raw device specified in interface name as above)
To bring up interface without IP address
auto eth0.10
iface eth0.10 inet manual
up ifconfig eth0.10 up
Comments
Post a Comment