1. 程式人生 > >筆記 RIP

筆記 RIP

RIP

交換
路由
-路由器
-多層交換機
-核心工作表:
路由表
-路由條目
類型 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 協議配置命令:

1、配置終端設備 - PC1/2

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 協議;

3、驗證、測試、保存

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 表示的範圍所覆蓋住的接口,都啟用
       路由協議進程:
           1、可以在該端口上發送協議報文;
           2、可以在該端口上接收協議報文;
           3、可以將該端口上的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路由表:
#表示的是從數據庫中挑選出來的最好的路由;
-原理:
1、路由器啟用RIP以後,會將自己本地路由表中的條目進行宣告進入到RIP
2、在啟動RIP協議的端口上發送這些更新條目;
3、對方RIP路由器接收以後,經過路由比較,將最好的條目放入路由表;
4、所有的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#&lt;08bmE3Uw}%$%$
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#&lt;08bmE3Uw}%$%$
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
步驟二:查看路由表,驗證全網互通

[R1]dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 18 Routes : 19
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 Direct 0 0 D 192.168.10.1 LoopBack0
192.168.10.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.10.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.12.0/24 Direct 0 0 D 192.168.12.1 GigabitEthernet
0/0/0
192.168.12.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.13.0/24 Direct 0 0 D 192.168.13.1 GigabitEthernet
0/0/1
192.168.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.20.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.23.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet
0/0/0
RIP 100 1 D 192.168.13.3 GigabitEthernet
0/0/1
192.168.24.0/24 RIP 100 1 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.30.0/24 RIP 100 1 D 192.168.13.3 GigabitEthernet
0/0/1
192.168.40.0/24 RIP 100 2 D 192.168.12.2 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 20 Routes : 21
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 1 D 192.168.12.1 GigabitEthernet
0/0/0
192.168.12.0/24 Direct 0 0 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.12.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.13.0/24 RIP 100 1 D 192.168.12.1 GigabitEthernet
0/0/0
RIP 100 1 D 192.168.23.3 GigabitEthernet
0/0/2
192.168.20.0/24 Direct 0 0 D 192.168.20.1 LoopBack0
192.168.20.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.20.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.23.0/24 Direct 0 0 D 192.168.23.2 GigabitEthernet
0/0/2
192.168.23.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.24.0/24 Direct 0 0 D 192.168.24.2 GigabitEthernet
0/0/1
192.168.24.2/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 1 D 192.168.23.3 GigabitEthernet
0/0/2
192.168.40.0/24 RIP 100 1 D 192.168.24.4 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 18 Routes : 19
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 1 D 192.168.13.1 GigabitEthernet
0/0/1
192.168.12.0/24 RIP 100 1 D 192.168.13.1 GigabitEthernet
0/0/1
RIP 100 1 D 192.168.23.2 GigabitEthernet
0/0/2
192.168.13.0/24 Direct 0 0 D 192.168.13.3 GigabitEthernet
0/0/1
192.168.13.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.20.0/24 RIP 100 1 D 192.168.23.2 GigabitEthernet
0/0/2
192.168.23.0/24 Direct 0 0 D 192.168.23.3 GigabitEthernet
0/0/2
192.168.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.24.0/24 RIP 100 1 D 192.168.23.2 GigabitEthernet
0/0/2
192.168.30.0/24 Direct 0 0 D 192.168.30.1 LoopBack0
192.168.30.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.30.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.40.0/24 RIP 100 2 D 192.168.23.2 GigabitEthernet
0/0/2
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R4]dis ip ro
Route Flags: R - relay, D - download to fib

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所示。

技術分享圖片

3.3 步驟
實現此案例需要按照如下步驟進行。

步驟一:配置RIP v1

[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#&lt;08bmE3Uw}%$%$
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)查看路由表,驗證網絡通信是否正常

[R1]dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.1 LoopBack0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.1.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 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 RIP 100 1 D 192.168.1.2 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2] dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 11 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.0.0/8 RIP 100 1 D 192.168.1.1 GigabitEthernet
0/0/0
RIP 100 1 D 192.168.2.3 GigabitEthernet
0/0/1
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 Direct 0 0 D 192.168.1.2 GigabitEthernet
0/0/0
192.168.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet
0/0/1
192.168.2.2/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
[R3]dis ip ro
Route Flags: R - relay, D - download to fib

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
R2、R3均做同樣配置。

2)查看路由表,驗證網絡通信是否正常

[R1]dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.1 LoopBack0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.2.0/24 RIP 100 2 D 192.168.1.2 GigabitEthernet
0/0/0
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 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 RIP 100 1 D 192.168.1.2 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]dis ip ro
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 RIP 100 1 D 192.168.1.1 GigabitEthernet
0/0/0
10.1.2.0/24 RIP 100 1 D 192.168.2.3 GigabitEthernet
0/0/1
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 Direct 0 0 D 192.168.1.2 GigabitEthernet
0/0/0
192.168.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet
0/0/1
192.168.2.2/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
[R3]dis ip ro
Route Flags: R - relay, D - download to fib

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

    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route
      Gateway of last resort is not set
      10.0.0.0/24 is subnetted, 1 subnets
      C 10.1.1.0 is directly connected, Loopback0
      C 192.168.1.0/24 is directly connected, FastEthernet0/0
      R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:19, FastEthernet0/0
      R2#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
    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route
      Gateway of last resort is not set
      R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:20, FastEthernet0/0
      [120/1] via 192.168.2.3, 00:00:09, FastEthernet0/1
      C 192.168.1.0/24 is directly connected, FastEthernet0/0
      C 192.168.2.0/24 is directly connected, FastEthernet0/1
      R3#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
    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route
      Gateway of last resort is not set
      10.0.0.0/24 is subnetted, 1 subnets
      C 10.1.2.0 is directly connected, Loopback0
      R 192.168.1.0/24 [120/1] via 192.168.2.2, 00:00:26, FastEthernet0/1
      C 192.168.2.0/24 is directly connected, FastEthernet0/1
      在R1上ping不通10.1.2.1。

步驟二:配置RIP v2

R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R2、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

    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route
      Gateway of last resort is not set
      10.0.0.0/24 is subnetted, 2 subnets
      C 10.1.1.0 is directly connected, Loopback0
      R 10.1.2.0 [120/2] via 192.168.1.2, 00:00:16, FastEthernet0/0
      C 192.168.1.0/24 is directly connected, FastEthernet0/0
      R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:16, FastEthernet0/0
      R2#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
    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route
      Gateway of last resort is not set
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
      R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:02:03, FastEthernet0/0
      [120/1] via 192.168.2.3, 00:01:23, FastEthernet0/1
      R 10.1.1.0/24 [120/1] via 192.168.1.1, 00:00:10, FastEthernet0/0
      R 10.1.2.0/24 [120/1] via 192.168.2.3, 00:00:27, FastEthernet0/1
      C 192.168.1.0/24 is directly connected, FastEthernet0/0
      C 192.168.2.0/24 is directly connected, FastEthernet0/1
      R3#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
    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route
      Gateway of last resort is not set
      10.0.0.0/24 is subnetted, 2 subnets
      R 10.1.1.0 [120/2] via 192.168.2.2, 00:00:21, FastEthernet0/1
      C 10.1.2.0 is directly connected, Loopback0
      R 192.168.1.0/24 [120/1] via 192.168.2.2, 00:00:21, FastEthernet0/1
      C 192.168.2.0/24 is directly connected, FastEthernet0/1
      在R1上可以ping通10.1.2.1。

筆記 RIP