What are Passive mode and Port mode of FTP?
FTP is different from WEB and MAIL and has control channel and data channel. The control channel is to send FTP command and information and data channel is to transmit data. Control channel is set up through TCP of port 21 and the connection is the same as common one. The client starts the connection and the port is definite. The building of data channel has two ways:
1、PORT mode (The server sends connection to client):
Client notices server the connected port with Port command and client monitor at this port. Server sends TCP connection to client. The source port is 20 and destination port is port of Client.
2、Passive mode (Client sends connection to server):
Client sends PASV command and server finds one port from idle ports to respond and monitor connection request at this port. Client sends TCP connection to server.
Monitoring port under two modes is sent through IP package in control channel, including host IP address of monitoring port.
For NAT, it realizes address translation with changing destination address, destination port, source address and source port of IP header.
In order to realize the function of FTP, NAT has to handle header, it has to IP address and port of Port or Passive command packet. Under Passive mode, NAT need change IP in Passive command packet as IP address of public network.