OSPF 引入了区域的概念 , 区域分 2 种 : OSPF 的邻接关系的建立是依赖于 hello 包的 • 当选举DR/BDR
的时候要比较hello
包中的优先级(priority),
优先级最高的为DR,
次高的为BDR.
默认优先级都为1.
在优先级相同的情况下就比较RID,RID
等级最高的为DR,
次高的为BDR.
当你把优先级设置为0
以后,OSPF
路由器就不能成为DR/BDR,
只能成为DROTHER
• DR/BDR
选举完成后,DRother
只和DR/BDR
形成邻接关系.
所有的路由器将组播Hello
包到地址224.0.0.5
以便它们能跟踪其他邻居的信息,
即DR
将洪泛LSU
到224.0.0.5;DRother
只组播LSU
到AllDRouter
地址224.0.0.6,
只有DR/BDR
监听这个地址 • 2.
当网络发生变化的时候发送触发式更新(triggered update)
Router(config)#router ospf process-id Router(config-router)#network address wild card bits area area-id R1
的ip
地址为192.168.6.2 (E1/0) 192.168.7.1 (S0/0)
网络掩码为255.255.255.0
R2
的ip
地址为 192.168.7.2 (S0/0) 192.168.8.1
(S0/1
) 网络掩码为255.255.255.0
R3
的ip
地址为192.168.8.2 (S0/1) 192.168.9.1(E1/0)
网络掩码为255.255.255.0
PC1
的ip
地址为192.168.6.1
网络掩码为 255.255.255.0
PC2
的ip
地址为192.168.9.2
网络掩码为 255.255.255.0
通过在路由器间配置单区域的OSPF
协议,使PC1
和PC2
之间相互ping
通。即实现全网全通。 Enter configuration commands, one per line. End with CNTL/Z.
r1(config-if)#ip addr 192.168.6.2 255.255.255.0 r1(config-if)#ip addr 192.168.7.1 255.255.255.0 r1(config-if)#clock rate 64000 r1(config)#router ospf 100 r1(config-router)#network 192.168.6.2 0.0.0.0 area 0 r1(config-router)#network 192.168.7.1 0.0.0.0 area 0 Enter configuration commands, one per line. End with CNTL/Z.
r2(config-if)#ip addr 192.168.7.2 255.255.255.0 r2(config-if)#ip addr 192.168.8.1 255.255.255.0 r2(config-if)#clock rate 64000 r2(config)#router ospf 100 r2(config-router)#network 192.168.7.2 0.0.0.0 area 0 r2(config-router)#network 192.168.8.1 0.0.0.0 area 0 Enter configuration commands, one per line. End with CNTL/Z.
r3(config-if)#ip addr 192.168.8.2 255.255.255.0 r3(config-if)#ip addr 192.168.9.1 255.255.255.0 r3(config)#router ospf 100 r3(config-router)#network 192.168.8.2 0.0.0.0 area 0 r3(config-router)#network 192.168.9.1 0.0.0.0 area 0 VPCS 1 >ip 192.168.6.1 192.168.6.2 PC1 : 192.168.6.1 255.255.255.0 gateway 192.168.6.2
VPCS 2 >ip 192.168.9.2 192.168.9.1 PC2 : 192.168.9.2 255.255.255.0 gateway 192.168.9.1
如下是PC1
和 PC2
相互ping
的结果,结果表明,全网全通 192.168.6.1 icmp_seq=1 timeout
192.168.6.1 icmp_seq=2 time=157.000 ms
192.168.6.1 icmp_seq=3 time=297.000 ms
192.168.6.1 icmp_seq=4 time=172.000 ms
192.168.6.1 icmp_seq=5 time=172.000 ms
192.168.9.2 icmp_seq=1 time =157.000 ms
192.168.9.2 icmp_seq=2 time=157.000 ms
192.168.9.2 icmp_seq=3 time=297.000 ms
192.168.9.2 icmp_seq=4 time=172.000 ms
192.168.9.2 icmp_seq=5 time=172.000 ms
下面是分别在R1 R2 R3
上show ip route
查看的路由协议,结果表明路由器间是通过OSPF
协议实现全网全通的。 Routing Protocol is "ospf 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
192.168.6.2 0.0.0.0 area 0
192.168.7.1 0.0.0.0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)
Routing Protocol is "ospf 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
192.168.7.2 0.0.0.0 area 0
192.168.8.1 0.0.0.0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)
Routing Protocol is "ospf 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
192.168.8.2 0.0.0.0 area 0
192.168.9.1 0.0.0.0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)
Router#show ip ospf interface Router#show ip ospf neighbor