实验拓扑及需求
实验步骤
A、配置相关地址及连通性测试
R1:
[R1]int GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.12.1 24
R2:
[R2]int gi 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2]int gi 0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.23.2 24
R3:
[R3]int gi 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.23.3 24
测试连通性:
此时,在R2上ping R1和R3的接口地址都能ping通
B、R2配置telnet
R2:
[R2]telnet server enable (使能telnet,默认开启的)
[R2]user-interface vty 0 4 (vty线程下开启telnet,默认开启的)
[R2-ui-vty0-4]protocol inbound telnet
[R2-ui-vty0-4]authentication-mode password
Please configure the login password (maximum length 16):huawei
(配置验证方式为password,密码为huawei)
[R2-ui-vty0-4]user privilege level 3
(设置用户权限为3,默认是0,无法进入配置模式)
此时在R1上telnetR2:
除了上述配置方法外,还有一种配置方式,以R1为例:
[R1]aaa
[R1-aaa]local-user huawei password cipher gcna
(创建aaa账户huawei,密码是gcna)
[R1-aaa]local-user huawei service-type telnet
(开启账户huawei的telnet服务 )
[R1-aaa]local-user huawei privilege level 3
(设置用户权限为3)
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
(设置验证方式为aaa)
此时在R2上telnetR1:
C、R2配置ssh
R2:
[R2]aaa
[R2-aaa]local-user test password cipher hcia
(创建本地账户test,密码为hcia)
[R2-aaa]local-user test privilege level 3
(设置test账户权限为3,也可以在vty线程下针对所有账号开启)
[R2-aaa]local-user test service-type ssh
(设置test账户的ssh服务)
[R2]stelnet server enable
(开启stelnet服务)
[R2]user-interface vty 0 4
[R2-ui-vty0-4]authentication-mode aaa (验证方式为aaa)
[R2-ui-vty0-4]protocol inbound ssh (开启ssh服务)
[R2]ssh user test authentication-type password(默认使用密码验证)
此时去R3上sshR2:
所以还需要去R3上使能SSH客户端首次认证功能:
[R3]ssh client first-time enable
此时再去R3上测试:
除了使用密码验证外,还可以使用密钥(rsa/dsa)认证,以R2新建一个用户名test1为例:
[R2]aaa
[R2-aaa]local-user test1 service-type ssh(开启test1的ssh功能)
[R2-aaa]local-user test1 privilege level 3 (设置登陆权限为3)
[R2]ssh user test1 authentication-type rsa
(设置test1账户验证方式为rsa,此时去R3上是ssh不了R2的)
此时需要去R3(客户端)上创建本地rsa密钥对:
创建完成后查看rsa密钥:display rsa local-key-pair public
接下来需要将R3上的rsa公钥配置到R2(服务器端)上:
[R2]rsa peer-public-key rsa001 (配置rsa钥匙名称为rsa001)
[R2-rsa-public-key]public-key-code begin
(进入到code里面,并且将R3上的rsa公钥copy到code里面)
[R2-rsa-key-code]public-key-code end (退出code)
[R2-rsa-public-key]peer-public-key end (退出key)
此时,在R2上可以查看rsa密钥:display rsa peer-public-key:
[R2]ssh user test1 assign rsa-key rsa001
(给test1账户绑定密钥rsa001)
此时去R3上测试:
此上就是关于华为设备的远程登陆管理配置。