ubuntu三层交换机配置ip rule, ip route

apt-get install vlan

vi /etc/route

ip rule flush
ip rule add from all table main pref 1
ip rule add from all table default pref 32767
ip rule add from 10.96.81.201 table vps242 pref 1000
ip rule add from 10.96.82.243 table vps242 pref 1000

ip route replace default via 10.96.80.241 table vps241
ip route replace default via 10.96.80.242 table vps242
ip route replace default via 10.96.80.254 table vps254
ip route replace default via 10.96.80.241 table default

vi /etc/network/interfaces

auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 10.96.80.251
netmask 255.255.255.0

auto vlan81
iface vlan81 inet static
address 10.96.81.251
netmask 255.255.255.0
vlan-raw_device eth1

auto vlan82
iface vlan82 inet static
address 10.96.82.251
netmask 255.255.255.0
vlan-raw_device eth1

auto vlan83
iface vlan83 inet static
address 10.96.83.251
netmask 255.255.255.0
vlan-raw_device eth1
飞儿传媒www.firadio.com
原文地址:https://www.cnblogs.com/firadio/p/3610403.html