OSPF(Open Shortest Path First开放式最短路径优先)是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由,且适用于绝大多数规模的网络。本文将介绍如何在华为路由器上配置基本的OSPF协议实现网络互通。拓扑结构如下:
具体配置:
R1:
interface GigabitEthernet0/0/0
ip address 192.168.30.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.10.1 255.255.255.0
quit
ospf 1 router-id 1.1.1.1
area 0.0.0.0 //area0是骨干区域
network 192.168.10.0 0.0.0.255 //这里的掩码与ACL一致,是通配符掩码
network 192.168.30.0 0.0.0.255
R2:
interface GigabitEthernet0/0/0
ip address 192.168.20.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.10.2 255.255.255.0
quit
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.10.0 0.0.0.255
network 192.168.20.0 0.0.0.255
R3:
interface GigabitEthernet0/0/0
ip address 192.168.30.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.20.2 255.255.255.0
quit
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 192.168.20.0 0.0.0.255
network 192.168.30.0 0.0.0.255