交換 路由 -路由器 -多層交換機 -核心工做表: 路由表 -路由條目 類型 prefix/mask [AD/Metric] via next-hop , interface Conneted Static RIP 路由類型: 直連路由 非直連 靜態 動態 IGP:Internal gateway protocol ,內部網關協議 目的: 在內網,快速,計算出一個去往目標網絡的,無環,最短, 數據轉發路徑; DV-distance vector ,距離矢量路由協議 RIP IGRP EIGRP LS-link state ,鏈路狀態路由協議 ISIS OSPF EGP: external gateway protocol ,外部網關協議 目的: 在網絡之間,經過BGP實現路由的靈活控制和選路,同時確保 無環; BGP
RIP 協議配置命令: 一、配置終端設備 - PC1/2 二、配置網絡設備 R1/R2/R3/R4 router rip // 啓用路由協議 RIP version 2 // 配置路由器使用 RIP 版本2 no auto-summary // 關閉 RIP 協議的自動彙總 network 192.168.10.0 network 192.168.12.0 // 以上兩個network表示的是 宣告網絡 192.168.10.0 192.168.12.0 進入 RIP 協議; 三、驗證、測試、保存 show ip protocols //顯示當前設備上正在使用的全部路由協議 show ip route // 顯示路由表 PC1/2: ping 192.168.20.1 R1/R2/R3/R4 : Route#write
在IGP協議中, network 的做用: # network 10.0.0.0 , 10.0.0.0 表示的是一個「網絡範圍」 &在設備上凡是被 10.0.0.0 表示的範圍所覆蓋住的接口,都啓用 路由協議進程: 一、能夠在該端口上發送協議報文; 二、能夠在該端口上接收協議報文; 三、能夠將該端口上的IP地址中的網絡部分,放入協議報文中; interface gi0/1 -> 192.168.34.4 255.255.255.0 interface gi0/2 -> 192.168.20.254 255.255.255.0 interface loopback 0 -> 10.10.4.4 255.255.255.0 #發包 #收包 #10.10.4.0/24 --> RIP --> 發出去; router rip network 10.10.4.0 255.255.255.0
==================================================================數據庫
RIP -定義: routing information protocol , 路由信息協議 在內網的多個路由器之間自動的學習、同步路由表, 以計算出一個去往目標網絡的最短、無環、數據轉發路徑; -場景: 通常在小規模的企業內部網絡使用 (由於RIP有最大跳數限制,最大爲 16 跳) -版本: version 1 #屬於有類路由選擇協議(報文不攜帶子網掩碼) #廣播的發送方式 - 255.255.255.255 #沒法關閉自動彙總 version 2 #屬於無類路由選擇協議(報文攜帶子網掩碼) #組播的發送方式 - 224.0.0.9 #多了一個路由標記(tag)字段,能夠實現路由的批量管理; #多了一個認證功能(使用的是RIP respone報文的第一個路由條目來充當) #多了一個 mask 字段,從而能夠支持關閉自動彙總; #多了一個 next-hop 字段,從而能夠解決「MA網絡中的」次優路徑問題; -報文: request:請求,用於向其餘RIP路由器請求更新條目; respone:響應,用於向其餘RIP路由器發送更新條目;是對request的迴應 -工做表: (RIP鄰居表): #凡是能與本身互通的路由器,都稱之爲 RIP 鄰居; RIP數據庫: #本地宣告的路由條目 #從其餘路由器學習過來的路由條目 RIP路由表: #表示的是從數據庫中挑選出來的最好的路由; -原理: 一、路由器啓用RIP之後,會將本身本地路由表中的條目進行宣告進入到RIP 二、在啓動RIP協議的端口上發送這些更新條目; 三、對方RIP路由器接收之後,通過路由比較,將最好的條目放入路由表; 四、全部的RIP路由器都會進行週期性、所有路由表更新,以廣播的方式; (在RIPv2中,是觸發式、增量更新,而且是以組播的方式) -配置 目前網絡中凡是使用 RIP 的網絡,均使用的 RIPv2 ; #思科 router rip version 2 no auto-summary network x.x.x.x (x.x.x.x必須是主類網絡的形式) #華爲 [Router]rip [id] // 若是不寫後面的id,默認是1; [Router-rip-1]version 2 // 在華爲中,啓用RIPv2之後,默認關閉了自動彙總; [Router-rip-1]network x.x.x.x -驗證 show ip protocols //查看目前正在運行的全部的路由協議; show ip rip database // 查看RIP的數據庫 show ip route rip //僅僅查看路由表中的 RIP 路由; show ip route //查看路由表; display rip [id] display rip {id} neighbor // 查看 rip id 的 鄰居表; display rip {id} database // 查看 rip id 的 數據庫; display rip {id} route // 查看 rip id 的路由表; display ip routing-table 案例: 1 案例1:RIP路由協議原理 1.1 問題 1)動態路由協議的分類有哪些? 2)RIP路由協議的最大跳數是什麼? 3)簡述水平分割的做用 1.2 步驟 實現此案例須要按照以下步驟進行。 內部和外部網關協議 內部網關路由協議(IGP):RIP、OSPF、IS-IS 外部網關路由協議(EGP):BGP 距離矢量和鏈路狀態路由協議 距離矢量路由協議:依據從源網絡到目標網絡所通過的路由器的個數選擇路由,例如RIP、IGRP 鏈路狀態路由協議:綜合考慮從源網絡到目標網絡的各條路徑的狀況選擇路由,例如OSPF、IS-IS 從一個接口學習到路由信息,再也不從這個接口發送出去 同時也能減小路由更新信息佔用的鏈路帶寬資源 2 案例2:配置RIP路由協議 2.1 問題 1)配置RIP協議實現網絡互通 2)查看路由表,驗證網絡和RIP協議正常 2.2 方案 使用eNSP搭建實驗環境,如圖-1所示。
2.3 步驟 實現此案例須要按照以下步驟進行。 步驟一:配置RIP路由協議
[R1]dis cu
[V200R003C00]
#
sysname R1
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<08bmE3Uw}%$%$<br/>local-user admin service-type http<br/>#<br/>firewall zone Local<br/>priority 15<br/>#<br/>interface GigabitEthernet0/0/0<br/>ip address 192.168.12.1 255.255.255.0 <br/>#<br/>interface GigabitEthernet0/0/1<br/>ip address 192.168.13.1 255.255.255.0 <br/>#<br/>interface GigabitEthernet0/0/2<br/>#<br/>interface NULL0<br/>#<br/>interface LoopBack0<br/>ip address 192.168.10.1 255.255.255.0 <br/>#<br/>rip 1<br/>network 192.168.12.0<br/>network 192.168.13.0<br/>network 192.168.10.0<br/>#<br/>user-interface con 0<br/>authentication-mode password<br/>user-interface vty 0 4<br/>user-interface vty 16 20<br/>#<br/>wlan ac<br/>#<br/>return<br/>[R2]dis cu<br/>[V200R003C00]<br/>#<br/>sysname R2<br/>#<br/>snmp-agent local-engineid 800007DB03000000000000<br/>snmp-agent <br/>#<br/>clock timezone China-Standard-Time minus 08:00:00<br/>#<br/>portal local-server load portalpage.zip<br/>#<br/>drop illegal-mac alarm<br/>#<br/>set cpu-usage threshold 80 restore 75<br/>#<br/>aaa <br/>authentication-scheme default<br/>authorization-scheme default<br/>accounting-scheme default<br/>domain default <br/>domain default_admin <br/>local-user admin password cipher %$%$K8m.Nt84DZ}e#<0
8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.24.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.23.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 192.168.20.1 255.255.255.0
#
rip 1
network 192.168.12.0
network 192.168.23.0
network 192.168.24.0
network 192.168.20.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[R3]dis cu
[V200R003C00]
#
sysname R3
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<08bmE3Uw}%$%$<br/>local-user admin service-type http<br/>#<br/>firewall zone Local<br/>priority 15<br/>#<br/>interface GigabitEthernet0/0/0<br/>#<br/>interface GigabitEthernet0/0/1<br/>ip address 192.168.13.3 255.255.255.0 <br/>#<br/>interface GigabitEthernet0/0/2<br/>ip address 192.168.23.3 255.255.255.0 <br/>#<br/>interface NULL0<br/>#<br/>interface LoopBack0<br/>ip address 192.168.30.1 255.255.255.0 <br/>#<br/>rip 1<br/>network 192.168.13.0<br/>network 192.168.23.0<br/>network 192.168.30.0<br/>#<br/>user-interface con 0<br/>authentication-mode password<br/>user-interface vty 0 4<br/>user-interface vty 16 20<br/>#<br/>wlan ac<br/>#<br/>return<br/>[R4]dis cu<br/>[V200R003C00]<br/>#<br/>sysname R4<br/>#<br/>snmp-agent local-engineid 800007DB03000000000000<br/>snmp-agent <br/>#<br/>clock timezone China-Standard-Time minus 08:00:00<br/>#<br/>portal local-server load portalpage.zip<br/>#<br/>drop illegal-mac alarm<br/>#<br/>set cpu-usage threshold 80 restore 75<br/>#<br/>aaa <br/>authentication-scheme default<br/>authorization-scheme default<br/>accounting-scheme default<br/>domain default <br/>domain default_admin <br/>local-user admin password cipher %$%$K8m.Nt84DZ}e#<0
8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
ip address 192.168.24.4 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 192.168.40.1 255.255.255.0
#
rip 1
network 192.168.24.0
network 192.168.40.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
步驟二:查看路由表,驗證全網互通網絡
Routing Tables: Public
Destinations : 16 Routes : 16
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 RIP 100 2 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.12.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.13.0/24 RIP 100 2 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.20.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.23.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.24.0/24 Direct 0 0 D 192.168.24.4 GigabitEthernet
0/0/1
192.168.24.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.24.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.30.0/24 RIP 100 2 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.40.0/24 Direct 0 0 D 192.168.40.1 LoopBack0
192.168.40.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.40.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
3 案例3:驗證RIP v1和v2
3.1 問題
分別配置RIP v1和v2
查看路由表,驗證網絡通訊是否正常
3.2 方案
使用eNSP搭建實驗環境,如圖-2所示。less
3.3 步驟
實現此案例須要按照以下步驟進行。dom
步驟一:配置RIP v1ide
[R1]dis cu
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<08bmE3Uw}%$%$<br/>local-user admin service-type http<br/>#<br/>firewall zone Local<br/>priority 15<br/>#<br/>interface GigabitEthernet0/0/0<br/>ip address 192.168.1.1 255.255.255.0 <br/>#<br/>interface GigabitEthernet0/0/1<br/>#<br/>interface GigabitEthernet0/0/2<br/>#<br/>interface NULL0<br/>#<br/>interface LoopBack0<br/>ip address 10.1.1.1 255.255.255.0 <br/>#<br/>rip 1<br/>network 192.168.1.0<br/>network 10.0.0.0<br/>#<br/>user-interface con 0<br/>authentication-mode password<br/>user-interface vty 0 4<br/>user-interface vty 16 20<br/>#<br/>wlan ac<br/>#<br/>return<br/>[R2]dis cu<br/>[V200R003C00]<br/>#<br/>snmp-agent local-engineid 800007DB03000000000000<br/>snmp-agent <br/>#<br/>clock timezone China-Standard-Time minus 08:00:00<br/>#<br/>portal local-server load portalpage.zip<br/>#<br/>drop illegal-mac alarm<br/>#<br/>set cpu-usage threshold 80 restore 75<br/>#<br/>aaa <br/>authentication-scheme default<br/>authorization-scheme default<br/>accounting-scheme default<br/>domain default <br/>domain default_admin <br/>local-user admin password cipher %$%$K8m.Nt84DZ}e#<0
8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
rip 1
network 192.168.1.0
network 192.168.2.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[R3]dis cu
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
ip address 192.168.2.3 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 10.1.2.1 255.255.255.0
#
rip 1
network 192.168.2.0
network 10.0.0.0
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
2)查看路由表,驗證網絡通訊是否正常oop
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.2.0/24 Direct 0 0 D 10.1.2.1 LoopBack0
10.1.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 RIP 100 1 D 192.168.2.2 GigabitEthernet
0/0/1
192.168.2.0/24 Direct 0 0 D 192.168.2.3 GigabitEthernet
0/0/1
192.168.2.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
在R1上ping不通10.1.2.1。學習
步驟二:配置RIP v2測試
[R1]rip
[R1-rip-1]version 2
R二、R3均作一樣配置。ui
2)查看路由表,驗證網絡通訊是否正常spa
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 RIP 100 2 D 192.168.2.2 GigabitEthernet
0/0/1
10.1.2.0/24 Direct 0 0 D 10.1.2.1 LoopBack0
10.1.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.2.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 RIP 100 1 D 192.168.2.2 GigabitEthernet
0/0/1
192.168.2.0/24 Direct 0 0 D 192.168.2.3 GigabitEthernet
0/0/1
192.168.2.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
在R1上能夠ping通10.1.2.1。
4 案例4:Cisco路由器配置RIP v1和v2
4.1 問題
1)分別配置RIP v1和v2
2)查看路由表,驗證網絡通訊是否正常
4.2 方案
使用Cisco Packet Tracer 搭建實驗環境,如圖-3所示。
4.3 步驟
實現此案例須要按照以下步驟進行。
步驟一:配置RIP v1
R1#sh run
Building configuration...
Current configuration : 669 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface Loopback0
ip address 10.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
router rip
network 10.0.0.0
network 192.168.1.0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
R2#sh run
Building configuration...
Current configuration : 628 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.2 255.255.255.0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router rip
network 192.168.1.0
network 192.168.2.0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
R3#sh run
Building configuration...
Current configuration : 669 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R3
!
ip cef
no ipv6 cef
!
spanning-tree mode pvst
!
interface Loopback0
ip address 10.1.2.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
ip address 192.168.2.3 255.255.255.0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router rip
network 10.0.0.0
network 192.168.2.0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
2)查看路由表,驗證網絡通訊是否正常
R1#sh ip ro
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
步驟二:配置RIP v2
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R二、R3均作一樣配置。
2)查看路由表,驗證網絡通訊是否正常
R1#sh ip ro
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