一、FTP(文件传输协议)
1、基本概念
(1)FTP采用典型的c/S架构(即服务器端与客户端模型),客户端与服务器端建立TCP连接之后即可实现文件的上传、下载。
(2)针对传输的文件类型不同,FTP可以采用不同的传输模式:
ASCII模式:传输文本文件(TXT、LoG、CrG )时会对文本内容进行编码方式转换,提高传输效率。当传输网络设备的配置文件、日志文件时推荐使用该模式。
Binary (二进制)模式:非文本文件(cc、BlN、EXE、PNG),如图片、可执行程序等,以二进制直接传输原始文件内容。当传输网络设备的版本文件时推荐使用该模式。
2、FTP传输过程
(1)主动模式(PORT)
a.由客户端向服务器端的TCP PORT 21发起TG三次握手,建立控制连接。b.用户登录认证。
c.客户或通过FTP PORT命令。通知服务器自身开放端口号:P(随机端口,大于1024)。
d.由服务器端向客广端的TCP PORT P发起TCP三次提手,建立传输连接,其中服务器端的原端口号为20。
e.开始文件传输
(2)被动模式(PASV)
a.由客户端向股务器端的TCP PORT 21发起TCP三次握手,建立控制连接。
b.用户登录认证。
c.客户端发送PASV命令
d.服务器端通过Enter PASV命令告知客户端自身开放瑞口号:N(随机端口,大于1024)。
e.由客户端向服务器端的TCP PORT N发起TCP三次握手,建立传输连接。
f.开始文件传输
3、配置命令
4、实验
(1)拓扑图
5、配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname Server
[Server]
Jan 3 2022 10:48:31-08:00 Server DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 1, the change loop count is 0, and the maximum number of records is 4095.
[Server]ftp server enable
Info: Succeeded in starting the FTP server.
[Server]aaa
Jan 3 2022 10:51:41-08:00 Server DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 2, the change loop count is 0, and the maximum number of records is 4095.
[Server-aaa]local-user admin password cipher 123456
Jan 3 2022 11:05:32-08:00 Server DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 3, the change loop count is 0, and the maximum number of records is 4095.
[Server-aaa]local-user admin privilege level 3
Jan 3 2022 11:07:42-08:00 Server DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 4, the change loop count is 0, and the maximum number of records is 4095. ^
[Server-aaa]local-user admin service-type ftp
Jan 3 2022 11:08:22-08:00 Server DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 5, the change loop count is 0, and the maximum number of records is 4095.
[Server-aaa]local-user admin ftp-directory flash:
Jan 3 2022 11:09:42-08:00 Server DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 6, the change loop count is 0, and the maximum number of records is 4095.
[Server-aaa]quit
[Server]int g0/0/0
[Server-GigabitEthernet0/0/0]ip ad 192.168.1.1 24
Jan 3 2022 11:10:43-08:00 Server %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Server-GigabitEthernet0/0/0]
[Server-GigabitEthernet0/0/0]
[Server-GigabitEthernet0/0/0]
6、测试
二、TFTP(简单文件传输协议)
1、适用场景
相较于FTP,TFTP的设计就是以传输小文件为目标,协议实现很简单
2、TFTP特性
(1)使用UDP进行传输(端口号69)
(2)无需认证
(3)只能直接向服务器端请求某个文件或者上传某个文件,无法查看服务器端的文件目录。
3、传输步骤
(1)上传:客户端向服务器发送写文件请求,服务器向客户端发送文件写入确认信息。客户端向服务器发送数据,服务器向客户端发送数据文件确认信息。
(2)下载:客户端向服务器发送读取文件请求,服务器向客户端发送读取文件写入确认信息。客户端向服务器发送确认信息。服务器向客户端发送数据文件。客户端向服务器发送确认数据文件信息。
4、使用命令
三、Telnet
1、应用场景
Telnet协议与使用Console接口管理设备不同,无需专用线缆直连设备的Console接口,只要P地址可达、能够和设备的TCP 23端口通信即可。
2、虚拟用户界面
当用户使用Console接口、Telnet等方式登录设备的时候,系统会分配一个用户界面(user-interface)来管理.监控设备与用户间的当前会话,每个用户界面视图可以配置一系列参数用于指定用户的认证方式、登录后的权限级别,当用户登录设备后将会受这些参数限制。Telnet所对应的用户界面类型为vTY (virtual Type Terminal,虚拟类型终端)。
3、配置命令
4、拓扑图
5、配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad 192.168.1.1 24
Jan 3 2022 11:45:02-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
Jan 3 2022 11:45:03-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 1, the change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/0]quit
[Huawei]telnet server enable
Info: The Telnet server has been enabled.
[Huawei]aaa
[Huawei-aaa]local-user admin password cipher 3
Jan 3 2022 11:48:53-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 2, the change loop count is 0, and the maximum number of records is 4095.
[Huawei-aaa]local-user admin privilege level 3
Jan 3 2022 11:53:23-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 3, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-aaa]local-user admin service-type telnet
[Huawei-aaa]quit
Jan 3 2022 11:53:53-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 4, the change loop count is 0, and the maximum number of records is 4095.
[Huawei]
[Huawei]user-interface vty 0 4
[Huawei-ui-vty0-4]authentication-mode aaa
Jan 3 2022 11:54:34-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 5, the change loop count is 0, and the maximum number of records is 4095.
[Huawei-ui-vty0-4]
6、测试结果