Citation :
How does FTP effect Firewall Rules?
For firewalls, the trouble with FTP starts as the file is transmitted. One would assume that the server will send the file from its port 21 to the remote port from which the client connects, similar to the way web pages are sent by the web server. One would assume wrong. Instead, the FTP server will establish a secondary TCP connection. The server will use its port 20 (ftp-data) to connect to the client. According to the specs, the same data connection should be reused for consecutive transfers. However, clients usually pick new ports at random for each connection. This is a work around to avoid a problem many TCP stacks have in closing ports in a timely fashion. For the firewall, the problem is that data connection appear as incoming connections. "Good" firewalls are set up to reject these connections. Luckily, people that write FTP clients and servers thought about this. The scenario above is usually refered to as "active FTP". The firewall friendly version is usually refered to as "passive FTP". (PASV) In passive mode, the server will open a second port and inform the client of the port number. The client will now establish a second outgoing connection to retreive data from this port. Now, this is not everything there is to know about FTP. There are a couple other "quirks". Many server are using multiple IP addresses. As a result, the data connection may appear to originate from a different IP address than the control connection. (Which means fighting with your firewall again.)
|