system-view //进系统视图
[Huawei]sysname AR-1 //修改主机名为AR-1
[AR-1]int g0/0/0 //进g0/0/0接口
[AR-1-GigabitEthernet0/0/0]ip address 192.168.1.1 24 //配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/0]int g0/0/1 //从g0/0/0切换到g0/0//1
[AR-1-GigabitEthernet0/0/1]ip address 192.168.2.1 24 //配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/1]q //从接口视图退到系统视图
[AR-1]dis ip int bri //查看IP地址和子网掩码
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/24 up up 重点要看这里
GigabitEthernet0/0/1 192.168.2.1/24 up up 重点要看这里
NULL0 unassigned up up(s)
===============================================================================================
system-view //进系统视图
[Huawei]sysname AR-2 //修改主机名为AR-2
[AR-2]int g0/0/0 //进g0/0/0接口
[AR-2-GigabitEthernet0/0/0]ip address 192.168.2.2 24 //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/0]int g0/0/1 //从g0/0/0切换到g0/0/1
[AR-2-GigabitEthernet0/0/1]ip address 192.168.3.2 24 //配置IP地址和子网掩码
[AR-2-GigabitEthernet0/0/1]q //从接口视图退到系统视图
[AR-2]dis ip int brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.2.2/24 up up 重点要看这里
GigabitEthernet0/0/1 192.168.3.2/24 up up 重点要看这里
NULL0 unassigned up up(s)
================================================================================================
system-view //进系统视图
[Huawei]sysname AR-3 //修改主机名
[AR-3]int g0/0/0 //进g0/0/0接口
[AR-3-GigabitEthernet0/0/0]ip address 192.168.4.1 24 //配置IP地址和子网掩码
[AR-3-GigabitEthernet0/0/0]int g0/0/1 //从g0/0/0切换到g0/0/1接口
[AR-3-GigabitEthernet0/0/1]ip address 192.168.3.1 24 //配置IP地址和子网掩码
[AR-3-GigabitEthernet0/0/1]q //从接口视图退到系统视图
[AR-3]dis ip int brief //查看IP地址和子网掩码
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.4.1/24 up up 重点要看这里
GigabitEthernet0/0/1 192.168.3.1/24 up up 重点要看这里
NULL0 unassigned up up(s)
================================================================================================
在AR1和AR3上配置默认路由: 0.0.0.0 0.0.0
在AR2上配置静态路由: x.x.x.x 24 x.x.x.x
在AR-1设备上配置如下命令:
[AR-1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2 默认路由
在AR-3设备上配置如下命令:
[AR-3]ip route-static 0.0.0.0 0.0.0.0 192.168.3.2 默认路由
在AR-2设备上配置如下命令:
[AR-2]ip route-static 192.168.1.0 24 192.168.2.1 静态路由
[AR-2]ip route-static 192.168.4.0 24 192.168.3.1 静态路由
==============================================================
在pc1上ping pc2的IP地址
PC>ping 192.168.4.2 通的
Ping 192.168.4.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
From 192.168.4.2: bytes=32 seq=4 ttl=125 time=78 ms
From 192.168.4.2: bytes=32 seq=5 ttl=125 time=78 ms