1、安装vlan软件包
sudo apt-get install vlan
2、加载8021q模块
sudo modprobe 8021q
sudo sh -c 'grep -q 8021q /etc/modules || echo 8021q >> /etc/modules'
3、配置vlan子接口
sudo cat /etc/network/interfaces
auto em1.12
iface em1.12 inet static
address 120.52.139.9
netmask 255.255.255.240
gateway 120.52.139.1
auto em1.13
iface em1.13 inet static
address 123.58.236.26
netmask 255.255.255.248
auto em1.16
iface em1.16 inet static
address 223.71.150.91
netmask 255.255.255.248
4、激活vlan子接口
sudo ifup em1 12
sudo ifup em1.13
sudo ifup em1.16
5、重启网络服务
/etc/init.d/networking restarat
原文链接:https://www.f2er.com/ubuntu/351993.html