eth0 eth1 两块网卡
网卡配置文件
cat ifcfg-eth0
BOOTPROTO=none
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPADDR=10.205.11.26
NETMASK=255.255.255.0
cat ifcfg-eth1
BOOTPROTO=none
DEVICE=eth1
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPADDR=10.205.11.27
NETMASK=255.255.255.0
添加路由表
cat /etc/iproute2/rt_tables
26 t26
27 t27
指定路由表添加路由
ip route add default dev eth0 via 10.205.11.1 table t26
ip route add default dev eth1 via 10.205.11.1 table t27
添加策略路由规则
ip rule add from 10.205.11.26 table t26
ip rule add from 10.205.11.27 table t27
测试1
外部服务器可以ping 通 eth0 eth1 上的ip