The rp_filter in Linux and rp_filter in Linux are used to implement reverse filtering technology, that is, uRPF. it verifies the flow of reverse packets to avoid disguised IP attacks, however, it is prone to conflicts with the Linux policy routing. The essential reason is that uRPF technology enforces an anti-attack...
The rp_filter in Linux and rp_filter in Linux are used to implement reverse filtering technology, that is, uRPF. it verifies the flow of reverse packets to avoid disguised IP attacks, however, it is prone to conflict with the policy routing of Linux. The essential reason is that uRPF technology enforces the "direction" of a reverse packet, while the actual routing has no direction. There is nothing wrong with the policy route. if there is an error, a routing concept is added to uRPF, which is not considered and never considered. A typical example is as follows.
0. Basic Environment: www.2cto.com intranet Port: eth0 Internet port 1: eth1 Internet Port 2: eth2
1. configure A policy route ip address rule add fwmark 100 iif eth0 table lb1ip rule add fwmark 200 iif eth0 table lb2iptables-t mangle-a prerouting-I eth0-p tcp -- mark 123-j on sport 100 iptables-t mangle-a prerouting-I eth0-p tcp -- sport 456-j on mark 200ip route add default via $ R1 table lb1ip route add default via $ R2 table lb2
2. configure the destination address translation from any client to the intranet server iptables-t nat-a prerouting-p tcp -- dport 123-j DNAT -- to-source $ intranet 123 service iptables-t nat- a prerouting-p tcp -- dport 456-j DNAT -- to-source $ intranet 456 service
3. the above configuration problem is www.2cto.com. if the rp_filter of the corresponding Nic of the Linux host is configured as 1, the above DNAT will not succeed, because the reverse path will be verified after the route, the method is to check the source IP address and target IP address. the exported IP address must be a forward packet Nic. What is the result? The route of the reverse path is in the policy route, and the search condition of the policy route is to enter from the intranet with a mark. for the forward path, during the uRPF check, the reverse lookup element is constructed by simply reversing the source and target addresses. Therefore, the search condition of the policy route is not met, leading to the failure of uRPF. In this case, even if you view the/proc/net/ip_connrack file or use the conntrack tool to view it, no information will be obtained because the packet is in the middle of in-process-out, that is, if the process is discarded, ip_conntrack will not be confirm, so no flow track will be left.
4. one of the solutions. find a way for uRPF to check the policy route; 2. configure the third route for uRPF in the main route table or default (better. since the implementation of virtual route forwarding in Linux is not obvious, what else do you expect?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service