Iptables: Some questions!

Source: Internet
Author: User

1. In iptables, The SNAT Source Address can specify an IP segment, but the support for iprange is required.

 

// Change the package whose source address is 192.168.1.1-192.168.1.5 to 192.168.2.2iptables-T Nat-A postrouting-M iprange -- Src-range 192.168.1.1-192.168.1.5-j snat -- to-source 192.168.2.2

If not, you can only modify the source code so that it can identify the specified range symbol and resolve the IP addresses, such as-s 192.168.1.1-192.168.1.5 in itpables. the C xtables_ipparse_any () function is analyzed and parsed. The parameter is just a pointer to struct in_addr, And the pointer is used to obtain multiple analyzed IP addresses, you only need to analyze the range symbol "-" in the function to parse the IP address within a series of distributions referred to by the parameter saddrs (allocated within the function)

2. iptables is executed in the order of rules in the table...

For example, if the SNAT rule contains a masquerade before it is processed by the masquerade, SNAT may not process the subsequent package because the source address is modified by the masquerade rule and does not comply with the SNAT rule !!!

Post:

Iptables source code analysis
Http://bbs.chinaunix.net/thread-663849-1-1.html

Iptables Guide

Http://man.chinaunix.net/network/iptables-tutorial-cn-1.1.19.html#TABLE.SNATTARGET

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.