Download report.pdf, and count how many TCP connections it really takes.
- control socket
- 51120 → 21
- who dials the data
- the client
- data socket
- —
- port from 227
- —
- file bytes on :21
- 0
- file bytes on :50000
- —
- credentials
- —
- next transfer
- —
open for the whole session
outbound twice — nat is happy
a second, separate connection
two decimals, one port
never, in any mode
the entire transfer
USER / PASS as typed
the dance repeats every time
Nothing is connected yet. Which well-known FTP port does the client connect to first?
Fetch one file and count the connections. The command channel and the file itself do not travel together, and the port the file uses is negotiated on the fly.
“FTP is port 21.” Port 21 carries the conversation and not one byte of any file. Every transfer — every directory listing too — opens a second, separate TCP connection on a port nobody knew in advance.
That second connection is why FTP fights firewalls. In active mode the server dials the client — an unsolicited inbound connection, which is commonly what NAT and stateful firewalls block unless an FTP helper or explicit rule permits it. Passive mode makes the client originate both connections.
And it is all cleartext: USER and PASS travel exactly as typed, like the port-80 run in the HTTPS lab. SFTP and FTPS exist for this reason.
Download report.pdf, and count how many TCP connections it really takes.
- How many TCP connections does downloading one file take?
- In passive mode, who opens the data connection?
Read it now and keep it in mind — the answer is in what you are about to watch.