主動路由協定

在網際網路中傳送路由更新包的協定叫做主動路由協定。在每台機器上,路由更新包用來維護和構建路由表。主動路由協定包括RIP協定、IGRP協定、OSPF協定等。

基本介紹

  • 中文名:主動路由協定
  • 組成:RIP協定、IGRP協定、OSPF協定
協定詳解,訪問控制,

協定詳解

一、RIP協定
RIP(Routing information Protocol)是套用較早、使用較普遍的內部網關協定(Interior Gateway Protocol,簡稱IGP),適用於小型同類網路,是典型的距離向量(distance-vector)協定。文檔見RFC1058、RFC1723。
RIP通過廣播UDP報文來交換路由信息,每30秒傳送一次路由信息更新。RIP提供跳躍計數(hop count)作為尺度來衡量路由距離,跳躍計數是一個包到達目標所必須經過的路由器的數目。如果到相同目標有二個不等速或不同頻寬的路由器,但跳躍計數相同,則RIP認為兩個路由是等距離的。RIP最多支持的跳數為15,即在源和目的網間所要經過的最多路由器的數目為15,跳數16表示不可達。
1. 有關命令
任務 命令
指定使用RIP協定 router rip
指定RIP版本 version {1|2}1
指定與該路由器相連的網路
network network
註:
1.Cisco的RIP版本2支持驗證、密鑰管理、路由匯總、無類域間路由(CIDR)和變長子網掩碼(VLSMs)
2. 舉例
Router1:
router rip
version 2
network 192.200.10.0
network 192.20.10.0
!
相關調試命令:
show ip protocol
show ip route
二、IGRP協定
IGRP (Interior Gateway Routing Protocol)是一種動態距離向量路由協定,它由Cisco公司八十年代中期設計。使用組合用戶配置尺度,包括延遲、頻寬、可靠性和負載。
預設情況攏琁GRP每90秒傳送一次路由更新廣播,在3個更新周期內(即270秒),沒有從路由中的第一個路由器接收到更新,則宣布路由不可訪問。在7個更新周期即630秒後,Cisco IOS 軟體從路由表中清除路由。
1. 有關命令
任務 命令
指定使用RIP協定 router igrp autonomous-system1
指定與該路由器相連的網路
network network
指定與該路由器相鄰的節點地址
neighbor ip-address
註:
1、autonomous-system可以隨意建立,並非實際意義上的autonomous-system,但運行IGRP的路由器要想交換路由更新信息其autonomous-system需相同。
2.舉例
Router1:
router igrp 200
network 192.200.10.0
network 192.20.10.0
!
三、OSPF協定
OSPF(Open Shortest Path First)是一個內部網關協定(Interior Gateway Protocol,簡稱IGP),用於在單一自治系統(autonomous system,AS)內決策路由。與RIP相對,OSPF是鏈路狀態路有協定,而RIP是距離向量路由協定
鏈路是路由器接口的另一種說法,因此OSPF也稱為接口狀態路由協定。OSPF通過路由器之間通告網路接口的狀態來建立鏈路狀態資料庫,生成最短路徑樹,每個OSPF路由器使用這些最短路徑構造路由表
1.有關命令
全局設定
任務 命令
指定使用OSPF協定 router ospf process-id1
指定與該路由器相連的網路
network address wildcard-mask area area-id2
指定與該路由器相鄰的節點地址
neighbor ip-address
註:
1、OSPF路由進程process-id必須指定範圍在1-65535,多個OSPF進程可以在同一個路由器上配置,但最好不這樣做。多個OSPF進程需要多個OSPF資料庫的副本,必須運行多個最短路徑算法的副本。process-id只在路由器內部起作用,不同路由器的process-id可以不同。
2、wildcard-mask 是子網掩碼的反碼, 網路區域ID area-id在0-4294967295內的十進制數,也可以是帶有IP位址格式的x.x.x.x。當網路區域ID為0或0.0.0.0時為主幹域。不同網路區域的路由器通過主幹域學習路由信息。
基本配置舉例:
Router1:
interface ethernet 0
ip address 192.1.0.129 255.255.255.192
!
interface serial 0
ip address 192.200.10.5 255.255.255.252
!
router ospf 100
network 192.200.10.4 0.0.0.3 area 0
network 192.1.0.128 0.0.0.63 area 1
!
Router2:
interface ethernet 0
ip address 192.1.0.65 255.255.255.192
!
interface serial 0
ip address 192.200.10.6 255.255.255.252
!
router ospf 200
network 192.200.10.4 0.0.0.3 area 0
network 192.1.0.64 0.0.0.63 area 2
!
Router3:
interface ethernet 0
ip address 192.1.0.130 255.255.255.192
!
router ospf 300
network 192.1.0.128 0.0.0.63 area 1
!
Router4:
interface ethernet 0
ip address 192.1.0.66 255.255.255.192
!
router ospf 400
network 192.1.0.64 0.0.0.63 area 1
!
相關調試命令:
debug ip ospf events
debug ip ospf packet
show ip ospf
show ip ospf database
show ip ospf interface
show ip ospf neighbor
show ip route
3. 使用身份驗證
為了安全的原因,我們可以在相同OSPF區域的路由器上啟用身份驗證的功能,只有經過身份驗證的同一區域的路由器才能互相通告路由信息。
在默認情況下OSPF不使用區域驗證。通過兩種方法可啟用身份驗證功能,純文本身份驗證和訊息摘要(md5)身份驗證。純文本身份驗證傳送的身份驗證口令為純文本,它會被網路探測器確定,所以不安全,不建議使用。而訊息摘要(md5)身份驗證在傳輸身份驗證口令前,要對口令進行加密,所以一般建議使用此種方法進行身份驗證。
使用身份驗證時,區域內所有的路由器接口必須使用相同的身份驗證方法。為起用身份驗證,必須在路由器接口配置模式下,為區域的每個路由器接口配置口令。
任務 命令
指定身份驗證 area area-id authentication [message-digest]
使用純文本身份驗證
ip ospf authentication-key password
使用訊息摘要(md5)身份驗證
ip ospf message-digest-key keyid md5 key
以下列舉兩種驗證設定的示例,示例的網路分布及地址分配環境與以上基本配置舉例相同,只是在Router1蚏outer2的區域0上使用了身份驗證的功能。
例1.使用純文本身份驗證
Router1:
interface ethernet 0
ip address 192.1.0.129 255.255.255.192
!
interface serial 0
ip address 192.200.10.5 255.255.255.252
ip ospf authentication-key cisco
!
router ospf 100
network 192.200.10.4 0.0.0.3 area 0
network 192.1.0.128 0.0.0.63 area 1
area 0 authentication
!
Router2:
interface ethernet 0
ip address 192.1.0.65 255.255.255.192
!
interface serial 0
ip address 192.200.10.6 255.255.255.252
ip ospf authentication-key cisco
!
router ospf 200
network 192.200.10.4 0.0.0.3 area 0
network 192.1.0.64 0.0.0.63 area 2
area 0 authentication
!
Router1:
interface ethernet 0
ip address 192.1.0.129 255.255.255.192
!
interface serial 0
ip address 192.200.10.5 255.255.255.252
ip ospf message-digest-key 1 md5 cisco
!
router ospf 100
network 192.200.10.4 0.0.0.3 area 0
network 192.1.0.128 0.0.0.63 area 1
area 0 authentication message-digest
!
Router2:
interface ethernet 0
ip address 192.1.0.65 255.255.255.192
!
interface serial 0
ip address 192.200.10.6 255.255.255.252
ip ospf message-digest-key 1 md5 cisco
!
router ospf 200
network 192.200.10.4 0.0.0.3 area 0
network 192.1.0.64 0.0.0.63 area 2
area 0 authentication message-digest
!
相關調試命令:
debug ip ospf adj
debug ip ospf events
四、重新分配路由
在實際工作中,我們會遇到使用多個IP路由協定的網路。為了使整個網路正常地工作,必須在多個路由協定之間進行成功的路由再分配
以下列舉了OSPF與RIP之間重新分配路由的設定範例:
Router1的Serial 0連線埠和Router2的Serial 0連線埠運行OSPF,在Router1的Ethernet 0連線埠運行RIP 2,Router3運行RIP2,Router2有指向Router4的192.168.2.0/24網的靜態路由,Router4使用默認靜態路由。需要在Router1和Router3之間重新分配OSPF和RIP路由,在Router2上重新分配靜態路由和直連的路由。
範例所涉及的命令
任務 命令
重新分配直連的路由 redistribute connected
重新分配靜態路由 redistribute static
重新分配ospf路由 redistribute ospf process-id metric metric-value
重新分配rip路由 redistribute rip metric metric-value
Router1:
interface ethernet 0
ip address 192.168.1.1 255.255.255.0
!
interface serial 0
ip address 192.200.10.5 255.255.255.252
!
router ospf 100
redistribute rip metric 10
network 192.200.10.4 0.0.0.3 area 0
!
router rip
version 2
redistribute ospf 100 metric 1
network 192.168.1.0
!
Router2:
interface loopback 1
ip address 192.168.3.2 255.255.255.0
!
interface ethernet 0
ip address 192.168.0.2 255.255.255.0
!
interface serial 0
ip address 192.200.10.6 255.255.255.252
!
router ospf 200
redistribute connected subnet
redistribute static subnet
network 192.200.10.4 0.0.0.3 area 0
!
ip route 192.168.2.0 255.255.255.0 192.168.0.1
!
Router3:
interface ethernet 0
ip address 192.168.1.2 255.255.255.0
!
router rip
version 2
network 192.168.1.0
!
Router4:
interface ethernet 0
ip address 192.168.0.1 255.255.255.0
!
interface ethernet 1
ip address 192.168.2.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.0.2
!
五、IPX協定設定
IPX協定與IP協定是兩種不同的網路層協定,它們的路由協定也不一樣,IPX的路由協定不象IP的路由協定那樣豐富,所以設定起來比較簡單。但IPX協定在乙太網上運行時必須指定封裝形式。
1. 有關命令
啟動IPX路由 ipx routing
設定IPX網路及乙太網封裝形式 ipx network network [encapsulation encapsulation-type]1
指定路由協定,默認為RIP ipx router {eigrp autonomous-system-number | nlsp [tag] | rip}
註:1.network 範圍是1 到FFFFFFFD. IPX封裝類型列表
接口類型 封裝類型 IPX幀類型
Ethernet novell-ether (默認) arpa sap snap
Ethernet_802.3 Ethernet_II Ethernet_802.2 Ethernet_Snap
Token Ring sap (默認) snap Token-Ring
Token-Ring_Snap
FDDI snap (默認) sap novell-fddi Fddi_Snap
Fddi_802.2 Fddi_Raw
舉例:
在此例中,WAN的IPX網路為3a00,Router1所連線的區域網路IPX網路號為2a00,在此區域網路有一台Novell伺服器,IPX網路號也是2a00, 路由器接口的IPX網路號必須與在同一網路的Novell伺服器上設定的IPX網路號相同。路由器通過監聽SAP來建立已知的服務及自己的網路地址表,並每60秒傳送一次自己的SAP表。
Router1:
ipx routing
interface ethernet 0
ipx network 2a00 encapsulation sap
!
interface serial 0
ipx network 3a00
!
ipx router eigrp 10
network 3a00
network 2a00
!
Router2:
ipx routing
interface ethernet 0
ipx network 2b00 encapsulation sap
!
interface serial 0
ipx network 3a00
!
ipx router eigrp 10
network 2b00
network 3a00
!
相關調試命令:
debug ipx packet
debug ipx routing
debug ipx sap
debug ipx spoof
debug ipx spx
show ipx eigrp interfaces
show ipx eigrp neighbors
show ipx eigrp topology
show ipx interface
show ipx route
show ipx servers
show ipx spx-spoof

訪問控制

一、協定優先權設定
1.有關命令
任務 命令
設定優先權表項目 priority-list list-number protocol
protocol {high | medium | normal | low} queue-keyword
keyword-value
使用指定的優先權表 priority-group list-number
2.舉例
Router1:
priority-list 1 protocol ip high tcp telnet
priority-list 1 protocol ip low tcp ftp
priority-list 1 default normal
interface serial 0
priority-group 1
二、佇列定製
1.有關命令
任務 命令
設定佇列表中包含協定 queue-list list-number protocol protocol-name queue-number queue-keyword keyword-value
設定佇列表中佇列的大小 queue-list list-number queue queue-number byte-count byte-count-number
使用指定的佇列表 custom-queue-list list
2.舉例
Router1:
queue-list 1 protocol ip 0 tcp telnet
queue-list 1 protocol ip 1 tcp www
queue-list 1 protocol ip 2 tcp ftp
queue-list 1 queue 0 byte-count 300
queue-list 1 queue 1 byte-count 200
queue-list 1 queue 2 byte-count 100
interface serial 0
custom-queue-list 1
1.有關命令
任務 命令
設定訪問表項目 access-list list {permit | deny} address mask
設定佇列表中佇列的大小 queue-list list-number queue queue-number byte-count byte-count-number
使用指定的訪問表 ip access-group list {in | out}
2.舉例
Router1:
access-list 1 deny 192.1.3.0 0.0.0.255
access-list 1 permit any
interface serial 0
ip access-group 1 in

相關詞條

熱門詞條

聯絡我們