Chinaunix

标题: 双线主机的UDP包路由走向 [打印本页]

作者: dbsrv    时间: 2013-02-26 17:42
标题: 双线主机的UDP包路由走向
SRV,两个ISP提供的IP地址,分别接在e0和e1上,ip_addr_0和ip_addr_1
eth0添加网关到主路由表
eth1的网关在另一个新建路由表222里,/iproute2/rt_tables都添加完毕了。
并且增加了相关的策略:ip rule add from IP1 table 222

测试发现,从外部主机分别用icmp和TCP连接该SRV,都是哪个IP收到了请求,就从对应的接口回应数据包给客户端,另一个接口无任何相关数据。

但是UDP有问题:
从eth0收到的数据包,会从eth0回应
16:58:22.043184 IP $remote_host_ip.33359 > $ip_addr_0.5000: UDP, length 1
16:58:22.043304 IP $ip_addr_0.5000 > $remote_host_ip.33359: UDP, length 14

16:58:24.404193 IP $remote_host_ip.33359 > $ip_addr_0.5000: UDP, length 1
16:58:24.404306 IP $ip_addr_0.5000 > $remote_host_ip.33359: UDP, length 14

16:58:25.304915 IP $remote_host_ip.33359 > $ip_addr_0.5000: UDP, length 1
16:58:25.304976 IP $ip_addr_0.5000 > $remote_host_ip.33359: UDP, length 14



从eth1收到的UDP包,仍然从eth0回应
ip_0收到的消息,无回应消息
16:37:52.746933 IP $remote_host_ip.56222 > $ip_addr_0.5000: UDP, length 16
16:37:55.747791 IP $remote_host_ip.56222 > $ip_addr_0.5000: UDP, length 16
16:37:58.756971 IP $remote_host_ip.56222 > $ip_addr_0.5000: UDP, length 16

回应包从另一个接口出去的
16:37:52.747069 IP $ip_addr_1.5000 > $remote_host_ip.56222: UDP, length 33
16:37:55.747929 IP $ip_addr_1.5000 > $remote_host_ip.56222: UDP, length 33
16:37:58.757110 IP $ip_addr_1.5000 > $remote_host_ip.56222: UDP, length 33

这样导致客户端的udp应用连接失败。

这是什么原因造成的?能解决么?
作者: dbsrv    时间: 2013-02-28 13:59
喵了个咪的,这不是回应收到的消息,是本来就是服务端发起的消息,UDP非面向连接,没法去读策略路由表




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2