Dport and sport in iptables

Source: Internet
Author: User

Dport and sport in iptables first translate dport and sport meaning: dport: Destination Port sport: Source Port beginner iptables is easy to confuse, but I try to explain it to you in plain language. Dport and sport are literally easy to understand. One is the destination port for data arrival and the other is the port for data source. However, when using the data package, you need to consider the specific situation. This is the flow behavior of your data packets. (INPUT or OUTPUT) for example:/sbin/iptables-a input-p tcp -- dport 80-j ACCEPT. Pay attention to the INPUT parameter, this indicates the "go" Operation of your data packet! This data packet can be described as follows: 1. This is a data entry from the external to the internal local server. 2. The destination (dport) Address of the data packet is 80, which means to access port 80 on my local device. 3. Allow the above data to pass. Sum: allow external data to access port 80 of my local server. Let's look at the first 2nd columns:/sbin/iptables-a input-p tcp -- sport 80-j ACCEPT 1. This is A data entry from the external to the internal local server. 2. The source port of the data packet is sport 80, that is, the packet sent from the other party is port 80. 3. Allow the above data behavior. Summary: allow external data from port 80 to access my local server. Input mode Summary: dport refers to local and sport refers to external. If your data packet is an (OUTPUT) behavior, it is another way of understanding:/sbin/iptables-a output-p tcp -- dport 80-j ACCEPT 1. this is a piece of internal data. 2. The destination (dport) port is 80. 3. Allow the above data behavior. Output behavior Summary: dport is external only, and sport is local.
 

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.