------关闭selinux------ vi /etc/sysconfig/selinux SELINUX=disabled -----关闭反向路由检查------ echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter echo 0 > /proc/sys/net/ipv4/conf/网卡1/rp_filter echo 0 > /proc/sys/net/ipv4/conf/网卡2/rp_filter ------定义表名和序号(不可重复2-252)----------- vi /etc/iproute2/rt_tables 252 telecom (电信) 251 unicom (联通) 250 move (移动) -------添加路由规则--------- 线路一 ip route replace default via 网卡1网关 dev 网卡1 --------默认网卡一通信 ip route flush table 上一步对应表名(telecom) ip route add default via 网卡一网关 dev 网卡一 src 网卡一IP地址 table 上一步对应表名(telecom) ip rule add from 网卡一IP地址 table 对应表名(telecom) 线路二 ip route flush table 对应表名(unicom) ip route add default via 网卡二网关 dev 网卡二 src 网卡二IP地址 table 上一步对应表名(unicom) ip rule add from 网卡二IP地址 table 对应表名(unicom) ---------添加开机生效------------ vi /etc/rc.loacl ip route replace default via 192.168.0.1 dev em1 ip route flush table telecom ip route add default via 192.168.0.1 dev em1 src 192.168.0.100 table telecom ip rule add from 192.168.0.100 table telecom ip route flush table unicom ip route add default via 192.168.1.1 dev em2 src 192.168.1.100 table unicom ip rule add from 192.168.1.100 table unicom ----------reboot----------------