拓扑图
PC | ||||
名称 | 接口 | IP地址 | 网关 | 子网掩码 |
PC1 | Ethernet 0/0/1 | 192.168.10.1 | 192.168.10.2 | 255.255.255.252 |
PC2 | Ethernet 0/0/1 | 192.168.20.1 | 192.168.20.2 | 255.255.255.252 |
PC3 | Ethernet 0/0/1 | 192.168.30.1 | 192.168.30.2 | 255.255.255.252 |
路由器 | ||||
名称 | 接口 | IP地址 | 子网掩码 | |
R1 | Ethernet 0/0/0 | 192.168.10.2 | 255.255.255.252 | |
Ethernet 0/0/1 | 192.168.40.1 | 255.255.255.252 | ||
GE 0/0/0 | 192.168.50.1 | 255.255.255.252 | ||
R2 | Ethernet 0/0/0 | 192.168.40.2 | 255.255.255.252 | |
Ethernet 0/0/1 | 192.168.20.2 | 255.255.255.252 | ||
R3 | Ethernet 0/0/0 | 192.168.50.2 | 255.255.255.252 | |
Ethernet 0/0/1 | 192.168.60.1 | 255.255.255.252 | ||
R4 | Ethernet 0/0/0 | 192.168.60.2 | 255.255.255.252 | |
Ethernet 0/0/1 | 192.168.30.2 | 255.255.255.252 |
一、基础配置
给PC配置静态IP
给路由器配置IP
R1
<Huawei>sys //进入系统视图
[Huawei]sys R1 //修改name
[R1]int e0/0/0 //进入接口视图
[R1-Ethernet0/0/0]ip add 192.168.10.2 30 //为接口配置IP
[R1-Ethernet0/0/0]int e0/0/1
[R1-Ethernet0/0/1]ip add 192.168.40.1 30
[R1-Ethernet0/0/1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.50.1 30
R2
<Huawei>sys
[Huawei]sys R2
[R2]int e0/0/0
[R2-Ethernet0/0/0]ip add 192.168.40.2 30
[R2-Ethernet0/0/0]int e0/0/1
[R2-Ethernet0/0/1]ip add 192.168.20.2 30
R3
<Huawei>sys
[Huawei]sys R3
[R3]int e0/0/0
[R3-Ethernet0/0/0]ip add 192.168.50.2 30
[R3-Ethernet0/0/0]int e0/0/1
[R3-Ethernet0/0/1]ip add 192.168.60.1 30
R4
<Huawei>sys
[Huawei]sys R4
[R4]int e0/0/0
[R4-Ethernet0/0/0]ip add 192.168.60.2 30
[R4-Ethernet0/0/0]int e0/0/1
[R4-Ethernet0/0/1]ip add 192.168.30.2 30
测试PC1 ping PC2或PC3 ping不通
二、配置静态路由
R1
配置静态路由 目标 子网 下一跳
[R1]ip route-static 192.168.20.0 30 192.168.40.2
[R1]ip route-static 192.168.30.0 30 192.168.50.2
R2
[R2]ip route-static 192.168.10.0 30 192.168.40.1
[R1]ip route-static 192.168.30.0 30 192.168.40.1
R3
[R3]ip route-static 192.168.30.0 30 192.168.60.2
[R3]ip route-static 192.168.10.0 30 192.168.50.1
[R3]ip route-static 192.168.20.0 30 192.168.50.1
R4
[R4]ip route-static 192.168.10.0 30 192.168.60.1
[R4]ip route-static 192.168.20.0 30 192.168.60.1
测试PC互ping,全通。