85
Establishing an FTP connection
Before you can access the FTP server, you must establish a connection from the FTP client to the FTP
server. You can either use the
ftp
command to establish the connection directly or use the
open
command in FTP client view to establish the connection.
When using the
ftp
or
ftp client source
command, you can specify the source interface (such as a
loopback) or source IP address. The primary IP address of the specified source interface or the specified
source IP address is used as the source IP address of sent FTP packets.
The FTP client follows these rules to select the source IP address of packets sent to the FTP server:
•
If no source IP address is specified, the IP address of the output interface of the route to the server
is used as the source IP address.
•
The source IP address specified with the
ftp client source
or
ftp
command is used.
•
If you first use the
ftp client source
command to specify a source IP address and then use the
ftp
command to specify another source IP address, the latter is used.
•
The source IP address specified with the
ftp client source
command applies to all FTP connections
while the one specified with the
ftp
command applies to the current FTP connection only.
Follow these steps to establish an IPv4 FTP connection:
To do…
Use the command…
Remarks
Enter system view
system-view
—
Specify the source IP address of
sent FTP packets
ftp client source
{
interface
interface-type interface-number
|
ip
source-ip-address
}
Optional
By default, the source IP address is
determined by the route from the
FTP client to the FTP server.
Return to user view
quit
—
Log in to the remote FTP server
directly in user view
ftp
[
server-address
[
service-port
]
[
vpn-instance
vpn-instance-name
]
[
source
{
interface
interface-type
interface-number
|
ip
source-ip-address
} ] ]
ftp
Log in to the remote FTP server
indirectly in FTP client view
open
server-address
[
service-port
]
Use either approach.
The
ftp
command is available in
user view, and the
open
command
is available in FTP client view.
NOTE:
•
If there is not a primary IP address configured on the specified source interface, you cannot establish an
FTP connection.
•
If you use the
ftp client source
command to configure a source interface and then use it to configure a
source IP address, the source IP address overwrites the source interface, and vice versa.
Follow these steps to establish an IPv6 FTP connection: