HCNA-34 OSPF的DR与BDR
HCNA-34 OSPF的DR与BDR标注:DR/Designated Router 指定路由;BDR/BackupDesignated Router 备份指定路由;NBMA/Non-Broadcast MultipleAccess 非广播多路访问;邻接关系公式n*(n-1)/2;OSPF链路分为3种:1、广播(broadcast)2、NBMA 3、点到点(point-to-point)再扩展出5种类型:1、广播 2、NBMA 3、点到点4、点到多点(point-to-multipoint) 5、虚链路 <Huawei>system-viewsysnamer1interfaceloopback 0//创建环回口 0ipaddress 1.1.1.1 32interfaceGigabitEthernet 0/0/0ipaddress 172.16.100.1 24quitrouterid 1.1.1.1//配置全局路由IDospf1//创建OSPF 进程1area0//创建骨干区域 0network1.1.1.1 0.0.0.0//通告参考网络 地址段+通配符掩码network172.16.100.0 0.0.0.255authentication-modemd5 1 cipher admin1234//配置身份认证模式为MD5 密文加加密return <Huawei>system-viewsysnamer2interfaceloopback 0ipaddress 2.2.2.2 32interfaceGigabitEthernet 0/0/0 ipaddress 172.16.100.2 24quitrouterid 2.2.2.2ospf1area0network2.2.2.2 0.0.0.0network172.16.100.0 0.0.0.255authentication-modemd5 1 cipher admin1234return <Huawei>system-viewsysnamer3interfaceloopback 0ipaddress 3.3.3.3 32interfaceGigabitEthernet 0/0/0ipaddress 172.16.100.3 24 quitrouterid 3.3.3.3ospf1area0network3.3.3.3 0.0.0.0network172.16.100.0 0.0.0.255authentication-modemd5 1 cipher admin1234return <Huawei>system-viewsysnamer4interfaceloopback 0ipaddress 4.4.4.4 32interfaceGigabitEthernet 0/0/0ipaddress 172.16.100.4 24quitrouterid 4.4.4.4ospf1 area0network4.4.4.4 0.0.0.0network172.16.100.0 0.0.0.255authentication-modemd5 1 cipher admin1234return配置完成后,同步重启四台路由,让OSPF重新进行计算,选举出DR,BDR <r1>displayospf peer brief//查看OSPF邻居简要信息 OSPF Process 1 with Router ID 1.1.1.1 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full 0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full 0.0.0.0 GigabitEthernet0/0/0 4.4.4.4 Full ----------------------------------------------------------------------------4组路由器已经成功建立起邻居关系。 下面验证一下默认情况下DR和BDR状态 <r1>displayospf peer//查看OSPF邻居状态 OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface172.16.100.1(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2 Address: 172.16.100.2 State: Full Mode:Nbr isMasterPriority: 1 DR: 172.16.100.3BDR:172.16.100.2MTU: 0 Dead timer due in 33sec Retrans timer interval: 4 Neighbor is up for 00:17:06 Authentication Sequence: [ 76] Router ID: 3.3.3.3 Address: 172.16.100.3 State: Full Mode:Nbr isMasterPriority: 1 DR: 172.16.100.3BDR:172.16.100.2MTU: 0 Dead timer due in 34sec Retrans timer interval: 5 Neighbor is up for 00:17:04 Authentication Sequence: [ 80] Router ID: 4.4.4.4 Address: 172.16.100.4 State: 2-Way Mode:Nbr isMasterPriority: 1 DR: 172.16.100.3BDR:172.16.100.2MTU: 0 Dead timer due in 37sec Retrans timer interval: 0 Neighbor is up for 00:00:00 Authentication Sequence: [ 0 ]分析得出:R3是DR,R2是BDR;在默认情况下每台路由器上的DR优先级都是1,此时是通过Router-ID的数值高低来进行比较的,数值大的会成为DR,次之百为BDR;那么在目前这个情况,为何DR是R3,BDR是R2,这个是根据路由器的配置或启动序列排列的,可以认为谁先配置谁成为DR,谁先启动,谁成为DR。 下面配置每台设备上的相关接口下使用ospf network-type p2mp命令修改OSPF的网络类型为点到多点。interfaceGigabitEthernet 0/0/0ospfnetwork-type p2mp interfaceGigabitEthernet 0/0/0ospfnetwork-type p2mp interfaceGigabitEthernet 0/0/0ospfnetwork-type p2mp interfaceGigabitEthernet 0/0/0ospfnetwork-type p2mp displayospf peer OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface172.16.100.1(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2 Address: 172.16.100.2 State: Full Mode:Nbr isMasterPriority: 1 DR: None BDR: None MTU: 0 Dead timer due in 93sec Retrans timer interval: 5 Neighbor is up for 00:04:12 Authentication Sequence: [ 585] Router ID: 3.3.3.3 Address: 172.16.100.3 State: Full Mode:Nbr isMasterPriority: 1 DR: None BDR: None MTU: 0 Dead timer due in 113 sec Retrans timer interval: 5 Neighbor is up for 00:03:44 Authentication Sequence: [ 580] Router ID: 4.4.4.4 Address: 172.16.100.4 State: Full Mode:Nbr isMasterPriority: 1 DR: None BDR: None MTU: 0 Dead timer due in 90sec Retrans timer interval: 5 Neighbor is up for 00:02:46 Authentication Sequence: [ 576]分析得出,DR和BDR全部为None,说明了一点,在OSPF点多到点和点到点网络中,不存在DR与BDR的选举。下面根据拓扑要求配置影响DR/BDR选举:R1为DR(性能最好);R2为BDR(性能次之);R4不参选(因为性能最差);R3成为DR OtherinterfaceGigabitEthernet 0/0/0ospfnetwork-type broadcast//配置OSPF网络类型为广播网络 interfaceGigabitEthernet 0/0/0ospfnetwork-type broadcast interfaceGigabitEthernet 0/0/0ospfnetwork-type broadcast interfaceGigabitEthernet 0/0/0ospfnetwork-type broadcast interfaceGigabitEthernet 0/0/0ospfdr-priority 100//配置OSPF DR优先级为100 interfaceGigabitEthernet 0/0/0ospfdr-priority 50 interfaceGigabitEthernet 0/0/0ospfdr-priority 0 验证DR/BDR<r1>displayospf peer OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface172.16.100.1(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2 Address: 172.16.100.2 State: Full Mode:Nbr isMasterPriority: 50 DR: 172.16.100.1BDR:172.16.100.2MTU: 0 Dead timer due in 39sec Retrans timer interval: 5 Neighbor is up for 00:17:00 Authentication Sequence: [ 2095] Router ID: 3.3.3.3 Address: 172.16.100.3 State: Full Mode:Nbr isMasterPriority: 1 DR: 172.16.100.1BDR:172.16.100.2MTU: 0 Dead timer due in 31sec Retrans timer interval: 5 Neighbor is up for 00:14:48 Authentication Sequence: [ 2090] Router ID: 4.4.4.4 Address: 172.16.100.4 State: Full Mode:Nbr isMasterPriority: 0 DR: 172.16.100.1BDR:172.16.100.2MTU: 0 Dead timer due in 37sec Retrans timer interval: 5 Neighbor is up for 00:01:41 Authentication Sequence: [ 2087]此时网络实现了拓扑要求。说明:ospf dr-priority 优先级越高,越会成为DR,次之成为BDR,优先级为0则代表不参与选举。<r3>displayospf brief OSPF Process 1 with Router ID 3.3.3.3 OSPF Protocol Information RouterID: 3.3.3.3 Border Router: …… Area: 0.0.0.0 (MPLS TE not enabled) Authtype: MD5Area flag: Normal SPF scheduled Count: 53 ExChange/Loading Neighbors: 0 Router ID conflict state: Normal Area interface up count: 2 Interface: 172.16.100.3 (GigabitEthernet0/0/0) Cost: 1 State: DROther Type: Broadcast MTU: 1500 Priority: 1 Designated Router: 172.16.100.1 Backup Designated Router: 172.16.100.2 Timers: Hello 10 , Dead 40 , Poll120 , Retransmit 5 , Transmit Delay 1 Interface: 3.3.3.3 (LoopBack0) Cost: 0 State: P-2-P Type: P2P MTU: 1500 Timers: Hello 10 , Dead 40 , Poll120 , Retransmit 5 , Transmit Delay 1 R3也自然成为了DR Other。 测试网络:<r1>ping-a 1.1.1.1 2.2.2.2PING 2.2.2.2: 56data bytes, press CTRL_C to break Reply from 2.2.2.2: bytes=56 Sequence=1ttl=255 time=170 ms Reply from 2.2.2.2: bytes=56 Sequence=2ttl=255 time=40 ms Reply from 2.2.2.2: bytes=56 Sequence=3ttl=255 time=40 ms Reply from 2.2.2.2: bytes=56 Sequence=4ttl=255 time=50 ms Replyfrom 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=50 ms--- 2.2.2.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 40/70/170 ms <r1>ping-a 1.1.1.1 3.3.3.3PING 3.3.3.3: 56data bytes, press CTRL_C to break Reply from 3.3.3.3: bytes=56 Sequence=1ttl=255 time=70 ms Reply from 3.3.3.3: bytes=56 Sequence=2ttl=255 time=40 ms Reply from 3.3.3.3: bytes=56 Sequence=3ttl=255 time=40 ms Reply from 3.3.3.3: bytes=56 Sequence=4ttl=255 time=40 ms Reply from 3.3.3.3: bytes=56 Sequence=5ttl=255 time=50 ms--- 3.3.3.3 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 40/48/70 ms <r1>ping-a 1.1.1.1 4.4.4.4PING 4.4.4.4: 56data bytes, press CTRL_C to break Reply from 4.4.4.4: bytes=56 Sequence=1ttl=255 time=100 ms Reply from 4.4.4.4: bytes=56 Sequence=2ttl=255 time=50 ms Reply from 4.4.4.4: bytes=56 Sequence=3ttl=255 time=50 ms Reply from 4.4.4.4: bytes=56 Sequence=4ttl=255 time=50 ms Reply from 4.4.4.4: bytes=56 Sequence=5ttl=255 time=50 ms--- 4.4.4.4 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 50/60/100 ms
页:
[1]