我们先把每个pc、路由器端口的ip配置好
然后在配置静态路由
在配置静态路由的时候,我们先配去程路由
在路由器R1 的命令行输入ip route-static 192.168.6.0 30 192.168.2.2
再去路由器R2 的命令行输入
ip route-static 192.168.1.0 30 192.168.2.1
配置回程路由
配置这两条静态路由后,pc3可以和pc2互通
下面步骤一样,先配置去程路由,在配置回程路由
下面是路由器配置
R1
The device is running!
<Huawei>sys //进入视图
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en //可以取消弹窗
Info: Information center is disabled.
[Huawei]int g0/0/0 //配置IP
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.2.1 30
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 192.168.3.1 30
[Huawei-GigabitEthernet0/0/2]q
[Huawei]ip rou
[Huawei]ip route-
[Huawei]ip route-static 192.168.6.0 30 192.168.2.2 //配置到pc2的去程路由
[Huawei]ip rou
[Huawei]ip route-
[Huawei]ip route-static 192.168.5.0 30 192.168.3.2 //配置pc1的去程路由
R2
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.2.2 30
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.6.2 30
[Huawei-GigabitEthernet0/0/0]q
[Huawei]ip ro
[Huawei]ip route-
[Huawei]ip rou-
[Huawei]ip rou-
[Huawei]ip rou
[Huawei]ip route-
[Huawei]ip route-static 192.168.1.0 30 192.168.2.1
R3
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 192.168.3.2 30
[Huawei-GigabitEthernet0/0/2]int g0/0/3
[Huawei-GigabitEthernet0/0/3]ip add 192.168.4.1 30
[Huawei-GigabitEthernet0/0/3]q
[Huawei]ip rou
[Huawei]ip route-
[Huawei]ip route-static 192.168.5.0 30 192.168.4.2 //去程路由
[Huawei]ip rou
[Huawei]ip route-
[Huawei]ip route-static 192.168.1.0 30 192.168.3.1 //回程路由
[Huawei]
R4
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]ip add 192.168.4.2 30
[Huawei-GigabitEthernet0/0/3]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.5.2 30
[Huawei-GigabitEthernet0/0/0]q
[Huawei]ip
[Huawei]ip rou
[Huawei]ip route-
[Huawei]ip route-static 192.168.1.0 30 192.168.4.1 //回程路由
[Huawei]
配置完成后,pc3可以跟pc1/2互通
使用命令可以查看路由表信息
display ip routing-table