Active and passive FTP
EPRT and EPSV
Use the extended active and passive commands designed for IPv6 and simpler address handling.
8 minute lesson
EPRT generalizes the active-mode endpoint so it can represent different network protocols, including IPv6.
EPSV returns only a port because the client normally connects to the same server address used by the control connection. A reply can look like 229 Entering Extended Passive Mode (|||6446|).
EPSV avoids parsing an address supplied inside the reply and is the natural passive command for IPv6.
An extended active command names the address family explicitly:
C: EPRT |2|2001:db8::44|50002|
S: 200 EPRT command successful
The delimiter is chosen by the client. 2 means IPv6, followed by the network address and TCP port.
Extended passive mode is simpler:
C: EPSV
S: 229 Entering Extended Passive Mode (|||50003|)
The client connects to port 50003 on the same server address as the control connection. There is no embedded IPv4 address for NAT to rewrite.
A server can reject an unsupported network protocol with 522 and indicate supported families. The client should fall back deliberately, not parse a failed reply as an endpoint.
Write the connection tuple produced by each example and mark who opens the data connection.
Lesson completed