OSPF(开放式最短路径优先):是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由。是对链路状态路由协议的一种实现,隶属内部网关协议(IGP),故运作于自治系统内部。OSPF是链路状态协议。
网络拓扑图:
实验过程:
R1配置如下:
R1>enable
R1#configure terminalR1(config)#no ip domain-lookupR1(config)#hostname R1R1(config)#int f0/0R1(config-if)#no shutdownR1(config-if)#ip address 68.1.1.2 255.255.255.0R1(config-if)#exitR1(config)#int loopback 0 R1(config-if)#ip address 7.7.7.7 255.255.255.0R1(config-if)#exitR1(config)#route ospf 1 #启用ospf协议R1(config-router)#network 7.7.7.7 area 0R1(config-router)#network 68.1.1.2 area 0R1(config-router)#endR1#write
R2配置如下:
R2>enable
R2#configure terminalR2(config)#no ip domain-lookupR2(config)#hostname R2R2(config)#int f0/0R2(config-if)#no shutdownR2(config-if)#ip address 68.1.1.3 255.255.255.0R2(config)#int f0/1R2(config-if)#no shutdownR2(config-if)#ip address 86.1.1.4 255.255.255.0R2(config-if)#exitR2(config)#int loopback 0R2(config-if)#ip address 8.8.8.8 255.255.255.0R2(config-if)#exitR2(config)#route ospf 1R2(config-router)#network 8.8.8.8 area 0 R2(config-router)#network 68.1.1.3 area 0R2(config-router)#network 86.1.1.4 area 0R2(config-router)#endR2#write
配置R3如下:
R3>enable
R3#configure terminalR3(config)#no ip domain-lookupR3(config)#hostname R3R3(config)#int f0/0R3(config-if)#no shutdownR3(config-if)#ip address 86.1.1.5 255.255.255.0R3(config-if)#exitR3(config)#int loopback 0R3(config-if)#ip address 9.9.9.9 255.255.255.0R3(config-if)#exitR3(config)#route ospf 1R3(config-router)#network 9.9.9.9 area 0 R3(config-router)#network 86.1.1.5 area 0R3(config-router)#endR3#write