CentOS Multiline Routing Configuration

 1 #!/bin/sh
 2 ip route flush table 10
 3 ip route add default via 10.191.0.1 dev em1 src 10.191.0.100 table 10 prio 50
 4 ip rule add from 10.191.0.100 table 10
 5 ip route flush table 20
 6 ip route add default via 10.191.10.1 dev em2 src 10.191.10.100 table 20 prio 50
 7 ip rule add from 10.191.10.100 table 20
 8 
 9 
10 route add -net 10.0.0.0/8 gw 10.191.208.1

Note: The above configuration only needs to set the gateway of 10.191.0.100, other gateways do not need to be set

Put the above script in /etc/sysconfig/static-route.sh and set it to start at /etc/rc.loacl

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324883625&siteId=291194637