CCNP-5 OSPF试验1

试验拓扑:

试验要求:模拟在广播环境下, OSPF 的配置与调试。
试验目的:掌握 OSPF 的基本配置,并且能够分析得到 OSPF 在广播环境下邻居发现过程, DR/BDR 选举过程,定时器的时间间隔。

实验配置:
R1
R1(config)#int f0/0
R1(config-if)#ip add 199.99.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int loop0
R1(config-if)#ip add  1.1.1 .1 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#exit
R1(config)#router ospf 100
R1(config-router)#router-id  1.1.1 .1
R1(config-router)#network 199.99.1.0  0.0.0 .255 a 0
 
R2
R2(config)#int f0/0
R2(config-if)#ip add 199.99.1.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int loop0
R2(config-if)#ip add  2.2.2 .2 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#router ospf 100
R2(config-router)#router-id  2.2.2 .2 
R2(config-router)#network 199.99.1.0  0.0.0 .255 a 0
 
R3
R3(config)#int f0/0
R3(config-if)#ip add 199.99.1.3 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int loop0
R3(config-if)#ip add  3.3.3 .3 255.255.255.0
R3(config-if)#ip ospf network point-to-point
R3(config-if)#exit
R3(config)#router ospf 100
R3(config-router)#router-id  3.3.3 .3
R3(config-router)#network 199.99.1.0  0.0.0 .255 area 0
配置完成后,使用 show ip ospf interface 命令查看端口类型:
R1#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 199.99.1.1/24, Area 0
  Process ID 100, Router ID  1.1.1 .1, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State DROTHER, Priority 1
  Designated Router (ID)  3.3.3 .3, Interface address 199.99.1.3
  Backup Designated router (ID)  2.2.2 .2, Interface address 199.99.1.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:01
  Supports Link-local Signaling (LLS)
  Index 1/1, 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)
    Adjacent with neighbor  3.3.3 .3  (Designated Router)
  Suppress hello for 0 neighbor(s)
 
R2#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 199.99.1.2/24, Area 0
  Process ID 100, Router ID  2.2.2 .2, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID)  3.3.3 .3, Interface address 199.99.1.3
  Backup Designated router (ID)  2.2.2 .2, Interface address 199.99.1.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, 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  1.1.1 .1
    Adjacent with neighbor  3.3.3 .3  (Designated Router)
  Suppress hello for 0 neighbor(s)
 
R3#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 199.99.1.3/24, Area 0
  Process ID 100, Router ID  3.3.3 .3, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec,  State DR , Priority 1
  Designated Router (ID)  3.3.3 .3, Interface address 199.99.1.3
  Backup Designated router (ID)  2.2.2 .2, Interface address 199.99.1.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:07
  Supports Link-local Signaling (LLS)
  Index 1/1, 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  1.1.1 .1
    Adjacent with neighbor  2.2.2 .2  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)
不仅可以看到网络类型是 BROADCAST ,还可以知道端口属于哪个 AREA ROUTER ID 是多少,优先级都是默认值 1DR,BDR 是谁, HELLO/DEAD/WAIT 计时器为多少等等。
 
使用 show ip ospf neiighbore 命令查看 OSPF 邻居表:
R1#show ip ospf neighbor 
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2 .2             FULL/BDR        00:00:32    199.99.1.2      FastEthernet0/0
3.3.3 .3           1   FULL/DR         00:00:36    199.99.1.3      FastEthernet0/0
 
R2#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1 .1           1   FULL/DROTHER    00:00:32    199.99.1.1      FastEthernet0/0
3.3.3 .3           1   FULL/DR         00:00:35    199.99.1.3      FastEthernet0/0
 
R3#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1 .1           1   FULL/DROTHER    00:00:36    199.99.1.1      FastEthernet0/0
2.2.2 .2           1   FULL/BDR        00:00:35    199.99.1.2      FastEthernet0/0
 
通过上面的输出可以知道 R3 DR R2 BDR R1 DROther ,这是因为 R3 router-id 最大, R2 的次之, R1 最小。再使用 show ip ospf database 查看都有哪些 LSA 类型:
R1#show ip ospf database
 
            OSPF Router with ID ( 1.1.1 .1) (Process ID 100)
 
                Router Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1 .1          1.1.1 .1         353         0x80000002 0x00AF1E 1
2.2.2 .2          2.2.2 .2         354         0x80000002 0x007153 1
3.3.3 .3          3.3.3 .3         354         0x80000002 0x003388 1
 
                Net Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum
199.99.1.3       3.3.3 .3         354         0x80000001 0x 00736F
 
R2#show ip ospf database
 
            OSPF Router with ID ( 2.2.2 .2) (Process ID 100)
 
                Router Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1 .1          1.1.1 .1         371         0x80000002 0x00AF1E 1
2.2.2 .2          2.2.2 .2         370         0x80000002 0x007153 1
3.3.3 .3          3.3.3 .3         371         0x80000002 0x003388 1
 
                Net Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum
199.99.1.3       3.3.3 .3         371         0x80000001 0x 00736F
 
R3#show ip ospf database
 
            OSPF Router with ID ( 3.3.3 .3) (Process ID 100)
 
                Router Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1 .1          1.1.1 .1         379         0x80000002 0x00AF1E 1
2.2.2 .2          2.2.2 .2         379         0x80000002 0x007153 1
3.3.3 .3          3.3.3 .3         378         0x80000002 0x003388 1
 
                Net Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum
199.99.1.3       3.3.3 .3         378         0x80000001 0x 00736F
可以看到只有 1 类和 2 LSA
然后我们抓取一下 R1 debug 信息看看:
R1#debug ip ospf adj
OSPF adjacency events debugging is on
R1#
R1#clear ip ospf p
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R1#
*Mar  1 00:13:57.483: OSPF: Interface FastEthernet0/0 going Down
*Mar  1 00:13:57.483: OSPF:  1.1.1 .1 address 199.99.1.1 on FastEthernet0/0 is dead, state DOWN
*Mar  1 00:13:57.483: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar  1 00:13:57.483: OSPF: DR/BDR election on FastEthernet0/0
*Mar  1 00:13:57.487: OSPF: Elect BDR  2.2.2 .2
*Mar  1 00:13:57.487: OSPF: Elect DR  3.3.3 .3
*Mar  1 00:13:57.487:        DR:  3.3.3 .3 (Id)   BDR: 2.2.2.2 (Id)
*Mar  1 00:13:57.487: OSPF:  2.2.2 .2 address 199.99.1.2 on FastEthernet0/0 is dead, state DOWN
*Mar  1 00:13:57.487: %OSPF-5-ADJCHG: Process 100, Nbr  2.2.2 .2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 00:13:57.491: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar  1 00:13:57.491: OSPF: DR/BDR election on FastEthernet0/0
*Mar  1 00:13:57.491: OSPF: Elect BDR  0.0.0 .0
*Mar  1 00:13:57.491: OSPF: Elect DR  3.3.3 .3
*Mar  1 00:13:57.495:        DR:  3.3.3 .3 (Id)   BDR: none
*Mar  1 00:13:57.495: OSPF:  3.3.3 .3 address 199.99.1.3 on FastEthernet0/0 is dead, state DOWN
*Mar  1 00:13:57.495: %OSPF-5-ADJCHG: Process 100, Nbr  3.3.3 .3 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 00:13:57.499: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar  1 00:13:57.499: OSPF: DR/BDR election on FastEthernet0/0
*Mar  1 00:13:57.499: OSPF: Elect BDR  0.0.0 .0
*Mar  1 00:13:57.499: OSPF: Elect DR  0.0.0 .0
*Mar  1 00:13:57.499:        DR: none    BDR: none
*Mar  1 00:13:57.503: OSPF: Remember old DR  3.3.3 .3 (id)
*Mar  1 00:13:57.587: OSPF: Interface FastEthernet0/0 going Up
*Mar  1 00:13:57.639: OSPF: 2 Way Communication to  2.2.2 .2 on FastEthernet0/0, state 2WAY \\R2 建立邻居关系,形成 2 Way
*Mar  1 00:13:57.639: OSPF: Backup seen Event before WAIT timer on FastEthernet0/0
*Mar  1 00:13:57.639: OSPF: DR/BDR election on FastEthernet0/0  \\R2比较,选取DR/BDR
*Mar  1 00:13:57.643: OSPF: Elect BDR  2.2.2 .2
*Mar  1 00:13:57.643: OSPF: Elect DR  2.2.2 .2
*Mar  1 00:13:57.643:        DR:  2.2.2 .2 (Id)   BDR: 2.2.2.2 (Id)
*Mar  1 00:13:57.643: OSPF: Send DBD to  2.2.2 .2 on FastEthernet0/0 seq 0x1522 opt 0x52 flag 0x7 len 32  \\ 发送数据库描述报文
*Mar  1 00:13:57.663: OSPF: 2 Way Communication to  3.3.3 .3 on FastEthernet0/0, state 2WAY \\R3 建立邻居关系,形成 2 Way
*Mar  1 00:13:57.663: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar  1 00:13:57.663: OSPF: DR/BDR election on FastEthernet0/0 \\R2R3比较,选取DR/BDR
*Mar  1 00:13:57.667: OSPF: Elect BDR  2.2.2 .2
*Mar  1 00:13:57.667: OSPF: Elect DR  3.3.3 .3
*Mar  1 00:13:57.667:        DR:  3.3.3 .3 (Id)   BDR: 2.2.2.2 (Id)  \\DR R3,BDR R2
*Mar  1 00:13:57.667: OSPF: Send DBD to  3.3.3 .3 on FastEthernet0/0 seq 0x18AD opt 0x52 flag 0x7 len 32  \\ 发送数据库描述报文给 DR
*Mar  1 00:13:57.671: OSPF: Remember old DR  2.2.2 .2 (id)
*Mar  1 00:13:57.671: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar  1 00:13:57.671: OSPF: DR/BDR election on FastEthernet0/0
*Mar  1 00:13:57.671: OSPF: Elect BDR  2.2.2 .2
*Mar  1 00:13:57.671: OSPF: Elect DR  3.3.3 .3
*Mar  1 00:13:57.675:        DR:  3.3.3 .3 (Id)   BDR: 2.2.2.2 (Id)
*Mar  1 00:13:57.711: OSPF: Rcv DBD from  2.2.2 .2 on FastEthernet0/0 seq 0x11D0 opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART  \\收到R2 的数据库描述报文,转到 EXSTART 状态
*Mar  1 00:13:57.711: OSPF: NBR Negotiation Done. We are the SLAVE  \\MASTER/SLAVE 的选取,在此为 R2 MASTER R1 SLAVE
*Mar  1 00:13:57.715: OSPF: Send DBD to  2.2.2 .2 on FastEthernet0/0 seq 0x11D0 opt 0x52 flag 0x0 len 32
*Mar  1 00:13:57.759: OSPF: Rcv DBD from  3.3.3 .3 on FastEthernet0/0 seq 0x 78A  opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART \\收到R3 的数据库描述报文,转到 EXSTART 状态
*Mar  1 00:13:57.763: OSPF: NBR Negotiation Done. We are the SLAVE  \\MASTER/SLAVE 的选取,在此为 R3 MASTER R1 SLAVE
*Mar  1 00:13:57.763: OSPF: Send DBD to  3.3.3 .3 on FastEthernet0/0 seq 0x 78A  opt 0x52 flag 0x0 len 32
*Mar  1 00:13:57.767: OSPF: Rcv DBD from  2.2.2 .2 on FastEthernet0/0 seq 0x11D1 opt 0x52 flag 0x3 len 92  mtu 1500 state EXCHANGE  \\ 交换 DBD 报文,状态转为 EXCHANGE
*Mar  1 00:13:57.771: OSPF: Send DBD to  2.2.2 .2 on FastEthernet0/0 seq 0x11D1 opt 0x52 flag 0x0 len 32
*Mar  1 00:13:57.879: OSPF: Rcv DBD from  2.2.2 .2 on FastEthernet0/0 seq 0x11D2 opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE
*Mar  1 00:13:57.879: OSPF: Exchange Done with  2.2.2 .2 on FastEthernet0/0
*Mar  1 00:13:57.883: OSPF: Send LS REQ to  2.2.2 .2 length 36 LSA count 3  \\ 发送 LSR
*Mar  1 00:13:57.883: OSPF: Send DBD to  2.2.2 .2 on FastEthernet0/0 seq 0x11D2 opt 0x52 flag 0x0 len 32
*Mar  1 00:13:57.955: OSPF: Rcv DBD from  3.3.3 .3 on FastEthernet0/0 seq 0x78B opt 0x52 flag 0x3 len 92  mtu 1500 state EXCHANGE  \\ 交换 DBD 报文,状态转为 EXCHANGE
*Mar  1 00:13:57.955: OSPF: Send DBD to  3.3.3 .3 on FastEthernet0/0 seq 0x78B opt 0x52 flag 0x0 len 32
*Mar  1 00:13:57.987: OSPF: Reset old DR on FastEthernet0/0
*Mar  1 00:13:57.987: OSPF: Build router LSA for area 0, router ID  1.1.1 .1, seq 0x80000001
*Mar  1 00:13:57.995: OSPF: Rcv LS UPD from  2.2.2 .2 on FastEthernet0/0 length 136 LSA count 3  \\ 收到 LSU
*Mar  1 00:13:57.995: OSPF: Synchronized with  2.2.2 .2 on FastEthernet0/0, state FULL   *Mar  1 00:13:57.999: %OSPF-5-ADJCHG: Process 100, Nbr  2.2.2 .2 on FastEthernet0/0 from LOADING to FULL, Loading Done \\R2 成为 FULL 状态。
*Mar  1 00:13:57.999: OSPF: Rcv DBD from  3.3.3 .3 on FastEthernet0/0 seq 0x 78C  opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE
*Mar  1 00:13:57.999: OSPF: Exchange Done with  3.3.3 .3 on FastEthernet0/0
*Mar  1 00:13:58.003: OSPF: Synchronized with  3.3.3 .3 on FastEthernet0/0, state FULL *Mar  1 00:13:58.003: %OSPF-5-ADJCHG: Process 100, Nbr  3.3.3 .3 on FastEthernet0/0 from LOADING to FULL, Loading Done \\R3 成为 FULL 状态。
*Mar  1 00:13:58.003: OSPF: Send DBD to  3.3.3 .3 on FastEthernet0/0 seq 0x 78C  opt 0x52 flag 0x0 len 32
*Mar  1 00:13:58.083: OSPF: Rcv LS UPD from  3.3.3 .3 on FastEthernet0/0 length 60 LSA count 1
*Mar  1 00:14:02.583: OSPF: Rcv LS UPD from  2.2.2 .2 on FastEthernet0/0 length 64 LSA count 1
*Mar  1 00:14:02.783: OSPF: Rcv LS UPD from  3.3.3 .3 on FastEthernet0/0 length 64 LSA count 1
*Mar  1 00:14:02.855: OSPF: Rcv LS UPD from  2.2.2 .2 on FastEthernet0/0 length 64 LSA count 1
*Mar  1 00:14:02.859: OSPF: Rcv LS UPD from  3.3.3 .3 on FastEthernet0/0 length 64 LSA count 1
*Mar  1 00:14:03.135: OSPF: Rcv LS UPD from  3.3.3 .3 on FastEthernet0/0 length 64 LSA count 1
*Mar  1 00:14:03.499: OSPF: Build router LSA for area 0, router ID  1.1.1 .1, seq 0x80000003
*Mar  1 00:14:03.671: OSPF: Rcv LS UPD from  3.3.3 .3 on FastEthernet0/0 length 64 LSA count 1
红色标记 / 蓝色注释的部分比较重要,通过红色标记 / 蓝色注释的部分可以看到整个 OSPF 邻居建立和选取 DR/BDR 和交换 DBD 报文和 LSU/LSR/LSAck 报文,最终形成 FULL 状态的全部过程。

实验总结:通过这个简单的实验我们可以知道在广播环境下, OSPF 的邻居关系是自动建立的,并且需要有 DR/BDR 地选取,还可以看到几个特别计时器的设置, hello 间隔为 10 秒,死亡,等待时间为 hello 时间间隔的 4 40 秒。

你可能感兴趣的:(职场,休闲,ccnp,ospf)