SSH远程连接

SSH认证配置

SSH:安全的远程控制协议,端口 TCP 22 号端口
特点:传输的数据时加密的,Linux服务器也很常用

在这里插入图片描述

R1——设置IP地址,测试是否可以跟本机ping通
<Huawei>system-view     //进入全局配置模式
[Huawei]undo info-center enable     //关闭信息告警提示
[Huawei]sysname R1     //改名
[R1]interface g0/0/0     //进入接口
[R1-GigabitEthernet0/0/0]ip address 192.168.199.200 24     //设置IP地址    
[R1-GigabitEthernet0/0/0]quit     //退出
[R1]ping 192.168.199.223     //测试是否可以ping通
  PING 192.168.199.223: 56  data bytes, press CTRL_C to break
    Reply from 192.168.199.223: bytes=56 Sequence=1 ttl=64 time=20 ms
    Reply from 192.168.199.223: bytes=56 Sequence=2 ttl=64 time=20 ms
    Reply from 192.168.199.223: bytes=56 Sequence=3 ttl=64 time=10 ms
    Reply from 192.168.199.223: bytes=56 Sequence=4 ttl=64 time=10 ms
    Reply from 192.168.199.223: bytes=56 Sequence=5 ttl=64 time=10 ms     //ping通

  --- 192.168.199.223 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/14/20 ms

[R1]
R1——设置AAA认证模式
[R1]aaa     //进入AAA认证模式
[R1-aaa]local-user admin password cipher admin@123     //设置用户名和密码
[R1-aaa]local-user admin privilege level 3     //设置用户权限登记
[R1-aaa]local-user admin service-type ssh     //设置用户登录方式
[R1-aaa]quit     //退出
[R1]
R1——配置虚拟用户,使用SSH登录
[R1]user-interface vty 0 4     //配置虚拟用户
[R1-ui-vty0-4]authentication-mode aaa     //设置用户认证模式为AAA认证
[R1-ui-vty0-4]protocol inbound ssh     //设置登录用户接入模式为SSH   
[R1-ui-vty0-4]quit     //退出
[R1]
R1——开启SSH服务
[R1]stelnet server enable     //开启SSH服务
使用SecureCRT连接路由器

在这里插入图片描述
在这里插入图片描述

路由器当SHH客户端登录路由器

在这里插入图片描述

R2——设置接口的IP地址
<Huawei>system-view     //进入全局配置模式
[Huawei]undo info-center enable     //关闭信息告警提示 
[Huawei]sysname R2     //改名
[R2]interface g0/0/0     //进入接口
[R2-GigabitEthernet0/0/0]ip address 192.168.199.201 24     //设置IP地址
[R2-GigabitEthernet0/0/0]quit     //退出
[R2]
R2——使用SSH远程登录R1设备
[R2]ssh client first-time enable     //SHH客户端首次启用(首次登陆)
[R2]stelnet 192.168.199.200     //SHH连接R1设备
Please input the username:admin     //输入用户名
Trying 192.168.199.200 ...
Press CTRL+K to abort
Connected to 192.168.199.200 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y     //输入y
Save the server's public key? (y/n)[n]:y     //输入y
The server's public key will be saved with the name 192.168.199.200. Please wait
...

Enter password:          //输入密码
  ----------------------------------------------------------------------------- 
    
  User last login information:     
  -----------------------------------------------------------------------------
  Access Type: SSH      
  IP-Address : 192.168.199.223 ssh     
  Time       : 2020-05-15 15:54:02-08:00     
  -----------------------------------------------------------------------------
<R1>     //成功登录R1设备

猜你喜欢

转载自blog.csdn.net/Yang__Qi/article/details/106146135