Labs / Speaking Protocols / Time & office: NTP, files, FTP & PTP

Lab 3 of 4 ยท Time & office: NTP, files, FTP & PTP

FTP: two channels, active and passive

Move files over FTP: active, passive, and why only passive mode crosses NAT.

Open this lab Pro 6 steps

The idea

FTP active vs passive: FTP talks on one connection and moves files on another, and NAT decides which mode works. officeLaptop reaches fileServer through officeRouter; homeLaptop reaches it from a house, behind homeRouter.

Commands on one connection, the file on another
Commands on one connection, the file on another
Who opens the data connection
Who opens the data connection

Steps

  1. The control channel

    Before any file moves, client and server must agree who you are and what you want. FTP, the File Transfer Protocol, takes those commands on Port 21, as lines of text. Log in to fileServer as alice by typing the commands yourself, each answered with a three-digit code.

    officeLaptop:~# nc fileServer.lab 21
  2. A file needs a second connection

    Commands keep flowing while a file moves, so the file never comes down port 21. The server names a port; curl opens a second connection to it. fileServer records who opens each connection, by its first packet, the SYN.

    officeLaptop:~# curl -sv --disable-epsv ftp://alice:s3cret@fileServer.lab/report.txt

Pro

4 more steps in the app

  1. The server connects back
  2. Behind NAT, active mode breaks
  3. Behind NAT, passive mode works
  4. Listings and uploads too
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab