配置接口IP地址并通过静态路由、默认路由配置实现全网互通
拓扑图如下;按照图上内容配置环境,pc机IP、子网掩码、网关

拓扑.PNG

路由器R1配置如下

<R1>system-view

[Huawei]sysname R1

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 192.168.1.254 24

[R1]interface GigabitEthernet 0/0/1

[R1-GigabitEthernet0/0/1]ip address 192.168.2.1 24

[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2

路由器R2配置如下;

<Huawei>system-view

[Huawei]sysname  R2

[R2]interface GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]ip address 192.168.2.2 24

[R2]interface GigabitEthernet 0/0/1

[R2-GigabitEthernet0/0/1]ip address 192.168.3.1 24

[R2]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1

[R2]ip route-static 192.168.4.0 255.255.255.0 192.168.3.2

路由器R3配置如下;

<Huawei>system-view

[Huawei]sysname  R3

[R3]interface GigabitEthernet 0/0/0

[R3-GigabitEthernet0/0/0]ip address 192.168.3.2 24

[R3]interface GigabitEthernet 0/0/1

[R3-GigabitEthernet0/0/1]ip address 192.168.4.254 24

[R3]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1

配置完成后尝试ping通,

ping.PNG

pc1可以ping通pc2

默认路由配置完成。