0×1.幀中繼概述
Frame Relay,簡稱FR,可以將它看做X.25協議的簡化版本,幀中繼網絡中不考慮傳輸差錯問題,其中的結點只做幀的轉發操作,不需要執行接收確認和請求重發等操作;幀中繼是一種嚴格意義上的二層協議。
在幀中繼網絡中使用VC(Virtual Circuit,虛電路)來互連各個分支,並不需要兩個分支之間有單獨的物理鏈路。下面是物理專線和幀中繼虛電路的示意圖:
使用虛電路的最主要好處就是配置方便,建立和拆除虛電路只需要使用命令配置即可,所以虛電路並非真正的物理鏈路,只是在現有網絡的基礎上添加的一系列轉發規則,就好像在源和目的間存在一條專線一樣;相比之下專線則需要綜合佈線施工,建立和拆除難度較大。
幀中繼的工作範圍在DTE設備和幀中繼交換機之間。
a.幀中繼術語
1)VC(Virtual Circuit,虛電路)
幀中繼網絡中兩臺DTE設備之間的連接稱爲虛電路,現在常用的虛電路爲PVC(Permanent Virtual Circuit,永久虛電路),PVC由運營商預先配置。
2)DLCI(Data Link Connection Identifier,數據鏈路連接標識符)
DLCI是源設備和目的設備之間標識邏輯電路的一個數據值,該數據值只具有本地意義。在圖二中,R1上的DLCI號103標識的是R1到R3的連接,R1上的DLCI號104標識的是R1到R4的連接。不同DTE設備上的DLCI號可以相同,但在同一臺DTE設備上不能用相同的DLCI號來標識到不同的連接。
DLCI號的範圍是0-1023,其中0-15以及1008-1023被保留用作特殊用途,所以用戶可以配置的DLCI號爲16-1007。
3)LMI(Local Management Interface,本地管理接口)
LMI是用戶端和幀中繼交換機之間的信令標準,負責管理設備之間的連接,維護設備的狀態。LMI被用來獲知路由器被分配了哪些DLCI,確定PVC的操作狀態,有哪些可用的PVC,另外還用來發送維持分組,確保PVC處於激活狀態。
LMI的類型有三種:ANSI、Cisco、Q933A,DTE端的LMI配置要和幀中繼上的一致,否則LMI不能正常工作,進而導致PVC失敗。思科路由上默認的LMI類型爲Cisco。
除了上面三個比較常見外,還有下面這些術語,有興趣的朋友可以自己去查一下每個術語的解釋:
承諾信息速率(CIR)
承諾突發(BC)
超量突發(BE)
前向顯示擁塞通知(FECN)
後向顯示擁塞通知(BECN)
允許丟棄(DE)
b.幀中繼運行方式
這一部分結合下面的圖三來介紹幀中繼是如何工作的,數據包是如何被轉發的。
1)幀中繼幀格式
幀中繼的幀和以太網幀一樣,也工作在數據鏈路層,幀的格式如下圖:
幀中繼幀的各字段解釋如下:
Flag標誌:標誌幀的開始和結束
地址:地址字段2個字節中包含了DLCI號(幀中繼的幀中只有一個DLCI號,即去往的目的地的DLCI號,2個字節中的10個比特用來儲存這個DLCI號);擁塞控制(Congestion Control)佔3比特,其中包括1比特的FECN位,1比特的BECN位和1比特的DE位;除此之外地址域中還包含3個比特的其他值。
數據:是一個可變長的字段,包含了封裝的上層協議數據。
幀效驗序列:用來保證傳輸數據的完整性。
2)幀中繼中的幀轉發方式
在圖三中,假設R1要將數據發往R3,R1封裝DLCI號103(至於爲什麼R1知道發往R3要封裝103這個在下面的幀中繼尋址方式中會詳細的介紹),將封裝好的幀發往幀中繼交換機FR1。根據FR1上管理員的配置,FR1知道如果從接口1接收到DLCI號爲103的幀,應該將DLCI號修改成112並從接口3發出。此時幀到達FR3,FR3也根據配置得知,從自己的1接口接收到的DLCI號爲112的幀,應該將DLCI號修改成301,並從3號接口發出。此時R3接收到FR3發過來的幀中繼幀,解封裝後交給上層處理。
從上面的工作方式中可以看出,只要R1封裝DLCI號103的幀,就能將數據發往R3,幀中繼網雲使用DLCI號103和DLCI號301在R1和R3之間建立了一條永久虛電路(PVC),同理R1到R4可以封裝104,R4到R1可以封裝401。
3)幀中繼交換表
在圖三的幀中繼網絡中,FR1-3三臺幀中繼交換機上都維護着一個幀中繼交換表,下面是FR1的幀中繼交換表的樣式:
c.幀中繼尋址方式
這一部分將介紹"反向ARP(Inverse ARP)",幀中繼中的反向ARP是根據DLCI號解析IP的一個過程,和以太網中通過ARP解析MAC地址很相似。下圖描述了這一過程是如何進行的:
以上圖(圖6)R1和R3之間的通信爲例,假設R1和幀中繼交換機相連的物理接口IP是123.1.1.1,R3和幀中繼交換機相連的物理接口IP是123.1.1.3,首先第一步在R1和R3的物理接口上配置幀中繼封裝(圖中第1步),接口開啓後,R1和R3會自動向幀中繼交換機發送查詢信息,該消息可以向幀中繼交換機通知本路由狀態,還可以查詢有哪些可用的DLCI號(圖中第2步)。
幀中繼交換機通知R1,DLCI號103和104是激活的(圖中第3步),可以使用。對於每個激活的DLCI號,R1發送一個反向ARP請求分組,宣告自己的IP,並且封裝對應的DLCI號(圖中第4步)。
從這一點可以看出,幀中繼是不支持廣播的,幀中繼網絡默認是NBMA(Non-Broadcast Multiple Access,非廣播多路訪問),但可以通過發送多個幀拷貝來解決廣播問題。
幀中繼網雲將R1發來的DLCI號103替換成301發往R3(圖中第5步,實際幀中繼網絡中可能存在很多幀中繼交換機,這裏假設中間只有一臺,便於講解)。
R3收到幀中繼交換機發來的幀,DLCI號是301,R3處理該數據幀並進行應答,R3封裝DLCI號爲301,並且告知自己的IP是123.1.1.3(圖片中第6步),然後從自己的物理接口發回。
幀中繼交換機收到這個DLCI號是301的幀,根據自己的交換表,將DLCI號改成103發往R1,R1收到這個應答後在本地的映射中添加R3的IP123.1.1.3和對應的DLCI號103,以後發往123.1.1.3的數據幀就用DLCI號103封裝。
最後圖中第7步,R1繼續發送維持消息,默認10秒一次,此維持消息可以驗證幀中繼交換機是否處於激活狀態。反向ARP默認的發送時間是60秒。
同理R3和R4也可以使用相同的方法獲得對方的IP地址和對應的DLCI號。
d.幀中繼水平分隔潛在問題
有時候不需要建立全互連型幀中繼網絡,比如下面這中情況:
在這種星型拓撲結構中R1和R2以及R3通過虛電路相連,R2和R3之間沒有建立虛電路,R1就像以太網中的一個Hub,R2或R3將路由信息發給R1,因爲水平分隔的原因,R1不會將從一個接口接收到的路由信息再從這個接口發回,導致R1上面有所有分支的路由信息,而分支路由間無法學習到路由信息。
解決這一問題的方法是關閉水平分隔,或者使用多個點到點子接口,在後面的配置實例中會詳細介紹到。
0×2.幀中繼配置實例
a.配置幀中繼路由器
幀中繼的所有實驗都在GNS3中完成,配置下面這張拓撲圖,圖中四臺路由器均爲c3640,將R2配置成幀中繼交換機,用來模擬幀中繼網雲,R1、R3、R4是DTE端的路由器配置幀中繼封裝:
首先配置R2成爲幀中繼交換機。
R2配置:
03 | Router(config)# host Frame-relay-SW |
05 | Frame-relay-SW(config)# frame-relay switching |
07 | Frame-relay-SW(config)# int s 0/0 |
10 | Frame-relay-SW(config-if)# encapsulation frame-relay |
13 | * 配置幀中繼LMI類型爲ANSI,這一句是可選配置, |
14 | * 如果不配置,思科使用Cisco作爲默認的LMI類型 |
16 | Frame-relay-SW(config-if)# frame-relay lmi-type ansi |
20 | * 這和具體鏈接的是DCE還是DTE接口無關。 |
22 | Frame-relay-SW(config-if)# frame-relay intf-type dce |
25 | * 將s0/0接口接收到的DLCI號103的幀,替換成301從s0/1接口發出。 |
26 | * 將s0/0接收到的DLCI號104的幀,替換成401從s0/2接口發出。 |
28 | Frame-relay-SW(config-if)# frame-relay route 103 interface s 0/1 301 |
29 | Frame-relay-SW(config-if)# frame-relay route 104 interface s 0/2 401 |
30 | Frame-relay-SW(config-if)# no shut /*打開接口*/ |
33 | Frame-relay-SW(config-if)# int s 0/1 |
34 | Frame-relay-SW(config-if)# encapsulation frame-relay |
35 | Frame-relay-SW(config-if)# frame-relay lmi-type ansi |
36 | Frame-relay-SW(config-if)# frame-relay intf-type dce |
37 | Frame-relay-SW(config-if)# frame-relay route 301 interface s 0/0 103 |
38 | Frame-relay-SW(config-if)# frame-relay route 304 interface s 0/2 403 |
39 | Frame-relay-SW(config-if)# no shut |
42 | Frame-relay-SW(config-if)# int s 0/2 |
43 | Frame-relay-SW(config-if)# encapsulation frame-relay |
44 | Frame-relay-SW(config-if)# frame-relay lmi-type ansi |
45 | Frame-relay-SW(config-if)# frame-relay intf-type dce |
46 | Frame-relay-SW(config-if)# frame-relay route 403 interface s 0/1 304 |
47 | Frame-relay-SW(config-if)# frame-relay route 401 interface s 0/0 104 |
48 | Frame-relay-SW(config-if)# no shut |
49 | Frame-relay-SW(config-if)# end |
幀中繼交換機配置完成後繼續下面的配置,配置幀中繼網絡中其他路由器(R1、R3、R4)。
b.配置其他路由器使用幀中繼網絡
R1配置:
1 | /*配置與幀中繼相連的接口使用幀中繼封裝,再配置IP地址*/ |
3 | R1(config-if)# encapsulation frame-relay |
4 | R1(config-if)# ip add 123.1.1.1 255.255.255.0 |
R3配置:
2 | R3(config-if)#enc f /*命令簡寫*/ |
3 | R3(config-if)# ip add 123.1.1.3 255.255.255.0 |
R4配置:
2 | R4(config-if)# ip add 123.1.1.4 255.255.255.0 |
配置完成後測試R1、R3、R4都能互相ping通,使用下面的命令可以查看幀中繼DLCI號的映射情況:
01 | R1# show frame-relay map |
03 | * "ip 123.1.1.3 dlci 103" |
04 | * 去往123.1.1.3的幀,封裝的DLCI號是103, |
05 | * 本文在幀中繼的反向ARP中介紹過這個映射是如何得到的。 |
07 | * "dynamic" 表示這種映射關係是動態學習到的。 |
09 | * "broadcast" 表示幀中繼上支持廣播。 |
13 | Serial0/0 (up): ip 123.1.1.3 dlci 103(0x67,0x1870), dynamic, |
14 | broadcast ,, status defined, active |
16 | /*同理,發往123.1.1.4的幀用DLCI號104封裝。*/ |
17 | Serial0/0 (up): ip 123.1.1.4 dlci 104(0x68,0x1880), dynamic, |
18 | broadcast ,, status defined, active |
通過下面的命令查看PVC建立和DLCI號的分配情況:
01 | R1# show frame-relay pvc |
03 | PVC Statistics for interface Serial0/0 (Frame Relay DTE) |
06 | * 主要介紹下面這兩句,其中的詳細參數暫時不需要了解, |
07 | * R1使用LMI從幀中繼交換機(R2)那學到了兩條本地可用的DLCI號, |
08 | * 103和104, "STATUS=ACTIVE" 表示PVC鏈路工作正常, |
09 | * 如果 "STATUS=INACTIVE" 表示不可用,一般是遠端配置有問題, |
10 | * "STATUS=DELETED" 則表示本地配置可能有問題。 |
12 | DLCI=103,DLCI USAGE=LOCAL, PVC STATUS=ACTIVE, INTERFACE=Serial0/0 |
15 | DLCI=104,DLCI USAGE=LOCAL, PVC STATUS=ACTIVE, INTERFACE=Serial0/0 |
通過下面的命令查看R1接口的LMI類型:
4 | * R1會自動調整默認的LMI類型和幀中繼交換機上配置的一致, |
5 | * "TYPE=ANSI" 表示R1的s0/0接口的LMI類型是ANSI。 |
7 | LMI Statistics for interface Serial0/0(Frame Relay DTE) LMI TYPE=ANSI |
在上面的配置中可能出現下面的問題:
如果使用"show frame-relay pvc"查看路由器上面學不到DLCI號,請檢查物理接口是否打開(包括幀中繼交換機上的物理接口),本地和幀中繼交換機相連的接口的封裝協議是否被配置成了幀中繼,本地接口的LMI類型是否和幀中繼交換機的一致。
可以通過查看接口信息來驗證:
02 | * 接口是否開啓 "Serial0/0 is up, line protocol is up" |
03 | * 封裝協議 "Encapsulation FRAME-RELAY" |
04 | * LMI類型 "LMI type is ANSI" |
06 | R1# show interfaces s 0/0 |
07 | Serial0/0 is up, line protocol is up |
09 | Encapsulation FRAME-RELAY, crc 16, loopback not set |
11 | LMI DLCI 0 LMI type is ANSI Annex D frame relay DTE |
現在R1、R3、R4都能互相ping通對方,但是還存在一個問題,他們ping不通自己的IP,從上面的"show frame-relay map"也可以看出,R1的幀中繼映射中沒有自己的"123.1.1.1"的映射,它不知道發往這個IP需要封裝什麼DLCI號,下面繼續配置,讓他們都能ping通自己。
c.配置幀中繼能夠ping通自己
爲了它們能夠ping通自己的IP,需要使用靜態映射命令:
03 | * "DLCI號" 是這個IP對應的DLCI, |
04 | * "[broadcast]" 可選參數使鏈路支持廣播, |
06 | * "[cisco|ietf]" 中有兩個可選參數, |
07 | * 如果網絡中不全是思科設備,存在不同設備互連, |
10 | R1(config-if)# frame-relay map ip ip 地址 DLCI號 [ broadcast ] [cisco| ietf ] |
R1、R3、R4添加能ping通自己的靜態映射;
R1配置:
2 | R1(config-if)# frame-relay map ip 123.1.1.1 103 broadcast ietf |
R3配置:
2 | R3(config-if)# frame-relay map ip 123.1.1.3 301 broadcast ietf |
R4配置:
2 | R4(config-if)# frame-relay map ip 123.1.1.4 401 broadcast ietf |
這樣R1、R3、R4就能夠ping通自己的IP了:
02 | R1# show frame-relay map |
03 | Serial0/0 (up): ip 123.1.1.3 dlci 103(0x67,0x1870), dynamic, |
04 | broadcast ,, status defined, active |
05 | Serial0/0 (up): ip 123.1.1.4 dlci 104(0x68,0x1880), dynamic, |
06 | broadcast ,, status defined, active |
09 | * 這一條是我們添加的靜態映射,在沒有指定ieft的時候, |
12 | Serial0/0 (up): ip 123.1.1.1 dlci 103(0x67,0x1870), static , |
14 | IETF, status defined, active |
17 | * 測試 ping 自己,雖然是 ping 自己,但是根據前面的映射可以得知, |
18 | * 數據是到達了R3後再返回的,如果R3關閉物理接口s0/2, |
19 | * 這裏就會 ping 不通,大家可以測試一下。 |
到這裏爲止,幀中繼網絡中的三臺路由器都使用了反向ARP從幀中繼交換機上獲取到DLCI和對應的IP地址,下面一部分將介紹如何關閉反向ARP,使用全手動靜態配置來配置幀中繼映射。
d.配置幀中繼使用靜態映射
這一部分手動配置DLCI的靜態映射,首先關閉反向ARP,然後清除通過反向ARP學習到的動態映射緩存,然後使用手動配置。
R1配置:
03 | R1(config-if)# no frame-relay inverse-arp |
06 | R1#clear frame-relay inarp |
10 | R1(config-if)# frame-relay map ip 123.1.1.3 103 broadcast ietf |
11 | R1(config-if)# frame-relay map ip 123.1.1.4 104 broadcast ietf |
R3配置:
2 | R3(config-if)# no frame-relay inverse-arp |
4 | R3#clear frame-relay inarp |
7 | R3(config-if)# frame-relay map ip 123.1.1.1 301 broadcast ietf |
8 | R3(config-if)# frame-relay map ip 123.1.1.4 304 broadcast ietf |
R4配置:
2 | R4(config-if)# no frame-relay inverse-arp |
4 | R4#clear frame-relay inarp |
7 | R4(config-if)# frame-relay map ip 123.1.1.1 401 broadcast ietf |
8 | R4(config-if)# frame-relay map ip 123.1.1.3 403 broadcast ietf |
配置完成後在R1上查看幀中繼映射表:
01 | /*可以看到狀態全部變成了 "static" 即靜態映射。*/ |
02 | R1# show frame-relay map |
03 | Serial0/0 (up): ip 123.1.1.3 dlci 103(0x67,0x1870), static , |
05 | IETF, status defined, active |
06 | Serial0/0 (up): ip 123.1.1.4 dlci 104(0x68,0x1880), static , |
08 | IETF, status defined, active |
09 | Serial0/0 (up): ip 123.1.1.1 dlci 103(0x67,0x1870), static , |
11 | IETF, status defined, active |
e.RIP over 幀中繼
幀中繼作爲二層鏈路,上面可以運行各種動態路由協議。在GNS3中完成下圖配置,在幀中繼網絡中運行RIP協議。
R2被配置成幀中繼交換機,其中只有兩條虛電路R1-R3和R1-R4,R1 s0/0的IP爲123.1.1.1,R3 s0/1的IP爲123.1.1.3,R4 s0/2的IP爲123.1.1.4,它們上面各有一個迴環接口,這些接口都被髮布到RIP協議中。
首先將R2配置成幀中繼交換機:
03 | Router(config)# host FR-SW |
04 | FR-SW(config)# frame-relay switching |
06 | FR-SW(config)# int s 0/0 |
07 | FR-SW(config-if)# encapsulation frame-relay |
08 | FR-SW(config-if)# frame-relay lmi-type ansi |
09 | FR-SW(config-if)# frame-relay intf-type dce |
10 | /*僅配置R1-R3以及R1-R4的虛電路*/ |
11 | FR-SW(config-if)# frame-relay route 103 interface s 0/1 301 |
12 | FR-SW(config-if)# frame-relay route 104 interface s 0/2 401 |
14 | FR-SW(config-if)# int s 0/1 |
15 | FR-SW(config-if)# encapsulation frame-relay |
16 | FR-SW(config-if)# frame-relay lmi-type ansi |
17 | FR-SW(config-if)# frame-relay intf-type dce |
18 | FR-SW(config-if)# frame-relay route 301 interface s 0/0 103 |
19 | FR-SW(config-if)# no shut |
21 | FR-SW(config-if)# int s 0/2 |
22 | FR-SW(config-if)# encapsulation frame-relay |
23 | FR-SW(config-if)# frame-relay lmi-type ansi |
24 | FR-SW(config-if)# frame-relay intf-type dce |
25 | FR-SW(config-if)# frame-relay route 401 interface s 0/0 104 |
26 | FR-SW(config-if)# no shut |
R1配置:
03 | R1(config-if)# encapsulation frame-relay |
05 | R1(config-if)# no frame-relay inverse-arp |
08 | R1(config-if)# frame-relay map ip 123.1.1.3 103 broadcast ietf |
09 | R1(config-if)# frame-relay map ip 123.1.1.1 103 broadcast ietf |
10 | R1(config-if)# frame-relay map ip 123.1.1.4 104 broadcast ietf |
11 | R1(config-if)# ip add 123.1.1.1 255.255.255.0 |
15 | R1(config-if)# ip add 1.1.1.1 255.255.255.0 |
18 | R1(config-if)#router rip /*配置RIP,宣告所有接口*/ |
19 | R1(config-router)# net 1.0.0.0 |
20 | R1(config-router)# net 123.0.0.0 |
R3配置:
02 | R3(config-if)# encapsulation frame-relay |
03 | R3(config-if)# no frame-relay inverse-arp |
04 | R3(config-if)# frame-relay map ip 123.1.1.1 301 broadcast ietf |
07 | R3(config-if)# frame-relay map ip 123.1.1.3 301 broadcast ietf |
09 | /*因爲R3和R4之間並沒有虛電路,所以發往R4的數據要先封裝成301發往R1*/ |
10 | R3(config-if)# frame-relay map ip 123.1.1.4 301 broadcast ietf |
11 | R3(config-if)# ip add 123.1.1.3 255.255.255.0 |
15 | R3(config-if)# ip add 3.3.3.3 255.255.255.0 |
17 | R3(config-if)#router rip |
18 | R3(config-router)# net 3.0.0.0 |
19 | R3(config-router)# net 123.0.0.0 |
R4配置:
02 | R4(config-if)# encapsulation frame-relay |
03 | R4(config-if)# no frame-relay inverse-arp |
04 | R4(config-if)# frame-relay map ip 123.1.1.1 401 broadcast |
07 | R4(config-if)# frame-relay map ip 123.1.1.4 401 broadcast |
09 | /*因爲R4和R3之間沒有配置虛電路,發往R3的數據先發往R1*/ |
10 | R4(config-if)# frame-relay map ip 123.1.1.3 401 broadcast |
11 | R4(config-if)# ip add 123.1.1.4 255.255.255.0 |
15 | R4(config-if)# ip add 4.4.4.4 255.255.255.0 |
18 | R4(config-if)#router rip |
19 | R4(config-router)# net 4.0.0.0 |
20 | R4(config-router)# net 123.0.0.0 |
配置完成後全網後能互相通信,在R4上查看路由表和幀中繼映射表:
01 | /*顯示R4已經學習到R1和R3上面的迴環接口信息*/ |
04 | Gateway of last resort is not set |
06 | R 1.0.0.0/8 [120/1] via 123.1.1.1, 00:00:18, Serial0/2 |
07 | R 3.0.0.0/8 [120/2] via 123.1.1.1, 00:00:18, Serial0/2 |
08 | 4.0.0.0/24 is subnetted, 1 subnets |
09 | C 4.4.4.0 is directly connected, Loopback0 |
10 | 123.0.0.0/24 is subnetted, 1 subnets |
11 | C 123.1.1.0 is directly connected, Serial0/2 |
14 | R4# show frame-relay map |
15 | Serial0/2 (up): ip 123.1.1.3 dlci 401(0x191,0x6410), static , |
17 | IETF, status defined, active |
18 | Serial0/2 (up): ip 123.1.1.4 dlci 401(0x191,0x6410), static , |
20 | IETF, status defined, active |
21 | Serial0/2 (up): ip 123.1.1.1 dlci 401(0x191,0x6410), static , |
23 | IETF, status defined, active |
26 | * 這個時候假設R4去 ping 3.3.3.3,首先R4查詢路由表, |
27 | * 發現 "3.0.0.0/8 [120/2] via 123.1.1.1" , |
28 | * 發往3.0.0.0/8網段的數據要發給123.1.1.1即R1, |
29 | * R4再查詢幀中繼映射表,發現 "ip 123.1.1.1 dlci 401" |
30 | * 所以R4用DLCI號401封裝這個幀發往R1。 |
從上面的輸出中並沒有出現上面"幀中繼水平分隔潛在問題"中提到的水平分隔問題,這是因爲幀中繼物理接口默認關閉了水平分隔,在R1上查看接口信息:
2 | Serial0/0 is up, line protocol is up |
4 | Split horizon is disabled /*水平分隔是關閉的*/ |
可以使用下面的命令打開水平分隔:
2 | R1(config-if)# ip split-horizon |
打開水平分隔後稍等一段時間,RIP收斂後,R3上面就看不到R4迴環接口的路由了,同樣R4上面也看不到R3的迴環接口路由了。
除了關閉水平分隔外,還可以使用接下來介紹的方法,使用點到點子接口來解決水平分隔在幀中繼網絡中導致的問題。
f.配置幀中繼子接口
這一部分來配置一個稍微複雜一點的拓撲,在這個拓撲中會綜合運用到兩種子接口:點到點子接口(Point-to-Point)、多點子接口(Multipoint)。
如上圖所示,R5被配置成幀中繼交換機,其中有三條虛電路R1-R2,R1-R3,R1-R4,在R1的s0/0接口上啓用了子接口,其中s0/0.1用來連接R2,是一個點到點子接口,s0/0.2被用來連接R3和R4,是一個多點子接口。R1 s0/0.1的IP爲12.1.1.1、s0/0.2的IP地址爲134.1.1.1,R2的s0/1的IP地址爲12.1.1.2,R3的s0/2的IP地址爲134.1.1.3,R4的s0/3的IP地址爲134.1.1.4。每個路由上都有一個迴環接口,IP如圖所示。在這個幀中繼網絡上運行RIP協議,測試多點子接口存在的水平分隔問題。
首先配置R5成爲幀中繼交換機:
03 | Router(config)# host RF-SW |
04 | RF-SW(config)# frame-relay switch |
05 | RF-SW(config)# int s 0/0 |
06 | RF-SW(config-if)#encap frame |
07 | RF-SW(config-if)#frame lmi-type ansi |
08 | RF-SW(config-if)#frame intf-type dce |
09 | RF-SW(config-if)#frame route 102 int s 0/1 201 |
10 | RF-SW(config-if)#frame route 103 int s 0/2 301 |
11 | RF-SW(config-if)#frame route 104 int s 0/3 401 |
12 | RF-SW(config-if)# no shut |
13 | RF-SW(config-if)# int s 0/1 |
14 | RF-SW(config-if)#encap frame |
15 | RF-SW(config-if)#frame lmi-type ansi |
16 | RF-SW(config-if)#frame intf-type dce |
17 | RF-SW(config-if)#frame route 201 int s 0/0 102 |
18 | RF-SW(config-if)# no shut |
19 | RF-SW(config-if)# int s 0/2 |
20 | RF-SW(config-if)#encap frame |
21 | RF-SW(config-if)#frame lmi-type ansi |
22 | RF-SW(config-if)#frame intf-type dce |
23 | RF-SW(config-if)#frame route 301 int s 0/0 103 |
24 | RF-SW(config-if)# no shut |
25 | RF-SW(config-if)# int s 0/3 |
26 | RF-SW(config-if)#encap frame |
27 | RF-SW(config-if)#frame lmi-type ansi |
28 | RF-SW(config-if)#frame intf-type dce |
29 | RF-SW(config-if)#frame route 401 int s 0/0 104 |
30 | RF-SW(config-if)# no shut |
在R1上配置點到點和多點子接口:
02 | R1(config-if)#encap frame |
03 | R1(config-if)# no frame inverse-arp |
04 | R1(config-if)# no shut /*物理接口只需要打開即可*/ |
07 | R1(config-if)# int s 0/0.1 point-to-point |
08 | R1(config-subif)# ip add 12.1.1.1 255.255.255.0 |
10 | * 點到點子接口不需要和物理接口一樣配置靜態映射, |
12 | * 點到點子接口上去往該子接口的IP地址(12.1.1.1) |
13 | * 或遠端(R2的12.1.1.2)的數據都使用這個DLCI號封裝。 |
15 | R1(config-subif)# frame-relay interface -dlci 102 |
18 | R1(config-fr-dlci)# int s 0/0.2 multipoint |
19 | R1(config-subif)# ip add 134.1.1.1 255.255.255.0 |
22 | R1(config-subif)# frame-relay map ip 134.1.1.1 103 broadcast ietf |
23 | R1(config-subif)# frame-relay map ip 134.1.1.4 104 broadcast ietf |
24 | R1(config-subif)# frame-relay map ip 134.1.1.3 103 broadcast ietf |
25 | R1(config-subif)# int lo 0 |
26 | R1(config-if)# ip add 1.1.1.1 255.255.255.0 |
28 | R1(config-if)#router rip /*啓用RIP協議*/ |
29 | R1(config-router)# net 1.0.0.0 |
30 | R1(config-router)# net 12.0.0.0 |
31 | R1(config-router)# net 134.1.0.0 |
R2配置:
02 | R2(config-if)# encapsulation frame-relay |
03 | R2(config-if)# no frame-relay inverse-arp |
04 | R2(config-if)# frame-relay map ip 12.1.1.1 201 broadcast ietf |
05 | R2(config-if)# frame-relay map ip 12.1.1.2 201 broadcast ietf |
06 | R2(config-if)# ip add 12.1.1.2 255.255.255.0 |
09 | R2(config-if)# ip add 2.2.2.2 255.255.255.0 |
11 | R2(config-if)#router rip |
12 | R2(config-router)# net 2.0.0.0 |
13 | R2(config-router)# net 12.0.0.0 |
R3配置:
02 | R3(config-if)# encapsulation frame-relay |
03 | R3(config-if)# no frame-relay inverse-arp |
06 | R3(config-if)# frame-relay map ip 134.1.1.1 301 broadcast ietf |
07 | /*因爲R3和R4之間沒有配置虛電路,所以去往R4要先發往R1*/ |
08 | R3(config-if)# frame-relay map ip 134.1.1.4 301 broadcast ietf |
10 | R3(config-if)# frame-relay map ip 134.1.1.3 301 broadcast ietf |
11 | R3(config-if)# ip add 134.1.1.3 255.255.255.0 |
14 | R3(config-if)# ip add 3.3.3.3 255.255.255.0 |
17 | R3(config-if)#router rip |
18 | R3(config-router)# net 3.0.0.0 |
19 | R3(config-router)# net 134.1.0.0 |
R4配置:
02 | R4(config-if)# encapsulation frame-relay |
03 | R4(config-if)# no frame-relay inverse-arp |
04 | R4(config-if)# frame-relay map ip 134.1.1.1 401 broadcast ietf |
05 | R4(config-if)# frame-relay map ip 134.1.1.3 401 broadcast ietf |
06 | R4(config-if)# frame-relay map ip 134.1.1.4 401 broadcast ietf |
07 | R4(config-if)# ip add 134.1.1.4 255.255.255.0 |
10 | R4(config-if)# ip add 4.4.4.4 255.255.255.0 |
12 | R4(config-if)#router rip |
13 | R4(config-router)# net 4.0.0.0 |
14 | R4(config-router)# net 134.1.0.0 |
可以在R1上查看子接口信息來驗證默認情況下,點到點子接口和多點子接口的水平分隔都是打開的:
01 | R1# show ip interface s 0/0.1 |
02 | Serial0/0.1 is up, line protocol is up |
04 | Split horizon is enabled |
07 | R1# show ip interface s 0/0.2 |
08 | Serial0/0.2 is up, line protocol is up |
10 | Split horizon is enabled |
在R2的多點子接口上連接了兩臺路由器R3和R4,查看R3的路由表:
3 | R 1.0.0.0/8 [120/1] via 134.1.1.1, 00:00:28, Serial0/2 |
4 | R 2.0.0.0/8 [120/2] via 134.1.1.1, 00:00:28, Serial0/2 |
5 | 3.0.0.0/24 is subnetted, 1 subnets |
6 | C 3.3.3.0 is directly connected, Loopback0 |
7 | R 12.0.0.0/8 [120/1] via 134.1.1.1, 00:00:28, Serial0/2 |
8 | 134.1.0.0/24 is subnetted, 1 subnets |
9 | C 134.1.1.0 is directly connected, Serial0/2 |
同樣,在R4上面也看不到R3迴環接口的信息,這就是因爲R1上s0/0.2接口上默認的水平分隔設置導致的,用下面的命令關閉R1的s0/0.2子接口的水平分隔:
2 | R1(config-subif)# no ip split-horizon |
再次查看R3的路由表:
03 | R 1.0.0.0/8 [120/1] via 134.1.1.1, 00:00:13, Serial0/2 |
04 | R 2.0.0.0/8 [120/2] via 134.1.1.1, 00:00:13, Serial0/2 |
05 | 3.0.0.0/24 is subnetted, 1 subnets |
06 | C 3.3.3.0 is directly connected, Loopback0 |
08 | R 4.0.0.0/8 [120/2] via 134.1.1.1, 00:00:13, Serial0/2 |
09 | R 12.0.0.0/8 [120/1] via 134.1.1.1, 00:00:13, Serial0/2 |
10 | 134.1.0.0/24 is subnetted, 1 subnets |
11 | C 134.1.1.0 is directly connected, Serial0/2 |
這一部分演示了路由器子接口配置(點到點子接口和多點子接口)以及多點子接口上面需要注意的水平分隔問題。
0×3.EIGRP over 幀中繼
這一部分使用的拓撲圖如下:
R4是幀中繼交換機,圖中配置了兩條虛電路R1-R2,R1-R3,R1-3各有一個迴環接口IP如圖所示。
首先配置R4成爲幀中繼交換機:
03 | Router(config)# host RF-SW |
04 | RF-SW(config)# frame-relay switching |
05 | RF-SW(config)# int s 0/0 |
06 | RF-SW(config-if)# encapsulation frame-relay |
07 | RF-SW(config-if)# frame-relay lmi-type ansi |
08 | RF-SW(config-if)# frame-relay intf-type dce |
09 | RF-SW(config-if)# frame-relay route 103 int s 0/1 301 |
10 | RF-SW(config-if)# frame-relay route 102 int s 0/2 201 |
11 | RF-SW(config-if)# no shut |
12 | RF-SW(config-if)# int s 0/1 |
13 | RF-SW(config-if)# encapsulation frame-relay |
14 | RF-SW(config-if)# frame-relay lmi-type ansi |
15 | RF-SW(config-if)# frame-relay intf-type dce |
16 | RF-SW(config-if)# frame-relay route 301 int s 0/0 103 |
17 | RF-SW(config-if)# no shut |
18 | RF-SW(config-if)# int s 0/2 |
19 | RF-SW(config-if)# encapsulation frame-relay |
20 | RF-SW(config-if)# frame-relay lmi-type ansi |
21 | RF-SW(config-if)# frame-relay intf-type dce |
22 | RF-SW(config-if)# frame-relay route 201 int s 0/0 102 |
23 | RF-SW(config-if)# no shut |
a.在幀中繼物理接口上運行EIGRP
配置R1、R2、R3的物理接口使用幀中繼封裝,並且在上面運行EIGRP協議。
R1配置:
02 | R1(config-if)# encapsulation frame-relay |
03 | R1(config-if)# no frame-relay inverse-arp |
04 | R1(config-if)# frame-relay map ip 123.1.1.1 102 broadcast ietf |
05 | R1(config-if)# frame-relay map ip 123.1.1.2 102 broadcast ietf |
06 | R1(config-if)# frame-relay map ip 123.1.1.3 103 broadcast ietf |
07 | R1(config-if)# ip add 123.1.1.1 255.255.255.0 |
10 | R1(config-if)# ip add 1.1.1.1 255.255.255.0 |
12 | R1(config-if)#router eigrp 100 |
13 | R1(config-router)# net 1.1.1.0 0.0.0.255 |
14 | R1(config-router)# net 123.1.1.0 0.0.0.255 |
R2配置:
02 | R2(config-if)# encapsulation frame-relay |
03 | R2(config-if)# no frame-relay inverse-arp |
04 | R2(config-if)# frame-relay map ip 123.1.1.1 201 broadcast ietf |
05 | R2(config-if)# frame-relay map ip 123.1.1.2 201 broadcast ietf |
06 | R2(config-if)# frame-relay map ip 123.1.1.3 201 broadcast ietf |
07 | R2(config-if)# ip add 123.1.1.2 255.255.255.0 |
10 | R2(config-if)# ip add 2.2.2.2 255.255.255.0 |
12 | R2(config-if)#router eigrp 100 |
13 | R2(config-router)# net 2.2.2.0 0.0.0.255 |
14 | R2(config-router)# net 123.1.1.0 0.0.0.255 |
R3配置:
02 | R3(config-if)# encapsulation frame-relay |
03 | R3(config-if)# no frame-relay inverse-arp |
04 | R3(config-if)# frame-relay map ip 123.1.1.1 301 broadcast ietf |
05 | R3(config-if)# frame-relay map ip 123.1.1.2 301 broadcast ietf |
06 | R3(config-if)# frame-relay map ip 123.1.1.3 301 broadcast ietf |
07 | R3(config-if)# ip add 123.1.1.3 255.255.255.0 |
10 | R3(config-if)# ip add 3.3.3.3 255.255.255.0 |
12 | R3(config-if)#router eigrp 100 |
13 | R3(config-router)# net 3.3.3.0 0.0.0.255 |
14 | R3(config-router)# net 123.1.1.0 0.0.0.255 |
配置完成後在R2上面查看路由表:
3 | D 1.0.0.0/8 [90/2297856] via 123.1.1.1, 00:00:02, Serial0/2 |
4 | 2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks |
5 | C 2.2.2.0/24 is directly connected, Loopback0 |
6 | D 2.0.0.0/8 is a summary, 00:05:45, Null0 |
7 | 123.0.0.0/8 is variably subnetted, 2 subnets, 2 masks |
8 | C 123.1.1.0/24 is directly connected, Serial0/2 |
9 | D 123.0.0.0/8 is a summary, 00:05:45, Null0 |
在這裏發現了問題,R2上面並沒有學到去往R3的迴環接口3.3.3.3的路由條目,同樣R3上面也沒有學習到R2的迴環接口的條目,這是因爲在R1的物理接口s0/0上開啓了對EIGEP的水平分隔,通過下面的命令來關閉它:
2 | R1(config-if)# no ip split-horizon eigrp 100 |
關閉之後再次查看R2的路由表,就可以學習到去往R3迴環接口的路由條目了。
b.在幀中繼子接口上運行EIGRP
R2、R3、R4配置保持不變,直接右擊R1選擇"stop",然後再次右擊R1選擇"Start"重啓這臺路由器,由於沒有保存配置,R1將恢復初始狀態,現在要在它的物理接口s0/0上配置多點子接口:
02 | R1(config-if)# encapsulation frame-relay |
03 | R1(config-if)# no frame-relay inverse-arp |
04 | R1(config-if)# no shut /*物理接口只需要打開即可*/ |
06 | R1(config)# int s 0/0.1 multipoint /*配置多點子接口*/ |
07 | R1(config-subif)# ip add 123.1.1.1 255.255.255.0 |
08 | R1(config-subif)# frame-relay map ip 123.1.1.1 102 broadcast ietf |
09 | R1(config-subif)# frame-relay map ip 123.1.1.2 102 broadcast ietf |
10 | R1(config-subif)# frame-relay map ip 123.1.1.3 103 broadcast ietf |
12 | /*多點子接口默認對EIGRP的水平分隔也是開啓的,現在關閉它*/ |
13 | R1(config-subif)# no ip split-horizon eigrp 100 |
14 | R1(config-subif)# int lo 0 |
15 | R1(config-if)# ip add 1.1.1.1 255.255.255.0 |
17 | R1(config-if)#router eigrp 100 |
18 | R1(config-router)# net 1.1.1.0 0.0.0.255 |
19 | R1(config-router)# net 123.1.1.0 0.0.0.255 |
c.在幀中繼點到點接口上運行EIGRP
R4幀中繼交換機的配置保持不變,直接右擊R1、R2、R3選擇"stop",然後再次右擊選擇"Start"重啓這幾臺路由器,將他們恢復初始狀態, 現在要在R1的物理接口s0/0上配置點到點子接口,由於多點子接口下所有對應的路由屬於同一網段,而點到點子接口,每個子接口對應了一個單獨網段,每個子接口就像一個單獨的物理接口一樣工作,所以不會出現水平分隔的問題:
R1配置:
02 | R1(config-if)# encapsulation frame-relay |
03 | R1(config-if)# no frame-relay inverse-arp |
04 | R1(config-if)# no shut /*物理接口只需要開啓*/ |
07 | R1(config-if)# int s 0/0.1 point-to-point |
08 | R1(config-subif)# ip add 12.1.1.1 255.255.255.0 |
11 | * 從封裝的DLCI號可以得知,這個點到點子接口是用來連接R2的。 |
13 | R1(config-subif)# frame-relay interface -dlci 102 |
16 | R1(config-fr-dlci)# int s 0/0.2 point-to-point |
17 | R1(config-subif)# ip add 13.1.1.1 255.255.255.0 |
18 | R1(config-subif)# frame-relay interface -dlci 103 |
20 | R1(config-fr-dlci)# int lo 0 |
21 | R1(config-if)# ip add 1.1.1.1 255.255.255.0 |
23 | R1(config-if)#router eigrp 100 |
24 | R1(config-router)# net 1.1.1.0 0.0.0.255 |
25 | R1(config-router)# net 12.1.1.0 0.0.0.255 |
26 | R1(config-router)# net 13.1.1.0 0.0.0.255 |
R2配置:
02 | R2(config-if)# ip add 12.1.1.2 255.255.255.0 |
04 | R2(config-if)# encapsulation frame-relay |
05 | R2(config-if)# no frame-relay inverse-arp |
06 | R2(config-if)# frame-relay map ip 12.1.1.1 201 broadcast ietf |
07 | R2(config-if)# frame-relay map ip 12.1.1.2 201 broadcast ietf |
09 | R2(config-if)# ip add 2.2.2.2 255.255.255.0 |
10 | R2(config-if)#router eigrp 100 |
11 | R2(config-router)# net 2.2.2.0 0.0.0.255 |
12 | R2(config-router)# net 12.1.1.0 0.0.0.255 |
R3配置:
02 | R3(config-if)# encapsulation frame-relay |
03 | R3(config-if)# no frame-relay inverse-arp |
04 | R3(config-if)# frame-relay map ip 13.1.1.3 301 broadcast ietf |
05 | R3(config-if)# frame-relay map ip 13.1.1.1 301 broadcast ietf |
06 | R3(config-if)# ip add 13.1.1.3 255.255.255.0 |
09 | R3(config-if)# ip add 3.3.3.3 255.255.255.0 |
11 | R3(config-if)#router eigrp 100 |
12 | R3(config-router)# net 3.3.3.0 0.0.0.255 |
13 | R3(config-router)# net 13.1.1.0 0.0.0.255 |
點到點子接口可以有效的避免水平分割帶來的問題,但點到點子接口會佔用更多的IP地址。