Add route table
Find
To modify/etc/iproute2/rt_tables, add content:
252 Tel #电信路由表
251 CNC #网通路由表
2) vi/etc/iproute.sh
#!/bin/sh
IP Route Flush Table Tel
IP route add default via 61.7.69.65 (IP gateway) dev eth0 src 61.7.69.105 (IP address) Table Tel
IP rule Add from 61.7.69.105 (IP address) Table Tel
IP route flush Table CNC
IP route add default via 21.6.167.1 dev eth1 src 21.6.167.51 (IP address) Table CNC
IP rule Add from 21.6.167.51 (IP address) Table CNC
Note: In parentheses is just a hint, the actual operation of the time remember to remove.
3 vi/etc/wtiproute.sh
#把附件路由表里的内容复制进来, but be sure to remember that the gateway behind the GW must be rewritten as a gateway to your network environment.
4) chmod 775/etc/iproute.sh
5) chmod 775/etc/wtiproute.sh
6)/etc/iproute.sh
V
7)/etc/wtiproute.sh
8)) Modify the vi/etc/sysctl.conf file,
Put
#net. ipv4.conf.default.rp_filter=1
#net. ipv4.conf.all.rp_filter=1
Switch
Net.ipv4.conf.default.rp_filter=0
Net.ipv4.conf.all.rp_filter=0
Note: If the previous # to remember to remove, if no previous #, directly modify, save can
9) vi/etc/rc.local
/etc/iproute.sh
/etc/wtiproute.sh
10) Verification
Route
or routing
Traceroute 210.52.223.1
Linux Settings Policy Routing