首页 > 代码库 > [linux/net]策略路由实现特定主机特定路径

[linux/net]策略路由实现特定主机特定路径

 
  echo 200 silence >> /etc/iproute2/rt_tables
ip rule add from 10.192.0.230 table silenceip rule add from 10.192.0.231 table silenceip rule add from 10.192.0.232 table silenceip rule add from 10.192.0.233 table silenceip rule add from 10.192.0.234 table silenceip rule add from 10.192.0.235 table silenceip rule add from 10.192.0.236 table silenceip route add default via 117.172.xxx.1 dev eth2 table silenceiptables -t nat -A POSTROUTING -s 10.192.0.230/32 -j SNAT --to-source 117.172.xxx.17iptables -t nat -A POSTROUTING -s 10.192.0.231/32 -j SNAT --to-source 117.172.xxx.17iptables -t nat -A POSTROUTING -s 10.192.0.232/32 -j SNAT --to-source 117.172.xxx.17iptables -t nat -A POSTROUTING -s 10.192.0.233/32 -j SNAT --to-source 117.172.xxx.17iptables -t nat -A POSTROUTING -s 10.192.0.234/32 -j SNAT --to-source 117.172.xxx.17iptables -t nat -A POSTROUTING -s 10.192.0.235/32 -j SNAT --to-source 117.172.xxx.17iptables -t nat -A POSTROUTING -s 10.192.0.236/32 -j SNAT --to-source 117.172.xxx.17