拓扑截图
实验命令
1.配置路由器的IP地址
命令:(以配置R2为例)
<Huawei>system-view --进入视图
[Huawei]sysname R2 --重命名为R2
[R2]interface GigabitEthernet 0/0/0 --进入接口g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.2.1 24 --配置ip
[R2]interface g0/0/1 --进入接口g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.3.1 24 --配置ip
[R2]dis ip interface brief --查看ip配置接口表
R1的IP配置如下图所示:
R2的IP配置如下图所示:
R3的IP配置如下图所示:
R4的IP配置如下图所示:
2.配置pc端IP地址
pc1:
PC2:
3.为各个路由器配置静态路由
以R1为例,除2.0和4.0网段为直连网段 其他的网段都需要配置
命令如下:
R2:
R3:
R4:
由于存在路由环路,所以还需要对R1,R4设置优先级
[R1]ip route-static 192.168.1.0 24 192.168.2.1 pre 50
[R1]ip route-static 192.168.3.0 24 192.168.2.1 pre 50
[R1]ip route-static 192.168.5.0 24 192.168.4.2 pre 50
[R1]ip route-static 192.168.6.0 24 192.168.4.2 pre 50
[R4]ip route-static 192.168.1.0 24 192.168.3.1 pre 50
[R4]ip route-static 192.168.2.0 24 192.168.3.1 pre 50
[R4]ip route-static 192.168.4.0 24 192.168.5.2 pre 50
[R4]ip route-static 192.168.6.0 24 192.168.5.2 pre 50
测试截图