前言
telnet协议由于在传输过程中采用TCP明文传输,缺少安全的认证方式,容易收到Dos、IP地址欺骗等恶意攻击,存在较大安全隐患。
因此,在生产环境中,我们一般建议部署SSH,实现远程登录。
平台
eNSP V1.3.00.200T
步骤
搭建拓扑
按如图方式搭建拓扑,并启动路由。
将R1端口IP 配置为 10.1.1.1/24,R2端口IP 配置为 10.1.1.2/24。
配置完成后再R1中,ping R2地址,观察联通性是否正常。
配置SSH
下面开始正式配置
##开启SSH服务
[R2]stelnet server enable
Info: Succeeded in starting the STELNET server.
##进入AAA模式用于创建用户名和密码
[R2]aaa
[R2-aaa]local-user test password cipher abc123 //配置用户名密码
Info: Add a new user.
[R2-aaa]local-user test privilege level 3 //创建用户级别为3级
[R2-aaa]local-user test service-type ssh //设置该用户用于SSH登录
[R2]ssh user test authentication-type password //SSH用户test通过密码进行认证
Authentication type setted, and will be in effect next time
##创建RSA的key
[R2]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]:768
Generating keys...
...............................++++++++
.++++++++
...............................................................................+
++++++++
....................+++++++++
##配置VTY通道
[R2]user-interface vty 0 4
[R2-ui-vty0-4]authentication-mode aaa //在VTY通道模式中选择AAA模式
[R2-ui-vty0-4]protocol inbound ssh //VTY中允许SSH登录
[R2-ui-vty0-4]quit
##下面开始在R1上配置
[R2]ssh client first-time enable //第一次登录需要在客户端开启ssh client
验证SSH登录
在R1上登录。
[R1]stelnet 10.1.1.2
Please input the username:test
Trying 10.1.1.2 ...
Press CTRL+K to abort
Connected to 10.1.1.2 ...
Enter password:
-----------------------------------------------------------------------------
User last login information:
-----------------------------------------------------------------------------
Access Type: SSH
IP-Address : 10.1.1.1 ssh
Time : 2023-11-25 13:26:21-08:00
-----------------------------------------------------------------------------
发现已经可以正常登录,配置结束。
结语
目前模拟器在模拟登录时存在bug,如果有条件尽量在本地环境下进行模拟登录。