Linux-based Cross-NAT Internet access monitoring principles
Source: Internet
Author: User
There are already a lot of online behavior management software. However, many of them cannot monitor cross-NAT devices because they cannot locate the real source IP address, all traffic is initiated by the NAT device. the existence of the NAT device provides a barrier for the host behind it ....
There are already a lot of online behavior management software. However, many of them cannot monitor cross-NAT devices because they cannot locate the real source IP address, all traffic is initiated by the NAT device, and the existence of the NAT device provides a barrier for the host behind it. Is there any way to precisely locate the real source IP address? There are some solutions, but they only need the cooperation of NAT devices.
1. using the conntrack-tools monitoring event in Linux, NAT is generally implemented by the ip_conntrack mechanism. Linux itself can certainly precisely locate the real address before conversion, all we need to do is pass the information to the online behavior management system. This information can be seen in/proc/net/ip_conntrack. However, we are not concerned with this information, it is a series of events targeting this information. for example, an IP address initiates a connection to a target address at a certain time, and the connection is removed after a certain period of time.
The conntrack-tools tool is a powerful ip_conntrack information operation tool provided by the Netfilter community. it allows you to conveniently manage ip_conntrack information in real time, such as deleting a record and extracting events. The Linux mechanism is implemented in the kernel. The so-called conntrack-tools is only a user-state information operation tool. if you want to monitor ip_conntrack events, you only need to execute conntrack-E for more information about conntrack-tools, see: http://conntrack-tools.netfilter.org/manual.html
2. the following figure shows the overall principle of www.2cto.com: [NEW] tcp 6 120 SYN_SENT src = 128.129.0.3 dst = 9.24.15.123 sport = 4592 dport = 8080 [UNREPLIED] src = 9.24.15.123 dst = 9.24.15.222 sport = 8080 dport = 4592 the meaning of this information is self-evident, literally, NAT must have been used to convert the source address 128.129.0.3 to 9.24.14.222. if this type of information can be passed to the monitoring gateway, you can monitor the real source address, what needs to be done on the monitoring gateway is data sorting. We know that there must be the following information on the monitoring Gateway:
9.24.15.222: 4592 this address has accessed 9.24.15.123: 8080. this data is summarized with the above-mentioned conntrack-E output data, and the address 128.129.0.3: 4592 has accessed 9.24.15.123: 8080.
3. export ip_conntrack information. if the NAT device does not cooperate or is not a Linux system, you need other solutions to obtain the connection information on the NAT device. Therefore, there are two ways to make all these available: one is to provide an interface for exporting connection information for systems familiar with NAT devices and to define a file format or protocol format, develop the information export mechanism by yourself. of course, the NAT device for Linux is as mentioned above; another method is to directly force the use of Linux-based NAT, but this method is a bit rogue, what you must do is that your Linux NAT device is cheap and easy to use...
Note: the conntrack-tools tool is powerful and is generally used in a seamless dual-machine hot standby environment. The Linux host can synchronize the conntrack information of a machine to the corresponding backup machine in real time, once the IP address of the host goes down to the slave server, the traffic passes through the slave server seamlessly, the conntrack information does not need to be re-generated when the traffic passes through the slave server (because the re-generated traffic may have problems with TCP traffic that has established connections) by dog250
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