Ospf 单区域 RID和DR的选举
一、拓扑
 

OSPF的RID和DR/BDR的选举_RID

R2
show run
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
memory-size iomem 5
no ip routing
!
!
no ip cef
no ip domain lookup
frame-relay switching
interface Serial0/0
 no ip address
 encapsulation frame-relay
 no ip route-cache
 serial restart-delay 0
 clock rate 64000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 301 interface Serial0/2 103
!
interface Serial0/1
 no ip address
 encapsulation frame-relay
 no ip route-cache
 serial restart-delay 0
 clock rate 64000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 201 interface Serial0/2 102
!
interface Serial0/2
 no ip address
 encapsulation frame-relay
 no ip route-cache
 serial restart-delay 0
 clock rate 64000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 102 interface Serial0/1 201
 frame-relay route 103 interface Serial0/0 301
!
!
R3
 
show run
hostname R3
interface Serial0/0
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/2
 ip address 172.16.3.3 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 172.16.3.5 103 broadcast
 frame-relay lmi-type cisco
!
 R4
 
show run
hostname R4
interface Serial0/1
 ip address 172.16.3.4 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 172.16.3.3 201 broadcast
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface Ethernet1/0
 ip address 172.16.4.4 255.255.255.0
 half-duplex
!
 
R5
!
hostname R5
interface Serial0/0
 ip address 172.16.3.5 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 172.16.3.3 301
!
!
interface Ethernet1/0
 ip address 172.16.4.5 255.255.255.0
 half-duplex
RID的选择
1、RID在没有手工指定的情况下,路由器会选择LOOPBACK地址中最大的那个,没有LOOPBACK时,会选择活动接口中最高的IP做为RID。
2、出于稳定性考虑RID不会被抢占,除非OSPF进程被重启或RID接口不是活动。
DR和BDR的选举
1、 为了避免路由器之间建立完全邻接关系而引起的大量开销,OSPF要选举DR和BDR,每个路由器都与DR建立邻接关系。选举DR的同时选举BDR,DR失效时由BDR担负DR的职责。其它路由器只与DR和BDR建立邻接关系。
2、 DR和BDR有它们自己的组播地址224.0.0.6。
3、 DR和BDR的选举是以各个网络为基础的,也就是说DR和BDR的选举是路由器的接口特性,而不是整个路由器的特性。
LAN接口需要DR,因为默认OSPF网络类型为广播,OSPF使用多播HELLO消息动态的发现邻居,允许一个子网中有两台以上的路由器。在点到时点链路和点到点WAN子接口默认使用点到点的网络类型,子网中只有两台路由器,可使用HELLO动态发现邻居,而不选DR.
 

接口类型
使用DR/BDR吗?
默认HELLO间隔
动态发现邻居吗
子网可否有两台以上路由器
广播
10
点到点
10
环回
 
 
非广播(NBMA)
30
点到多点
30
点到多点非广播
30

DR和BDR的选举原则
1、 最先启动的路由器被选举为DR。
2、 如果同时启动或重新选举,则接口优先级高的成为DR(0-255),默认为1,点到点网络接口优先级为0,表示不参与DR的选举,命令为(ip ospf priority)
3、 如优先级相同,看路由器ID,路由器高的成为DR.
     Ospf 单区域 RID和DR的选举
一、拓扑
R2
show run
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
memory-size iomem 5
no ip routing
!
!
no ip cef
no ip domain lookup
frame-relay switching
interface Serial0/0
 no ip address
 encapsulation frame-relay
 no ip route-cache
 serial restart-delay 0
 clock rate 64000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 301 interface Serial0/2 103
!
interface Serial0/1
 no ip address
 encapsulation frame-relay
 no ip route-cache
 serial restart-delay 0
 clock rate 64000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 201 interface Serial0/2 102
!
interface Serial0/2
 no ip address
 encapsulation frame-relay
 no ip route-cache
 serial restart-delay 0
 clock rate 64000
 frame-relay lmi-type cisco
 frame-relay intf-type dce
 frame-relay route 102 interface Serial0/1 201
 frame-relay route 103 interface Serial0/0 301
!
!
R3
 
show run
hostname R3
interface Serial0/0
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/2
 ip address 172.16.3.3 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 172.16.3.5 103 broadcast
 frame-relay lmi-type cisco
!
 R4
 
show run
hostname R4
interface Serial0/1
 ip address 172.16.3.4 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 172.16.3.3 201 broadcast
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface Ethernet1/0
 ip address 172.16.4.4 255.255.255.0
 half-duplex
!
 
R5
!
hostname R5
interface Serial0/0
 ip address 172.16.3.5 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 172.16.3.3 301
!
!
interface Ethernet1/0
 ip address 172.16.4.5 255.255.255.0
 half-duplex
RID的选择
1、RID在没有手工指定的情况下,路由器会选择LOOPBACK地址中最大的那个,没有LOOPBACK时,会选择活动接口中最高的IP做为RID。
2、出于稳定性考虑RID不会被抢占,除非OSPF进程被重启或RID接口不是活动。
DR和BDR的选举
1、 为了避免路由器之间建立完全邻接关系而引起的大量开销,OSPF要选举DR和BDR,每个路由器都与DR建立邻接关系。选举DR的同时选举BDR,DR失效时由BDR担负DR的职责。其它路由器只与DR和BDR建立邻接关系。
2、 DR和BDR有它们自己的组播地址224.0.0.6。
3、 DR和BDR的选举是以各个网络为基础的,也就是说DR和BDR的选举是路由器的接口特性,而不是整个路由器的特性。
LAN接口需要DR,因为默认OSPF网络类型为广播,OSPF使用多播HELLO消息动态的发现邻居,允许一个子网中有两台以上的路由器。在点到时点链路和点到点WAN子接口默认使用点到点的网络类型,子网中只有两台路由器,可使用HELLO动态发现邻居,而不选DR.
 

接口类型
使用DR/BDR吗?
默认HELLO间隔
动态发现邻居吗
子网可否有两台以上路由器
广播
10
点到点
10
环回
 
 
非广播(NBMA)
30
点到多点
30
点到多点非广播
30

DR和BDR的选举原则
1、 最先启动的路由器被选举为DR。
2、 如果同时启动或重新选举,则接口优先级高的成为DR(0-255),默认为1,点到点网络接口优先级为0,表示不参与DR的选举,命令为(ip ospf priority)
3、 如优先级相同,看路由器ID,路由器ID高的成为DR.
4、 DR选举是非抢占的,除非重新选举,方法是路由器重启或执行(clear ip ospf process)。
ID
4、 DR选举是非抢占的,除非重新选举,方法是路由器重启或执行(clear ip ospf process)。