目录
简介:
Telnet是一种应用层协议,使用于互联网及局域网中,使用虚拟终端的形式,提供双向、以文字字符串为主的命令行接口交互功能。属于TCP/IP协议族的其中之一,它通过TCP/IP网络使用端口23来建立连接,是互联网远程登录服务的标准协议和主要方式,常用于服务器的远程控制,可供用户在本地主机执行远程主机上的工作。
知识点:
1>设备的远程管理线路是哪个?
vty线路
2>vty线路和console线路有什么不同?
vty线路可以同时允许多个用户 登录,而console线路只能允许一个用户同时访问
3>远程管理的方式有哪些?
Telnet 协议和SSH协议
4>Telnet和SSH有何不同?
Telnet是明文 协议,所有的数据都以明文的方式发送,不安全
SSH是密文 协议,数据经过加密后再发送,安全性更高
Telnet远程管理
(1)配置接口IP并确保R1和R2处于同一个网段
如何判断R1和R2是否处于同一个网段,通过ping命令来实现
配置命令如下:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname R1
[R1]int GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/1]ip address 192.168.10.1 24
[R1-GigabitEthernet0/0/1]q
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname R2
[R2]int GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.10.2 24
[R2-GigabitEthernet0/0/1]q
(2)使用password认证模式远程登录
在R1上面把password认证模式配置好,即可在R2路由器上面验证登录R1设备
配置命令如下:
[R1]telnet server enable
Error: TELNET server has been enabled
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode password
Please configure the login password (maximum length 16):Xzzzz911
[R1-ui-vty0-4]user privilege level 2
[R1-ui-vty0-4]q
<R2>telnet 192.168.10.1
Press CTRL_] to quit telnet mode
Trying 192.168.10.1 ...
Connected to 192.168.10.1 ...
Login authentication
Password:Xzzzz911
<R1>
(3)使用AAA认证模式远程登录
在R2上面把AAA认证模式配置好,即可在R1路由器上面验证登录R2设备
配置命令如下:
<R2>system-view
Enter system view, return user view with Ctrl+Z.
[R2]user-interface vty 0 4
[R2-ui-vty0-4]authentication-mode aaa
[R2-ui-vty0-4]q
[R2]aaa
[R2-aaa]local-user Xzzzz911 password cipher huawei
Info: Add a new user.
[R2-aaa]local-user Xzzzz911 privilege level 2
[R2-aaa]local-user Xzzzz911 service-type telnet //允许该用户通过Telnet协议远程登录到网络设备
[R2-aaa]q
<R1>telnet 192.168.10.2
Press CTRL_] to quit telnet mode
Trying 192.168.10.2 ...
Connected to 192.168.10.2 ...
Login authentication
Username:Xzzzz911
Password:huawei
<R2>
SSH远程管理
首先跟上面一样,需要配置好接口IP和让R1和R2处于同一网段(可以查看上面的配置命令)
(1)配置SSH
配置命令如下:
[R1]stelnet server enable
Info: Succeeded in starting the STELNET server.
[R1]rsa local-key-pair create
The key name will be: Host
% RSA keys defined for Host already exist.
Confirm to replace them? (y/n)[n]:y
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Input the bits in the modulus[default = 512]:1024
Generating keys...
.......++++++
..............................++++++
.........................++++++++
.....++++++++
[R1]aaa
[R1-aaa]local-user Xzzzz911 password cipher huawei
Info: Add a new user.
[R1-aaa]local-user Xzzzz911 privilege level 2
[R1-aaa]local-user Xzzzz911 service-type ssh
[R1-aaa]q
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]protocol inbound ssh
[R1-ui-vty0-4]q
[R1]ssh user Xzzzz911 authentication-type all
在R1上面配置好SSH远程管理后,进入R2通过SSH验证登录上R1设备
配置命令如下:
[R2]ssh client first-time enable
[R2]stelnet 192.168.10.1
Please input the username:Xzzzz911
Trying 192.168.10.1 ...
Press CTRL+K to abort
Connected to 192.168.10.1 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y
Save the server's public key? (y/n)[n]:y
The server's public key will be saved with the name 192.168.10.1. Please wait...
Enter password:huawei
<R1>
总结:
1、Telnet是明文 协议,所有的数据都以明文的方式发送,不安全
2、SSH是密文 协议,数据经过加密后再发送,安全性更高