Iptables Open FTP Port

Source: Internet
Author: User
Tags ftp protocol

FTP is the file Transfer Protocol ( Files Transfer Protocol ), which has two modes of operation, namely active mode (post ) and passive mode ( Passive )

Active mode: The default TCP port is used to establish a Connection (control connection), port for data transmission

Passive mode: the default TCP port and active mode are used to control the connection, while the data connection is via a port greater than 1023

If FTP works in active mode as long as the 20,21 port is open , but if you are working in passive mode, you cannot specify a port for data transfer, use iptables medium stata(status tracking)

There are four states in state:NEW established related INVALID

NEW: Initiating a TCP connection request Status

Established: After this TCP connection request to the state before the disconnection

Related: a established connection is then raised to a connection, and this connection is called related

INVALID: Unrecognized connection or invalid connection

Open Passive Mode configuration:

1, we can create a ftp-data Connection in the ftp-control connection through related , if you want to use related to ensure that iptables loads the modules supported by the FTP protocol

# vi/etc/sysconfig/iptables-configiptables_midules= "Ip_nat_ftp ip_conntrack_ftp" #加载ip_nat_ftp和ip_conntrack_ftp模块

2,iptables-a input-m State--state related,established-j ACCEPT # Open Request message Related,estab lished Status

# iptables-a input-d 172.16.100.7-p TCP--dport 21-m State--state new-j ACCEPT #开放21端口 # iptables-a Output-s 172.1 6.100.7-m State--state Established-j ACCEPT #开放响应报文的ESTABLISHED状态


Iptables Open FTP Port

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.