85Establishing an FTP connectionBefore you can access the FTP server, you must establish a connection from the FTP client to the FTPserver. You can either use the ftp command to establish the connection directly or use the opencommand 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 aloopback) or source IP address. The primary IP address of the specified source interface or the specifiedsource 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 serveris 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 ftpcommand 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 connectionswhile 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… RemarksEnter system view system-view —Specify the source IP address ofsent FTP packetsftp client source { interfaceinterface-type interface-number |ip source-ip-address }OptionalBy default, the source IP address isdetermined by the route from theFTP client to the FTP server.Return to user view quit —Log in to the remote FTP serverdirectly in user viewftp [ server-address [ service-port ][ vpn-instance vpn-instance-name ][ source { interface interface-typeinterface-number | ipsource-ip-address } ] ]ftpLog in to the remote FTP serverindirectly in FTP client view open server-address [ service-port ]Use either approach.The ftp command is available inuser view, and the open commandis available in FTP client view.NOTE:• If there is not a primary IP address configured on the specified source interface, you cannot establish anFTP connection.• If you use the ftp client source command to configure a source interface and then use it to configure asource IP address, the source IP address overwrites the source interface, and vice versa.Follow these steps to establish an IPv6 FTP connection: