ping 10.4.224.100 -I tunnelX PING 10.4.224.100 (10.4.224.100) from 172.16.172.1 tunnelX: 56(84) bytes of data. ^C --- 10.4.224.100 ping statistics --- 77 packets transmitted, 0 received, 100% packet loss, time 77858ms
查看本地linux的日志可以看到数据包被drop了
Mar 18 09:37:25 gw kernel: IPv4: martian source 10.4.224.100 from 172.16.172.1, on dev tunnelX Mar 18 09:37:25 gw kernel: IPv4: martian source 10.4.224.100 from 172.16.172.1, on dev tunnelX
由于是reverse path 校验嘛, 给它加个路由
ip route add 172.16.0.0/16 dev tunnelX table myRouteTable
于是, 通了
ping 10.4.224.100 -I tunnelX PING 10.4.224.100 (10.4.224.100) from 172.16.172.1 tunnelX: 56(84) bytes of data. 64 bytes from 10.4.224.100: icmp_seq=1 ttl=62 time=2.22 ms 64 bytes from 10.4.224.100: icmp_seq=2 ttl=62 time=37.9 ms
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.