1、项目拓扑图
2、具体配置
2.1PC1配置
2.2PC2配置
2.3AR1配置
基础配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR1 //更改设备名称为AR1
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 192.168.10.254 24 //配置接口g0/0/1的IP地址为192.168.10.254 24
Oct 20 2022 23:02:14-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[AR1-GigabitEthernet0/0/1]dis this //查询当前命令下的配置
[V200R003C00]
#
interface GigabitEthernet0/0/1
ip address 192.168.10.254 255.255.255.0
#
return
[AR1]ip route-static 192.168.20.0 255.255.255.0 192.168.12.2
//设置静态路由,前面192.168.20.0 255.255.255.0是指你要到达的目标网络地址,后面的192.168.12.2是指你的下一跳地址
[AR1]dis this
[V200R003C00]
#
ip route-static 192.168.20.0 255.255.255.0 192.168.12.2
#
return
[AR1]
[AR1-GigabitEthernet0/0/0]ip address 192.168.12.1 24 //配置接口g0/0/0的IP地址为192.168.12.1 24
Oct 20 2022 23:03:39-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[AR1-GigabitEthernet0/0/0]dis this //查询当前命令下的配置
[V200R003C00]
#
interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0
#
return
配置ssh服务
[AR1]user-interface vty 0 4 //进入vty视图
[AR1-ui-vty0-4]authentication-mode aaa //指定验证模式为aaa
[AR1-ui-vty0-4]protocol inbound ssh //绑定服务为ssh
[AR1-ui-vty0-4]quit
[AR1]aaa
[AR1-aaa]local-user cookie password cipher cookie@37 privilege level 15 //创建用户,分配权限
Info: Add a new user.
[AR1-aaa]local-user cookie service-type ssh //绑定用户服务类型ssh
[AR1-aaa]quit
[AR1]stelnet server enable //开启stelnet服务
Info: Succeeded in starting the STELNET server.
[AR1]ssh client first-time enable //开启ssh服务
[AR1]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]:512
//如果RSA密钥已经存在,则系统将提示用户确认是否替换原有密钥。
执行此命令后,会提示您输入主机密钥的位数。服务器密钥对的位数与主机密钥对的位数至少相差128位。
服务器密钥对和主机密钥对的最小长度为512位,最大长度为2048位,缺省长度为2048位。
小于1024位的RSA密钥对不够安全,不推荐使用。//
Generating keys...
................++++++++++++
..............++++++++++++
.....++++++++
............................++++++++
2.4AR2配置
基础配置
<Huawei>system-view //进入系统视图界面
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR2
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]ip address 192.168.20.254 24
Oct 20 2022 23:08:28-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[AR2-GigabitEthernet0/0/1]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/1
ip address 192.168.20.254 255.255.255.0
#
return
[AR2-GigabitEthernet0/0/1]
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]ip address 192.168.12.2 24
Oct 20 2022 23:10:17-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[AR2-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ip address 192.168.12.2 255.255.255.0
#
return
[AR2]ip route-static 192.168.10.0 255.255.255.0 192.168.12.1
[AR2]dis this
[V200R003C00]
#
ip route-static 192.168.10.0 255.255.255.0 192.168.12.1
#
return
[AR2]
AR2后续操作参照AR1配置ssh服务