资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

rp_filter导致的网络异常

问题背景如下:

创新互联建站是一家集网站建设,丛台企业网站建设,丛台品牌网站建设,网站定制,丛台网站建设报价,网络营销,网络优化,丛台网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

1,公司内网到某机房公网不通(ping,traceroute,curl都不行)

2,在某机房此公网的机器到公司内网也不通(ping,traceroute,curl都不行)

3,但是某机房此公网哪个的机器可以通过网关通外网,并且外网环境也能访问某机房公网ip,只有公司内网到这些ip不同。 

4,公司内网到其它几个机房的公网都没问题

公司内网到某机房公网不通的traceroute结果:

$ traceroute x.x.x.x
traceroute  to x.x.x.x (x.x.x.x), 30 hops max, 60 byte  packets
 1  * * *
 2  10.x.253.1  (10.x.253.1)  7.092 ms  7.388 ms  7.384 ms
 3   10.x.2.2 (10.x.2.2)  7.372 ms  7.615 ms  8.347  ms
 4  10.x.1.2 (10.x.1.2)  7.595 ms  8.335  ms  8.331 ms
 5  192.x.168.254  (192.x.168.254)  8.879 ms  9.325 ms  10.077  ms
 6  * * *
 ......

30  * * *

公司内网到其它机房公网正常的traceroute结果:

$ traceroute xx.xx.xx.xx
traceroute  toxx.xx.xx.xx (xx.xx.xx.xx), 30 hops max, 60 byte  packets
 1  * * *
 2  10.x.253.1  (10.x.253.1)  7.092 ms  7.388 ms  7.384 ms
 3   10.x.2.2 (10.x.2.2)  7.372 ms  7.615 ms  8.347  ms
 4  10.x.1.2 (10.x.1.2)  7.595 ms  8.335  ms  8.331 ms

 5  * * *

 6  111.111.111.111  (111.111.111.111)  8.879 ms  9.325 ms  10.077  ms
 7  * * *

 8 xx.xx.xx.xx

问题分析解决步骤:(发现这个问题之后,感觉和奇怪,虽然不影响服务,但是好奇心还是驱使着想把问题搞清楚)

一,分析了一下某机房机器的路由,都正常没有发现异常

二,我测试了某机房和其它机房之间的网络,外网到某机房的网络都是正常的。第一个怀疑对象就是觉得公司内网有限制,因为看traceroute结果,数据包还没有出公司内网。所以,就和公司IT部门排查了一番,发现并没有任何限制

三,然后,怀疑公司机房是否有相关限制呢。所以,又找网络组查了一番,结果仍然是没有任何限制

四,排除外部因素之后,就怀疑可能是系统有问题了。并且,通过在某机房的外网机器上抓包能抓到公司内网送达的traceroute包,只是某机房的机器没有回复数据包,那就更确定是系统本身的问题了。通过强大的google发现了rp_filter这个参数导致了这个问题,因为我们某机房机器此参数为1.

rp_filter参数的作用:

rp_filter - INTEGER
	0 - No source validation.
	1 - Strict mode as defined in RFC3704 Strict Reverse Path
	    Each incoming packet is tested against the FIB and if the interface
	    is not the best reverse path the packet check will fail.
	    By default failed packets are discarded.
	2 - Loose mode as defined in RFC3704 Loose Reverse Path
	    Each incoming packet's source address is also tested against the FIB
	    and if the source address is not reachable via any interface
	    the packet check will fail.

	Current recommended practice in RFC3704 is to enable strict mode
	to prevent IP spoofing from DDos attacks. If using asymmetric routing
	or other complicated routing, then loose mode is recommended.

	The max value from conf/{all,interface}/rp_filter is used
	when doing source validation on the {interface}.

	Default value is 0. Note that some distributions enable it
	in startup scripts.

置为1的作用为:数据包从哪个网口进来从哪个网口出去,如果不匹配 丢弃。

结论:

公司内网到某机房机器的request数据包从公网网卡进入,而reply的数据包根据机器的路由规则则从某机房机器的内网网卡流出。而某机房机器rp_filter为1,从而导致数据包被系统丢弃。而rp_filter这个参数默认是0,由于历史原因被调整成了1,我们重新把管理的所有机器都调整为了默认值以解决类似问题。


分享题目:rp_filter导致的网络异常
本文链接:http://cdkjz.cn/article/psdjih.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220