Network Requirements
- Device1 acts as an FTP server, while PC and Device2 act as FTP clients. The network between the client and the server is normal.
- On the FTP server Device1, the user name is admin1, and the password is admin1. The file system directory of Device1 acts as the root directory of the FTP server.
- PC and Device2 act as the FTP client to upload files to and download files from the FTP server Device1.
Network Topology
![Networking in Which a Device Acts as an FTP Server](/storage/images/Document/Maipu/ftp-tftp-sftp/device-acts-as-ftp-server.jpg)
Figure 4–2 Networking in Which a Device Acts as an FTP Server
Configuration Steps
Step 1: Create VLANs, and add ports to the required VLANs.(Omitted)
Step 2: Configure the IP addresses of the interfaces so that the network between the PC, Device 2, and Device 1 are normal. (Omitted)
Step 3: On Device1, enable the FTP service, and configure the authorized user name and password.
#On Device1, enable the FTP service, and configure the authorized user name and password.
Device1#configure terminal
Device1(config)#local-user admin1 class manager
Device1(config-user-manager-admin1)#service-type ftp
Device1(config-user-manager-admin1)#password 0 admin1
Device1(config-user-manager-admin1)#exit
|
#On Device1, enable the FTP service.
Device1(config)#ftp enable |
#On Device1, set the maximum number of concurrent users to 2.
Device1(config)#ftp max-user-num 2 |
Step 4: Check the result.
#Check whether the FTP service function is enabled on Device1.
Device#show ip sockets
Active Internet connections (including servers)
PCB Proto Recv-Q Send-Q Local Address Foreign Address (state)
-------- ----- ------ ------ ---------------------- ---------------------- -------
27cf8a4 TCP 0 0 0.0.0.0.80 0.0.0.0.0 LISTEN
27ce0a4 TCP 0 0 130.255.104.43.22 130.255.98.2.3590 ESTABLISHED
27d0be4 TCP 0 0 0.0.0.0.21 0.0.0.0.0 LISTEN
27d0824 TCP 0 0 127.0.0.1.2622 127.0.0.1.1026 ESTABLISHED
If the FTP service function has enabled, you can find that port 21 is in the listen state.
Step 5: Use Device2 as an FTP client to copy a startup file from FTP server Device1 to Device2.
Device2#filesystem
Device2(config-fs)#copy ftp 2.0.0.1 admin1 admin1 startup file-system startup
|
Step 6: Use PC as an FTP client to copy a startup file from FTP server Device1 to PC.
#In the following part, the Windows DOS screens are taken as an example to illustrate the process.
#In the Windows DOS screen, input the correct IP address, user name, and password to log in to the FTP server.
D:\>ftp 2.0.0.1
Connected to 2.0.0.1.
220 FTP server ready
User (2.0.0.1:(none)): admin
331 Password required
Password:
230 User logged in
ftp>
|
![Logging in to the FTP Server via the Windows DOS Screen](/storage/images/Document/Maipu/ftp-tftp-sftp/logging-ftp-via-windows-dos-screen.jpg)
Figure 4-3 Logging in to the FTP Server via the Windows DOS Screen
#Configure the PC and FTP server to transmit data in binary mode.
![binary](/storage/images/Document/Maipu/ftp-tftp-sftp/binary.jpg)
Figure 4-4 Configuring the PC and FTP Server to Transmit data in Binary Mode
#Obtain the startup file in the file system of the FTP server Device1.
![get startup](/storage/images/Document/Maipu/ftp-tftp-sftp/get-startup-ftp.jpg)
Figure 4-5 Copying a Configuration File from the FTP Server
After the file copy process is completed, the file is available in the specified Windows directory.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
If the "421 Session limit reached, closing control connection" message is printed, it indicates that the number of connections has exceeds the maximum number allowed by the server.
- When you use a device to copy a file, if the " Ctrl socket connect error(0x3c): Operation timed out" message is printed, the cause may be that the server function is not enabled, or the route between the server and the client is not reachable.
- When you connect the FTP server through the FTP client PC, if the " connect :Unknown error number" is printed, the cause may be that the server function is not enabled, or the route between the server and the client is not reachable.
- As the FTP server, the device is restricted to strict mode. By default, only supporting the passive mode to transmit files. It needs to use security-mode loose to modify the mode to loose mode to support the active mode for transmitting files.