原来用iproute2让包从原路回去那么容易

只要是这个样子就可以了.. 命令已经比较难查了.

# cat /etc/iproute2/rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
200 T3
201 T1
202 T2

# ip rule ls
0:      from all lookup local
32762:  from $ppp_ip lookup T3
32763:  from $eth1_ip lookup T2
32764:  from $eth0_ip lookup T1
32766:  from all lookup main
32767:  from all lookup default

# ip route ls table T1
$eth0_net dev eth0  scope link  src $eth0_ip
default via $eth0_gwip dev eth0
# ip route ls table T2
$eth1_net dev eth1  scope link  src $eth1_ip
default via $eth1_gwip dev eth1
# ip route ls table T3
default via $ppp_gwip dev ppp0

其中$interface_gwip就是那个interface的网关ip, 对于eth*, 就是你的网关, 一般是*.*.*.1, 对于ppp, 就是自己这边的ip, 不是ppp连接的那边的ip. $ethX_net就是 ethX的网段, 一般来说是*.*.*.0/24

Advertisements

4 responses to this post.

  1. 拜大牛。orz。。。

    回复

  2. 赞大大

    回复

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s

%d 博主赞过: