日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
部署路由器OSPF動態(tài)路由具體方法

路由協(xié)議OSPF全稱為Open Shortest Path First,也就開放的最短路徑優(yōu)先協(xié)議,因為OSPF是由IETF開發(fā)的,它的使用不受任何廠商限制,所有人都可以使用,所以稱為開放的,而最短路徑優(yōu)先(SPF)只是OSPF的核心思想,其使用的算法是Dijkstra算法,最短路徑優(yōu)先并沒有太多特殊的含義,并沒有任何一個路由協(xié)議是最長路徑優(yōu)先的,所有協(xié)議,都會選最短的。

創(chuàng)新互聯(lián)是一家專注于網(wǎng)站設(shè)計、網(wǎng)站建設(shè)與策劃設(shè)計,東西湖網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:東西湖等地區(qū)。東西湖做網(wǎng)站價格咨詢:18980820575

實驗?zāi)康?/h4>

掌握 OSPF 協(xié)議的配置方法 掌握查看通過動態(tài)路由協(xié)議 OSPF 學(xué)習(xí)產(chǎn)生的路由 熟悉廣域網(wǎng)線纜的鏈接方式

實驗背景

假設(shè)校園網(wǎng)通過一臺三層交換機連到校園網(wǎng)出口路由器上,路由器再和校園外的另一臺路由器連接?,F(xiàn)要做適當(dāng)配置,實現(xiàn)校園網(wǎng)內(nèi)部主機與校園網(wǎng)外部主機之間的相互通信。為了簡化網(wǎng)管的管理維護工作,學(xué)校決定采用 OSPF 協(xié)議實現(xiàn)互通。

技術(shù)原理

OSPF(Open Shortest Path First) 開放式最短路徑優(yōu)先協(xié)議,是目前網(wǎng)路中應(yīng)用最廣泛的路由協(xié)議之一。屬于內(nèi)部網(wǎng)關(guān)路由協(xié)議,能夠適應(yīng)各種規(guī)模的網(wǎng)絡(luò)環(huán)境,是典型的鏈路狀態(tài)協(xié)議。OSPF路由協(xié)議通過向全網(wǎng)擴散本設(shè)備的鏈路狀態(tài)信息,使網(wǎng)絡(luò)中每臺設(shè)備最終同步一個具有全網(wǎng)鏈路狀態(tài)的數(shù)據(jù)庫,然后路由器采用 SPF 算法,以自己為根,計算到達其他網(wǎng)絡(luò)的最短路徑,最終形成全網(wǎng)路由信息。

OSPF(Open Shortest Path First)是一個內(nèi)部網(wǎng)關(guān)協(xié)議(Interior Gateway Protocol,簡稱IGP)。與RIP相對,OSPF是鏈路狀態(tài)路由協(xié)議,而RIP是距離向量路由協(xié)議。 鏈路是路由器接口的另一種說法,因此OSPF也稱為接口狀態(tài)路由協(xié)議。OSPF通過路由器之間通告網(wǎng)絡(luò)接口的狀態(tài)來建立鏈路狀態(tài)數(shù)據(jù)庫,生成最短路徑樹,每個OSPF路由器使用這些最短路徑構(gòu)造路由表。

基本概念和術(shù)語

鏈路狀態(tài)

OSPF路由器收集其所在網(wǎng)絡(luò)區(qū)域上各路由器的連接狀態(tài)信息,即鏈路狀態(tài)信息(Link-State),生成鏈路狀態(tài)數(shù)據(jù)庫(Link-State Database)。路由器掌握了該區(qū)域上所有路由器的鏈路狀態(tài)信息,也就等于了解了整個網(wǎng)絡(luò)的拓撲狀況。OSPF路由器利用“最短路徑優(yōu)先算法(Shortest Path First, SPF)”,獨立地計算出到達任意目的地的路由。

區(qū)域

OSPF協(xié)議引入“分層路由”的概念,將網(wǎng)絡(luò)分割成一個“主干”連接的一組相互獨立的部分,這些相互獨立的部分被稱為“區(qū)域”(Area),“主干”的部分稱為“主干區(qū)域”。每個區(qū)域就如同一個獨立的網(wǎng)絡(luò),該區(qū)域的OSPF路由器只保存該區(qū)域的鏈路狀態(tài)。每個路由器的鏈路狀態(tài)數(shù)據(jù)庫都可以保持合理的大小,路由計算的時間、報文數(shù)量都不會過大。

共有五種區(qū)域的主要區(qū)別在于它們和外部路由器間的關(guān)系:

標準區(qū)域: 一個標準區(qū)域可以接收鏈路更新信息和路由總結(jié)。

主干區(qū)域(傳遞區(qū)域):主干區(qū)域是連接各個區(qū)域的中心實體。主干區(qū)域始終是“區(qū)域0”,所有其他的區(qū)域都要連接到這個區(qū)域上交換路由信息。主干區(qū)域擁有標準區(qū)域的所有性質(zhì)。

存根區(qū)域(stub Area):存根區(qū)域是不接受自治系統(tǒng)以外的路由信息的區(qū)域。如果需要自治系統(tǒng)以外的路由,它使用默認路由0.0.0.0。

完全存根區(qū)域:它不接受外部自治系統(tǒng)的路由以及自治系統(tǒng)內(nèi)其他區(qū)域的路由總結(jié)。需要發(fā)送到區(qū)域外的報文則使用默認路由:0.0.0.0。完全存根區(qū)域是Cisco自己定義的。

不完全存根區(qū)域(NSAA): 它類似于存根區(qū)域,但是允許接收以LSA Type 7發(fā)送的外部路由信息,并且要把LSA Type 7轉(zhuǎn)換成LSA Type 5。

度量值cost(鏈路開銷)

OSPF的度量值cost(鏈路開銷)它是根據(jù)鏈路帶寬算出來的?;旧鲜呛玩溌穾挸煞幢?。也就是說帶寬越大,開銷值越小,鏈路越優(yōu)。計算公式為: 接口開銷=參考帶寬/邏輯帶寬 (邏輯帶寬通常配置和物理接口帶寬相同) OSPF先將鏈路每段的開銷分別計算,然后計算從當(dāng)前節(jié)點到達任意目標地址的網(wǎng)絡(luò)開銷,即多段鏈路累加。選出到達目標網(wǎng)絡(luò)開銷最小的路徑,為最佳路徑。 ospf接口開銷有默認的參考值,即接口帶寬默認為100Mbps,如果實際帶寬值為10M,那么該接口的cost=100/10=10,如果該接口實際帶寬為100Mpbs那么接口開銷為cost=100/100=1 。但現(xiàn)在的網(wǎng)絡(luò)已經(jīng)進入1000M時代,就會出現(xiàn)100M和1000M的帶寬在ospf中得到的開銷相同都是1。所以如果實際應(yīng)用中如果接口帶寬值較高時應(yīng)該重新配置端口的參考帶寬值。

O 192.168.4.0/24 [110/65] via 192.168.3.2, 00:01:00, Vlan20 O 路由協(xié)議代碼:O表示OSPF,R代表RIP,S代表靜態(tài),使用show命令的時候,在最上方有說明。 192.168.4.0/24 分別是目標網(wǎng)絡(luò)和目標網(wǎng)絡(luò)的掩碼 [110/65] 分別表示管理距離和度量值。

管理距離

管理距離是用來比較不同路由協(xié)議的優(yōu)劣的,如這臺路由器同時啟用了RIP和OSPF兩種動態(tài)路由協(xié)議,都會得出到達192.168.4.0/24的網(wǎng)絡(luò)路徑,但是那種路由協(xié)議的結(jié)果會被記錄到路由表中呢?就是通過管理距離比較算法的優(yōu)劣。管理距離的值越小,路由器認為該協(xié)議的算法越好,計算結(jié)果越準確,優(yōu)先采用該協(xié)議的結(jié)果。

常見路由協(xié)議的管理距離有: 直連路由 0 靜態(tài)路由 1 EIGRP匯總路由 5 EBGP 20 EIGRP 90 IGRP 100 OSPF 110 IS-IS 115 RIP(v1&v2) 120 EGP 140 ODR 160 ExEIGRP (外部EIGRP) 170 IBGP 200 未知 255

度量值是用來衡量同一種路由協(xié)議計算到達相同目標地址的多條路徑的優(yōu)劣的參數(shù)。度量值最小的會被記錄到路由表。比如:OSPF計算到達192.168.4.0/24網(wǎng)絡(luò)有三條路徑開銷值分別是:145 ,230 和99,比較后發(fā)現(xiàn)99的這條路徑度量值最小,會被認為是最佳路徑,加入到路由表。常用來作為度量值的參考因素有: 跳數(shù)、帶寬、延遲、可靠性、負載、MTU等。 不同的路由協(xié)議用來作為度量值的參數(shù)是不同的,有的是一種,有的是多種。如RIP使用跳數(shù)做度量值,EIGRP默認使用帶寬和延遲兩種,最多可以使用五種。OSPF使用cost(開銷)作為度量值,cost和端口的帶寬相關(guān),基本上是和端口帶寬成反比,即端口帶寬越大,開銷越小,鏈路越優(yōu)。 via 192.168.3.2 表示下一跳地址。即到達192.168.4.0網(wǎng)絡(luò)首先要到達192.168.3.2才可以。另外via也可以理解為:更新源,即該路由消息是來自于誰。 00:01:00 該消息的更新時間。 Vlan20 出接口,表示到達目標網(wǎng)絡(luò)應(yīng)該從自己的那個接口將數(shù)據(jù)發(fā)出。

**路由表的五要素:

目標地址 目標網(wǎng)絡(luò)掩碼 優(yōu)先級(度量值和管理距離) 下一跳地址 出接口**

實驗步驟

新建 packet tracer 拓撲圖

(1)在本實驗中的三層交換機上劃分 VLAN10 和 VLAN20,其中 VLAN10 用于 連接校園網(wǎng)主機,VLAN20 用于連接 R1 (2)路由器之間通過 V35 電纜通過串口連接,DCE 端連接在 R1 上,配置其時鐘 頻率 64000 (3)主機和交換機通過直連線,主機與路由器通過交叉線連接 (4)在 S3560 上配置 OSPF 路由協(xié)議 (5)在路由器 R1、R2 上配置 OSPF 路由協(xié)議 (6)將 PC1、PC2 主機默認網(wǎng)關(guān)設(shè)置為與直連網(wǎng)路設(shè)備接口 IP 地址 (7)驗證 PC1、PC2 主機之間可以互相同信

實驗設(shè)備

PC 2 臺;Switch_3560 1 臺;Router-PT 2 臺;直連線;交叉線;DCE 串口線

PC1
IP: 192.168.1.2
Submask: 255.255.255.0
Gateway: 192.168.1.1

PC2
IP: 192.168.2.2
Submask: 255.255.255.0
Gateway: 192.168.2.1

S3560

en
conf t
hostname S3560
vlan 10
exit
vlan 20
exit
interface fa 0/10
switchport access vlan 10
exit
int fa 0/20
switchport access valn 20
exit
interface vlan 10
ip address 192.168.1.1 255.255.255.0

no shutdown
exit
interface vlan 20
ip address 192.168.3.1 255.255.255.0
no shutdown
end
show ip route
conf t
router ospf 1 #指定ospf的進程號為1
network 192.168.1.0 0.0.0.255 area 0 #宣告192.168.1.0網(wǎng)段反掩碼為0.0.0.255  區(qū)域為骨干區(qū)域area 0
network 192.168.3.0 0.0.0.255 area 0
end
show ip route

R1
en
conf t
hostname R1
interface fa 0/0
no shutdown
ip address 192.168.3.2 255.255.255.0
exit
interface serial 2/0
no shutdown
clock rate 64000
ip address 192.168.4.1 255.255.255.0
end
show ip route
conf t
router ospf 1
network 192.168.3.0 0.0.0.255 area 0
network 192.168.4.0 0.0.0.255 area 0
end
show ip route

R2
en
conf t
hostname R2
interface fa 0/0
no shutdown
ip address 192.168.2.1 255.255.255.0

exit
interface serial 2/0
no shutdown
ip address 192.168.4.2 255.255.255.0
end
show ip route
conf t
router ospf 1
network 192.168.2.0 0.0.0.255 area 0
network 192.168.4.0 0.0.0.255 area 0
end
show ip route

實戰(zhàn)演練

S3560

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname
% Incomplete command.
Switch(config)#hostname S3560
S3560(config)#vlan 10
S3560(config-vlan)#exit
S3560(config)#vlan 20
S3560(config-vlan)#int fa 0/10
S3560(config-if)#sw acc vlan 10
S3560(config-if)#exit
S3560(config)#int fa 0/20
S3560(config-if)#sw acc vlan 20
S3560(config-if)#exit
S3560(config)#int vlan 10

%LINK-5-CHANGED: Interface Vlan10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
S3560(config-if)#ip address 192.168.1.1 255.255.255.0
S3560(config-if)#no shut
S3560(config-if)#exit
S3560(config)#int vlan 20
S3560(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up

S3560(config-if)#ip address 192.168.3.1 255.255.255.0
S3560(config-if)#no shut
S3560(config-if)#end
S3560#
%SYS-5-CONFIG_I: Configured from console by console

S3560#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

C    192.168.1.0/24 is directly connected, Vlan10
S3560#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
S3560(config)#router ospf 1
S3560(config-router)#network 192.168.1.0 0.0.0.255 area 0
S3560(config-router)#network 192.168.3.0 0.0.0.255 area 0
S3560(config-router)#
S3560(config-router)#end
S3560#
%SYS-5-CONFIG_I: Configured from console by console

S3560#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

C    192.168.1.0/24 is directly connected, Vlan10
S3560#
%LINK-5-CHANGED: Interface FastEthernet0/20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

00:12:29: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.4.1 on Vlan20 from LOADING to FULL, Loading Done

R1

Continue with configuration dialog? [yes/no]: n


Press RETURN to get started!



Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#int fa 0/0
R1(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R1(config-if)#ip address 192.168.3.2 255.255.255.0
R1(config-if)#exit
R1(config)#
R1(config)#int serial 2/0
R1(config-if)#no shut

%LINK-5-CHANGED: Interface Serial2/0, changed state to down
R1(config-if)#clock rate 64000
R1(config-if)#ip address 192.168.4.1 255.255.255.0
R1(config-if)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console

R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

C    192.168.3.0/24 is directly connected, FastEthernet0/0
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#network 192.168.3.0 0.0.0.255 area 0
R1(config-router)#network 192.168.4.0 0.0.0.255 area 0
R1(config-router)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console

R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

O    192.168.1.0/24 [110/2] via 192.168.3.1, 00:00:23, FastEthernet0/0
C    192.168.3.0/24 is directly connected, FastEthernet0/0
R1#

R2

Router>en
Router#
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R2
R2(config)#int fa 0/0
R2(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R2(config-if)#ip address 192.168.2.1 255.255.255.0
R2(config-if)#exit
R2(config)#
R2(config)#int serial 2/0
R2(config-if)#no shut

%LINK-5-CHANGED: Interface Serial2/0, changed state to up

R2(config-if)#ip add
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up

% Incomplete command.
R2(config-if)#ip add 192.168.4.2 255.255.255.0
R2(config-if)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console

R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

C    192.168.2.0/24 is directly connected, FastEthernet0/0
C    192.168.4.0/24 is directly connected, Serial2/0
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router ospf 1
R2(config-router)#
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
R2(config-router)#network 192.168.4.0 0.0.0.255 area 0
R2(config-router)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console

R2#
00:14:52: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.4.1 on Serial2/0 from LOADING to FULL, Loading Done

R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

O    192.168.1.0/24 [110/66] via 192.168.4.1, 00:00:03, Serial2/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
O    192.168.3.0/24 [110/65] via 192.168.4.1, 00:00:03, Serial2/0
C    192.168.4.0/24 is directly connected, Serial2/0
R2#

測試

PC>ipconfig

IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1

PC>ping 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.2.2:
   Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

PC>


ping 不通,查看三層交換機的路由表信息并開啟路由轉(zhuǎn)發(fā)功能

S3560#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
      i - IS-IS, 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

C    192.168.1.0/24 is directly connected, Vlan10
O    192.168.2.0/24 [110/66] via 192.168.3.2, 00:04:27, Vlan20
C    192.168.3.0/24 is directly connected, Vlan20
O    192.168.4.0/24 [110/65] via 192.168.3.2, 00:05:43, Vlan20
S3560#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
S3560(config)#
S3560(config)#ip routing
S3560(config)#

再次觀察測試情況
PC>ping -t 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.2.2: bytes=32 time=18ms TTL=125
Reply from 192.168.2.2: bytes=32 time=23ms TTL=125
Reply from 192.168.2.2: bytes=32 time=19ms TTL=125
Reply from 192.168.2.2: bytes=32 time=22ms TTL=125
Reply from 192.168.2.2: bytes=32 time=20ms TTL=125
Reply from 192.168.2.2: bytes=32 time=21ms TTL=125
Reply from 192.168.2.2: bytes=32 time=18ms TTL=125

標題名稱:部署路由器OSPF動態(tài)路由具體方法
網(wǎng)址分享:http://www.dlmjj.cn/article/dpjjejc.html