Linux划分VLAN

可用直接写入启动文件中:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
vim /etc/rc.local

touch /var/lock/subsys/local
route add default gw 10.0.103.254
modprobe 8021q
vconfig add eth1 3999
vconfig add eth1 4005
vconfig add eth1 4002
vconfig add eth1 4017
vconfig add eth1 4018
vconfig add eth1 4019
vconfig add eth1 4020
ifconfig eth1.3999 10.0.103.160 netmask 255.255.252.0 up
ifconfig eth1.4005 10.0.7.205 netmask 255.255.252.0 up
ifconfig eth1.4002 10.0.15.205 netmask 255.255.252.0 up
ifconfig eth1.4017 10.0.39.205 netmask 255.255.252.0 up
ifconfig eth1.4018 10.0.43.205 netmask 255.255.252.0 up
ifconfig eth1.4019 10.0.55.205 netmask 255.255.252.0 up
ifconfig eth1.4020 10.0.59.205 netmask 255.255.252.0 up