Analysis of dport and sport and iptablesdport in iptables

Source: Internet
Author: User

Analysis of dport and sport and iptablesdport in iptables

First, let's talk about the concepts of dport and sport:

Dport -------- destination port

Sport -------- Source Port

It is important to note that it is related to the flow behavior of our data packets, that is, the INPUT or OUTPUT.


For example, iptables-a input-p tcp -- dport 80-j ACCEPT here is the INPUT parameter, so this indicates that our data packet is in the operation, then the dport address here is 80, that is, to access port 80 on my local device. This packet can be described as follows:

(1) This is a data entry from the external to the internal local server.

(2) the destination address of the data packet is 80, which is to access the local port 80.

(3) Allow the above data to pass


For example, iptables-a output-p tcp -- dport 80-j ACEPT indicates the OUTPUT parameter. Therefore, this indicates that the outbound operation is performed for this data packet. This data packet can be described as follows:

(1) This is a piece of internal data.

(2) the destination port is 80.

(3) Allow the above data behavior.



Input behavior Summary: dport refers to local and sport refers to external.

Output behavior Summary: dport refers to external, sport refers to 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.