課題內容:OSPF虛鏈路研究數據庫
實驗拓撲:負載均衡
基本IP地址規劃:ide
R3-R5之間使用 10.1.35.0/30 子網oop
R一、R三、R4之間使用 10.1.1.0/24子網學習
R一、R二、R4之間使用 10.1.124.0/24子網優化
每臺設備的環回接口使用 10.1.6.X/32 X = 設備編號ui
幀中繼配置:spa
R2:3d
default int s1/0日誌
default int s1/1
default int s1/2
frame-relay switching
interface Serial1/0
no ip address
no shut
encapsulation frame-relay
frame-relay intf-type dce
frame-relay route 103 interface Serial1/2 301
!
interface Serial1/1
no ip address
no shut
encapsulation frame-relay
frame-relay intf-type dce
frame-relay route 403 interface Serial1/2 304
!
interface Serial1/2
no ip address
no shut
encapsulation frame-relay
frame-relay intf-type dce
frame-relay route 301 interface Serial1/0 103
frame-relay route 304 interface Serial1/1 403
R1:
interface Serial1/0
no shutdown
ip address 10.1.1.1 255.255.255.0
encapsulation frame-relay
R3:
interface Serial1/2
no shutdown
ip address 10.1.1.3 255.255.255.0
encapsulation frame-relay
R4:
interface Serial1/1
no shutdown
ip address 10.1.1.4 255.255.255.0
encapsulation frame-relay
按圖所示配置OSPF
R1(config)#int lo0
R1(config-if)#ip ospf 1 area 0
R1(config-if)#int s1/0
R1(config-if)#ip ospf 1 area 100
R1(config-if)#int e0/1
R1(config-if)#ip ospf 1 area 2
R1(config-if)#router ospf 1
R1(config-router)#area 2 stub no-summary
R2(config)#router ospf 1
R2(config-router)#net
R2(config-router)#network 10.0.0.0 0.255.255.255 area 2
R2(config-router)#area 2 stub
R4(config)#int s1/1
R4(config-if)#ip os 1 a 100
R4(config-if)#int l0
R4(config-if)#ip os 1 a 100
R4(config-if)#int e0/3
R4(config-if)#ip os 1 a 2
R4(config-if)#router ospf 1
R4(config-router)#area 2 stub no-summary
R3(config)#int s1/2
R3(config-if)#ip ospf 1 area 100
R3(config-if)#int e0/3
R3(config-if)#ip ospf 1 area 1
R3(config-if)#int loopback 0
R3(config-if)#ip ospf 1 area 100
R3(config-if)#end
R5(config)#int loopback 0
R5(config-if)#ip ospf 1 area 1
R5(config-if)#int e0/3
R5(config-if)#ip ospf 1 area 1
R1(config-if)#ip ospf network point-to-multipoint
R3(config-if)#ip ospf network point-to-multipoint
R4(config-if)#ip ospf network point-to-multipoint
驗證:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.6.2 1 FULL/BDR 00:00:35 10.1.124.2 Ethernet0/1
10.1.6.4 1 FULL/DROTHER 00:00:38 10.1.124.4 Ethernet0/1
10.1.5.3 0 FULL/ - 00:01:48 10.1.1.3 Serial1/0
R1#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 0 10.1.6.1/32 1 LOOP 0/0
Et0/1 1 2 10.1.124.1/24 10 DR 2/2
Se1/0 1 100 10.1.1.1/24 64 P2MP 1/1
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.6.1 1 FULL/DR 00:00:39 10.1.124.1 Ethernet0/2
10.1.6.4 1 FULL/DROTHER 00:00:35 10.1.124.4 Ethernet0/2
R2#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 2 10.1.6.2/32 1 LOOP 0/0
Et0/2 1 2 10.1.124.2/24 10 BDR 2/2
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.6.5 1 FULL/BDR 00:00:30 10.1.35.2 Ethernet0/3
10.1.6.1 0 FULL/ - 00:01:49 10.1.1.1 Serial1/2
10.1.6.4 0 FULL/ - 00:01:58 10.1.1.4 Serial1/2
R3#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Et0/3 1 1 10.1.35.1/30 10 DR 1/1
Lo0 1 100 10.1.5.3/32 1 LOOP 0/0
Se1/2 1 100 10.1.1.3/24 64 P2MP 2/2
R4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.6.1 1 FULL/DR 00:00:35 10.1.124.1 Ethernet0/3
10.1.6.2 1 FULL/BDR 00:00:38 10.1.124.2 Ethernet0/3
10.1.5.3 0 FULL/ - 00:01:55 10.1.1.3 Serial1/1
R4#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Et0/3 1 2 10.1.124.4/24 10 DROTH 2/2
Lo0 1 100 10.1.6.4/32 1 LOOP 0/0
Se1/1 1 100 10.1.1.4/24 64 P2MP 1/1
R5#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.5.3 1 FULL/DR 00:00:31 10.1.35.1 Ethernet0/3
R5#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 1 10.1.6.5/32 1 LOOP 0/0
Et0/3 1 1 10.1.35.2/30 10 BDR 1/1
檢查路由:
R2#show ip route ospf | begin Gateway
Gateway of last resort is 10.1.124.1 to network 0.0.0.0
O*IA 0.0.0.0/0 [110/11] via 10.1.124.1, 00:13:47, Ethernet0/2
// 位於徹底末節區域的R2,僅僅收到了一條O IA的默認路由,那麼,這是不是正常現象? //
R2#show ip ospf border-routers
OSPF Router with ID (10.1.6.2) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 10.1.6.1 [10] via 10.1.124.1, Ethernet0/2, ABR, Area 2, SPF 3
注意: ABR的定義,必須至少有一個接口位於骨幹區域,一個接口位於非骨幹區域,這樣的OSPF路由器才被稱爲ABR;
R4#show ip route ospf | begin Gateway
Gateway of last resort is 10.1.124.1 to network 0.0.0.0
O*IA 0.0.0.0/0 [110/11] via 10.1.124.1, 00:20:19, Ethernet0/3
10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks
O 10.1.1.1/32 [110/128] via 10.1.1.3, 00:13:48, Serial1/1
O 10.1.1.3/32 [110/64] via 10.1.1.3, 00:13:48, Serial1/1
O 10.1.5.3/32 [110/65] via 10.1.1.3, 00:13:48, Serial1/1
O IA 10.1.6.1/32 [110/129] via 10.1.1.3, 00:13:48, Serial1/1
O 10.1.6.2/32 [110/11] via 10.1.124.2, 00:20:19, Ethernet0/3
// R4沒有收到 區域1的路由 //
緣由是? 普通區域之間是不能直接傳遞路由的;
區域之間的路由傳遞,本質上是由ABR對LSA進行生成或從新生成的過程;
R3並非ABR,所以沒法在區域 1 和區域 100之間轉換LSA;
R5#show ip route ospf | begin Gateway
Gateway of last resort is not set
// R5上一條OSPF路由都沒收到 //
那麼,觀察鏈路狀態數據庫,查找緣由;
R5#show ip ospf database
OSPF Router with ID (10.1.6.5) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
10.1.5.3 10.1.5.3 1269 0x80000002 0x00F6AD 1
10.1.6.5 10.1.6.5 1267 0x80000004 0x00EB88 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
10.1.35.1 10.1.5.3 1269 0x80000001 0x00834E
//R5的鏈路狀態數據庫中,僅僅存在Area 1的一類和二類LSA,沒有來自ABR的用於計算區域間路由的三類LSA以及其它類型的LSA; //
R5#show ip ospf border-routers
OSPF Router with ID (10.1.6.5) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route //從R5上查看,本區域並不存在ABR //
在一些特殊場景或者歷史遺留問題形成的特殊場景環境中,會形成OSPF區域規劃不合理的現象,這也將給路由的傳遞和優化帶來困難;
舉例一:
例如本圖中的 area 1,沒有與骨幹區域相鄰 (非骨幹區域遠離骨幹區域)
會形成沒法與相鄰區域交互路由信息;
舉例二:
如圖所示,骨幹區域因爲歷史緣由並不連續,將會形成以下問題:
按圖部署四臺路由器,OSPF的鄰居和鄰接沒有問題,接口宣告也沒有問題;
R1#show ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
22.1.1.1 1 FULL/DR 00:00:34 12.1.1.2 Ethernet0/1
R1#show ip os int br
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 110 0 11.1.1.1/32 1 LOOP 0/0
Et0/1 110 0 12.1.1.1/24 10 BDR 1/1
R2#show ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
11.1.1.1 1 FULL/BDR 00:00:31 12.1.1.1 Ethernet0/1
33.1.1.1 1 FULL/DR 00:00:35 23.1.1.3 Ethernet0/2
R2#show ip os int br
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 110 0 22.1.1.1/32 1 LOOP 0/0
Et0/1 110 0 12.1.1.2/24 10 DR 1/1
Et0/2 110 1 23.1.1.2/24 10 BDR 1/1
R3#show ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
44.1.1.1 1 FULL/DR 00:00:39 34.1.1.4 Ethernet0/3
22.1.1.1 1 FULL/BDR 00:00:38 23.1.1.2 Ethernet0/2
R3#
R3#show ip os int br
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 110 0 33.1.1.1/32 1 LOOP 0/0
Et0/3 110 0 34.1.1.3/24 10 BDR 1/1
Et0/2 110 1 23.1.1.3/24 10 DR 1/1
R4#show ip os neighbor
Neighbor ID Pri State Dead Time Address Interface
33.1.1.1 1 FULL/BDR 00:00:35 34.1.1.3 Ethernet0/3
R4#show ip os int br
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 110 0 44.1.1.1/32 1 LOOP 0/0
Et0/3 110 0 34.1.1.4/24 10 DR 1/1
查看路由:
R4#show ip route ospf | begin Gateway
Gateway of last resort is not set
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/20] via 34.1.1.3, 00:01:41, Ethernet0/3
33.0.0.0/32 is subnetted, 1 subnets
O 33.1.1.1 [110/11] via 34.1.1.3, 00:01:41, Ethernet0/3
//R4的路由表中,並無左側一個區域0的路由;//
檢查LSDB,看是否有 LSA
OSPF ABR的水平分割規則: 從骨幹區域傳遞到非骨幹區域的三類LSA,不容許傳遞迴骨幹區域;
//也就意味着,舉例二中這個場景,將會形成兩個不連續的骨幹區域之間沒法交互路由 //
OSPF的虛鏈路主要用於解決以上兩種場景。
在場景二種部署虛鏈路:
由area 1 承載虛鏈路;
Note : 規則:承載虛鏈路的區域必須是非特殊區域;
虛鏈路是屬於骨幹區域的一條鏈路;
配置:
在ABR上配置
R2(config-router)#area 1 virtual-link 33.1.1.1
R3(config-router)#area 1 virtual-link 22.1.1.1
// 注意,此處配置的對等體爲對端的 router-id //
R3#
*Sep 5 12:17:18.983: %OSPF-5-ADJCHG: Process 110, Nbr 22.1.1.1 on OSPF_VL0 from LOADING to FULL, Loading Done
// 日誌信息表示經過OSPF虛鏈路創建了一個徹底鄰接關係 //
R3#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
VL0 110 0 23.1.1.3/24 10 P2P 1/1
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
22.1.1.1 0 FULL/ - - 23.1.1.2 OSPF_VL0
經過檢查命令,發現設備上多了一個虛鏈路的接口,以及一個虛鏈路的鄰居;
值得注意的是,虛鏈路在部署時,若是不加參數,默認將不記老化時間;
R3#show ip ospf interface
OSPF_VL0 is up, line protocol is up
Internet Address 23.1.1.3/24, Area 0, Attached via Not Attached
Process ID 110, Router ID 33.1.1.1, Network Type VIRTUAL_LINK, Cost: 10
Topology-MTID Cost Disabled Shutdown Topology Name
0 10 no no Base
Configured as demand circuit
Run as demand circuit
DoNotAge LSA allowed
Transmit Delay is 1 sec, State POINT_TO_POINT
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 3/4, 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 1, Adjacent neighbor count is 1
Adjacent with neighbor 22.1.1.1 (Hello suppressed)
Suppress hello for 1 neighbor(s)
// 經過虛鏈路創建的鄰居,抑制hello報文,虛鏈路使用跟按需電路同樣的工做方法 //
R3#show ip ospf database
OSPF Router with ID (33.1.1.1) (Process ID 110)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
11.1.1.1 11.1.1.1 1013 (DNA) 0x80000003 0x00527B 2
22.1.1.1 22.1.1.1 1 (DNA) 0x80000005 0x007AD3 3
33.1.1.1 33.1.1.1 430 0x80000005 0x0036D1 3
44.1.1.1 44.1.1.1 1351 0x80000003 0x007BBD 2
// 經過虛鏈路學習到的 LSA,不記老化時間 //
虛鏈路規則(補):
虛鏈路的一個端點必須在骨幹區域上;
首先想清楚,部署虛鏈路的目的是?
咱們要解決area 1 和area 100 沒有ABR的問題,所以,經過在 area 100 部署一條虛鏈路,將R3鏈接到 骨幹區域,使得R3成爲 ABR;
配置:
R1(config)#router ospf 1
R1(config-router)#area 100 virtual-link 10.1.6.3
R3(config)#router ospf 1
R3(config-router)#area 100 virtual-link 10.1.6.1
驗證:
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.6.1 0 FULL/ - - 10.1.1.1 OSPF_VL0
R5#show ip route ospf | begin Gateway
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 11 subnets, 3 masks
O IA 10.1.1.1/32 [110/74] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.1.3/32 [110/10] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.1.4/32 [110/74] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.6.1/32 [110/75] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.6.2/32 [110/85] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.6.3/32 [110/11] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.6.4/32 [110/75] via 10.1.35.1, 00:02:00, Ethernet0/3
O IA 10.1.124.0/24 [110/84] via 10.1.35.1, 00:02:00, Ethernet0/3
// R5上已經可以收取到全部的OSPF路由了 //
可是,R3上去往 area 2的路由,沒有負載均衡,由於 R4並非ABR;
嘗試部署另外一條虛鏈路,使得R4也成爲ABR
在R1和R4之間部署虛鏈路:
R1(config)#router ospf 1
R1(config-router)#area 100 virtual-link 10.1.6.4
R4(config)#router ospf 1
R4(config-router)#area 100 virtual-link 10.1.6.1
R4#
*Sep 5 12:58:45.058: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.6.1 on OSPF_VL0 from LOADING to FULL, Loading Done // 日誌顯示鄰接成功創建 //
驗證:
R3#show ip route ospf | begin Gateway
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 12 subnets, 3 masks
O 10.1.1.1/32 [110/64] via 10.1.1.1, 00:07:30, Serial1/2
O 10.1.1.4/32 [110/64] via 10.1.1.4, 00:07:30, Serial1/2
O 10.1.6.1/32 [110/65] via 10.1.1.1, 00:07:20, Serial1/2
O IA 10.1.6.2/32 [110/75] via 10.1.1.4, 00:01:08, Serial1/2
[110/75] via 10.1.1.1, 00:07:20, Serial1/2
O 10.1.6.4/32 [110/65] via 10.1.1.4, 00:07:30, Serial1/2
O 10.1.6.5/32 [110/11] via 10.1.35.2, 00:06:47, Ethernet0/3
O IA 10.1.124.0/24 [110/74] via 10.1.1.4, 00:01:08, Serial1/2
[110/74] via 10.1.1.1, 00:07:20, Serial1/2
// 成功實現了路由的負載均衡 //
OSPF虛鏈路實用場景總結:
1,backbone區域被分割
2,非骨幹區域與骨幹區域不相鄰
3, 骨幹區域不可靠鏈路備份