实验24:广播多路访问链路上的OSPF
1.
实验目的
通过本实验可以掌握:
(1)在路由器上启动OSPF 路由进程
(2)启用参与路由协议的接口,并且通告网络及所在的区域
(3)修改参考带宽
(4)DR 选举的控制
(5)广播多路访问链路上的OSPF 的特征
2.
实验拓扑
本实验的拓扑结构如图所示。
3.
实验步骤
注:
(1)为了避免路由器之间建立完全邻接关系而引起的大量开销,OSPF 要求在多路访问
的网络中选举一个DR,每个路由器都与之建立邻接关系。选举DR 的同时也选举出一个BDR,
在DR 失效的时候,BDR 担负起DR 的职责,而且所有其它路由器只与DR 和BDR 建立邻接关
系;
(2)DR 和BDR 有它们自己的组播地址224.0.0.6;
(3)DR 和BDR 的选举是以各个网络为基础的,也就是说DR 和BDR 选举是一个路由器
的接口特性,而不是整个路由器的特性;
(4)DR 选举的原则:
① 首要因素是时间,最先启动的路由器被选举成DR;
② 如果同时启动,或者重新选举,则看接口优先级(范围为0-255),优先级最高的被
选举成DR,默认情况下,多路访问网络的接口优先级为1,点到点网络接口优先级为0,修
改接口优先级的命令是“ ip ospf priority”,如果接口的优先级被设置为0,那么该接口将
不参与DR 选举;
③ 如果前两者相同,最后看路由器ID,路由器ID 最高的被选举成DR;
(5)DR 选举是非抢占的,除非人为地重新选举。重新选举DR 的方法有两种,一是路
由器重新启动,二是执行“clear ip ospf process”命令。
(1)步骤1:配置路由器r0
r0(config)#int loo 1
r0(config-if)#ip add 1.1.1
*Mar 1 00:01:29.683: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r0(config-if)#ip add 1.1.1.1 255.255.255.0
r0(config-if)#int f0/0
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#no sh
r0(config-if)#
*Mar 1 00:01:50.631: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:01:51.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
r0(config-if)#do ping 172.16.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 40/63/92 ms
r0(config-if)#do ping 172.16.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 48/60/76 ms
r0(config-if)#exit
r0(config)#router ospf 1
r0(config-router)#net 1.1.1.0 0.0.0.255 area 0
r0(config-router)#net 172.16.1.0 0.0.0.255 area 0
r0(config-router)#
*Mar 1 00:05:59.931: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
r0(config-router)#do ping
*Mar 1 00:06:39.855: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
r0(config-router)#do ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 28/46/68 ms
r0(config-router)#do sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 172.16.1.2, 00:00:06, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 172.16.1.3, 00:00:06, FastEthernet0/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
r0(config-router)#do sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:31 172.16.1.2 FastEthernet0/0
3.3.3.3 1 FULL/DROTHER 00:00:33 172.16.1.3 FastEthernet0/0
r0(config-router)#do sh ip ospf int
FastEthernet0/0 is up, line protocol is up
Internet Address 172.16.1.1/24, Area 0
//
该接口的地址和运行的OSPF 区域
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
//
进程ID,路由器ID,网络类型,接口Cost 值
Transmit Delay is 1 sec, State DR, Priority 1
//
自己state 是DR
Designated Router (ID) 1.1.1.1, Interface address 172.16.1.1
//DR
的路由器ID 以及接口地址
Backup Designated router (ID) 2.2.2.2, Interface address 172.16.1.2
//BDR
的路由器ID 以及接口地址
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
//
显示几个计时器的值
Hello due in 00:00:05
//
距离下次发送Hello 包的时间
Supports Link-local Signaling (LLS)
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 2, Adjacent neighbor count is 2
//
邻居的个数以及已建立邻接关系的邻居的个数
Adjacent with neighbor 2.2.2.2 (Backup Designated Router)
//R2
是BDR
Adjacent with neighbor 3.3.3.3
//
已经建立邻接关系的邻居路由器ID
邻居关系和邻接关系是不能混为一谈的,邻居关
系是指达到2WAY 状态的两台路由器,而邻接关系是指达到FULL 状态的两台路由器。
Suppress hello for 0 neighbor(s)
//
没有进行Hello 抑制
Loopback1 is up, line protocol is up
Internet Address 1.1.1.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host
r0(config-router)#do debug ip ospf packet
OSPF packet debugging is on
r0(config-router)#
*Mar 1 00:07:49.591: OSPF: rcv. v:2 t:1 l:52 rid:2.2.2.2
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:07:51.151: OSPF: rcv. v:2 t:1 l:52 rid:3.3.3.3
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:07:59.591: OSPF: rcv. v:2 t:1 l:52 rid:2.2.2.2
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:01.119: OSPF: rcv. v:2 t:1 l:52 rid:3.3.3.3
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:09.591: OSPF: rcv. v:2 t:1 l:52 rid:2.2.2.2
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:11.119: OSPF: rcv. v:2 t:1 l:52 rid:3.3.3.3
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:19.603: OSPF: rcv. v:2 t:1 l:52 rid:2.2.2.2
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:21.135: OSPF: rcv. v:2 t:1 l:52 rid:3.3.3.3
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:29.603: OSPF: rcv. v:2 t:1 l:52 rid:2.2.2.2
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#
*Mar 1 00:08:31.135: OSPF: rcv. v:2 t:1 l:52 rid:3.3.3.3
aid:0.0.0.0 chk:8666 aut:0 auk: from FastEthernet0/0
r0(config-router)#do un all
All possible debugging has been turned off
r0(config-router)#do debug ip ospf adj
OSPF adjacency events debugging is on
r0(config-router)#clear ip ospf process
^
% Invalid input detected at '^' marker.
r0(config-router)#do clear ip ospf process
Reset ALL OSPF processes? [no]: y
r0(config-router)#
*Mar 1 00:09:08.895: OSPF: Interface FastEthernet0/0 going Down
*Mar 1 00:09:08.895: OSPF: 1.1.1.1 address 172.16.1.1 on FastEthernet0/0 is dead, state DOWN
*Mar 1 00:09:08.895: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 00:09:08.895: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:09:08.899: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:09:08.899: OSPF: Elect DR 2.2.2.2
*Mar 1 00:09:08.899: OSPF: Elect BDR 2.2.2.2
*Mar 1 00:09:08.899: OSPF: Elect DR 2.2.2.2
*Mar 1 00:09:08.899: DR: 2.2.2.2 (Id) BDR: 2.2.2.2 (Id)
*Mar 1 00:09:08.899: OSPF: Reset adjacency with 3.3.3.3 on FastEthernet0/0, state 2WAY
*Mar 1 00:09:08.899: OSPF: Flush network LSA immediately
*Mar 1 00:09:08.899: OSPF: Remember old DR 1.1.1.1 (id)
*Mar 1 00:09:08.899: OSPF: 2.2.2.2 address 172.16.1.2 on FastEthernet0/0 is dead, state DOWN
*Mar 1 00:09:08.899: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detac
r0(config-router)#hed
*Mar 1 00:09:08.899: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 00:09:08.899: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:09:08.899: OSPF: Elect BDR 3.3.3.3
*Mar 1 00:09:08.899: OSPF: Elect DR 3.3.3.3
*Mar 1 00:09:08.899: DR: 3.3.3.3 (Id) BDR: 3.3.3.3 (Id)
*Mar 1 00:09:08.899: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x25C6 opt 0x52 flag 0x7 len 32
*Mar 1 00:09:08.899: OSPF: Remember old DR 2.2.2.2 (id)
*Mar 1 00:09:08.899: OSPF: 3.3.3.3 address 172.16.1.3 on FastEthernet0/0 is dead, state DOWN
*Mar 1 00:09:08.899: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from EXSTART to DOWN, Neighbor Down: Interface down or detached
*Mar 1 00:09:08.899: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 00:09:08.899: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:09:08.899: OSPF: Elect BDR 0.0.0.0
*Mar 1 00:09:08.899: OSPF: Elect DR 0.0.0.0
*Mar 1 00:09:08.899: DR: none BDR: non
r0(config-router)#e
*Mar 1 00:09:08.899: OSPF: Remember old DR 3.3.3.3 (id)
*Mar 1 00:09:08.899: OSPF: Interface Loopback1 going Down
*Mar 1 00:09:08.899: OSPF: 1.1.1.1 address 1.1.1.1 on Loopback1 is dead, state DOWN
*Mar 1 00:09:08.915: OSPF: Interface FastEthernet0/0 going Up
*Mar 1 00:09:08.919: OSPF: Interface Loopback1 going Up
*Mar 1 00:09:08.935: %OSPF-4-NONEIGHBOR: Received database description from unknown neighbor 3.3.3.3
*Mar 1 00:09:08.943: OSPF: 2 Way Communication to 3.3.3.3 on FastEthernet0/0, state 2WAY
*Mar 1 00:09:08.947: OSPF: 2 Way Communication to 2.2.2.2 on FastEthernet0/0, state 2WAY
*Mar 1 00:09:09.075: OSPF: Rcv DBD from 2.2.2.2 on FastEthernet0/0 seq 0x276 opt 0x52 flag 0x7 len 32 mtu 1500 state 2WAY
*Mar 1 00:09:09.075: OSPF: Nbr state is 2WAY
*Mar 1 00:09:09.399: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000001
*Mar 1 00:09:09.399: OSPF: We are not DR to build Net Lsa for interface FastEthernet0/0
*Mar 1 00:09:09.631: OSPF: Rc
r0(config-router)#v DBD from 3.3.3.3 on FastEthernet0/0 seq 0x2522 opt 0x52 flag 0x7 len 32 mtu 1500 state 2WAY
*Mar 1 00:09:09.631: OSPF: Nbr state is 2WAY
*Mar 1 00:09:11.115: OSPF: Backup seen Event before WAIT timer on FastEthernet0/0
*Mar 1 00:09:11.115: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 00:09:11.115: OSPF: Elect BDR 3.3.3.3
*Mar 1 00:09:11.119: OSPF: Elect DR 2.2.2.2
*Mar 1 00:09:11.119: DR: 2.2.2.2 (Id) BDR: 3.3.3.3 (Id)
*Mar 1 00:09:11.119: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0 seq 0x54 opt 0x52 flag 0x7 len 32
*Mar 1 00:09:11.123: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x2564 opt 0x52 flag 0x7 len 32
r0(config-router)#
*Mar 1 00:09:14.067: OSPF: Rcv DBD from 2.2.2.2 on FastEthernet0/0 seq 0x276 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART
*Mar 1 00:09:14.067: OSPF: NBR Negotiation Done. We are the SLAVE
*Mar 1 00:09:14.071: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0 seq 0x276 opt 0x52 flag 0x2 len 52
*Mar 1 00:09:14.163: OSPF: Rcv DBD from 2.2.2.2 on FastEthernet0/0 seq 0x277 opt 0x52 flag 0x3 len 92 mtu 1500 state EXCHANGE
*Mar 1 00:09:14.163: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0 seq 0x277 opt 0x52 flag 0x0 len 32
*Mar 1 00:09:14.255: OSPF: Rcv DBD from 2.2.2.2 on FastEthernet0/0 seq 0x278 opt 0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE
*Mar 1 00:09:14.255: OSPF: Exchange Done with 2.2.2.2 on FastEthernet0/0
*Mar 1 00:09:14.259: OSPF: Send LS REQ to 2.2.2.2 length 36 LSA count 3
*Mar 1 00:09:14.259: OSPF: Send DBD to 2.2.2.2 on FastEthernet0/0 seq 0x278 opt 0x52 flag 0x0 len 32
*Mar 1 00:09:14.287: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 156 LSA
r0(config-router)# count 3
*Mar 1 00:09:14.291: OSPF: Synchronized with 2.2.2.2 on FastEthernet0/0, state FULL
*Mar 1 00:09:14.291: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar 1 00:09:14.639: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x2522 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART
*Mar 1 00:09:14.639: OSPF: NBR Negotiation Done. We are the SLAVE
*Mar 1 00:09:14.643: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x2522 opt 0x52 flag 0x2 len 112
*Mar 1 00:09:14.711: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x2523 opt 0x52 flag 0x3 len 92 mtu 1500 state EXCHANGE
*Mar 1 00:09:14.711: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x2523 opt 0x52 flag 0x0 len 32
*Mar 1 00:09:14.743: OSPF: Rcv DBD from 3.3.3.3 on FastEthernet0/0 seq 0x2524 opt 0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE
*Mar 1 00:09:14.743: OSPF: Exchange Done with 3.3.3.3 on FastEthernet0/0
*Mar 1 00:09:14.747: OSPF: Synchronized with
r0(config-router)#3.3.3.3 on FastEthernet0/0, state FULL
*Mar 1 00:09:14.747: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar 1 00:09:14.747: OSPF: Send DBD to 3.3.3.3 on FastEthernet0/0 seq 0x2524 opt 0x52 flag 0x0 len 32
*Mar 1 00:09:14.803: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 64 LSA count 1
r0(config-router)#
*Mar 1 00:09:16.623: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000002
*Mar 1 00:09:16.711: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 76 LSA count 1
*Mar 1 00:09:16.715: OSPF: Rcv LS UPD from 3.3.3.3 on FastEthernet0/0 length 76 LSA count 1
r0(config-router)#
*Mar 1 00:09:18.899: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 64 LSA count 1
*Mar 1 00:09:19.555: OSPF: Rcv LS UPD from 3.3.3.3 on FastEthernet0/0 length 64 LSA count 1
r0(config-router)#
*Mar 1 00:09:21.431: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 76 LSA count 1
*Mar 1 00:09:21.623: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000004
r0(config-router)#
*Mar 1 00:09:26.663: OSPF: Rcv LS UPD from 2.2.2.2 on FastEthernet0/0 length 76 LSA count 1
r0(config-router)#do un all
All possible debugging has been turned off
r0(config-router)#
① DR 重新选举的过程和结果② 在OSPF 邻接关系建立的过程中,接口的状态的变化包括DOWN、2 Way、EXSTART、
EXCHANGE、Loading 和FULL。
(2)步骤2:配置路由器r1
r1(config)#int loo 1
r1(config-if)#ip add 2.2.2.
*Mar 1 00:03:04.643: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r1(config-if)#ip add 2.2.2.2 255.255.255.0
r1(config-if)#int f0/0
r1(config-if)#ip add 172.16.1.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#
*Mar 1 00:03:24.991: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:03:25.991: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
r1(config-if)#exit
r1(config)#router ospf 1
r1(config-router)#net 2.2.2.0 0.0.0.0.255 area 0
^
% Invalid input detected at '^' marker.
r1(config-router)#net 2.2.2.0 0.0.0.255 area 0
r1(config-router)#net 172.16.1.0 0.0.0.255
% Incomplete command.
r1(config-router)#net 172.16.1.0 0.0.0.255 area 0
r1(config-router)#
*Mar 1 00:05:59.455: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
r1(config-router)#
*Mar 1 00:06:39.343: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
r1(config-router)#
*Mar 1 00:09:13.843: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
r1(config-router)#
(3)步骤3:配置路由器r2
r2(config)#int loo 1
r2(config-if)#ip add 17
*Mar 1 00:02:37.347: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r2(config-if)#ip add 3.3.3.3 255.255.255.0
r2(config-if)#int f0/0
r2(config-if)#ip add 172.16.1.3 255.255.255.0
r2(config-if)#no sh
r2(config-if)#
*Mar 1 00:03:00.103: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:03:01.103: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
r2(config-if)#exit
r2(config)#router ospf 1
r2(config-router)#net 3.3.3.0 0.0.0.255 area 0
r2(config-router)#net 172.16.1.3 0.0.0.255 area 0
r2(config-router)#
*Mar 1 00:06:38.987: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar 1 00:06:38.991: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
r2(config-router)#
*Mar 1 00:09:13.971: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
r2(config-router)#
本文转自gauyanm 51CTO博客,原文链接:http://blog.51cto.com/gauyanm/237742,如需转载请自行联系原作者