配置R1和R2路由器(路由器使用R2220),R1路由器配置端口g0/0/1地址为192.168.1.1/30,端口g0/0/1连接R2路由器。配置端口g0/0/2地址为192.168.2.1/24,作为内部PC1机网关地址。R2路由器配置端口g0/0/1地址为192.168.1.2/30,端口g0/0/1连接R1路由器,配置端口g0/0/2地址为192.168.3.1/24,作为内部PC2机网关地址。R1和R2路由器启用OSPF动态路由协议自动学习路由。使PC1和PC2可以相互访问。
R1:
<Huawei>sys
[Huawei]undo in en
[Huawei]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.1.1 30
[Huawei-GigabitEthernet0/0/1]int g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 192.168.2.1 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.3
[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
R2:
[Huawei]undo in en
[Huawei]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.1.2 30
[Huawei-GigabitEthernet0/0/1]int g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 192.168.3.1 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.3
[Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
PC1:
PC2:
PC1 ping 一下 PC2: