實驗目錄:
1.RIP基本實驗
2.水平分割
3.毒化逆轉
4.被動接口--包含計時器的信息
5.允許接口接受或發送RIP信息
6.RIP優先級
7.設置接口接收或發送RIP 報文時給路由增加的附加路由權值(條數)
8.Time的三大計時器設置
9.不同進程號
10.觸發跟新
11.RIP 的版本兼容問題
12.不連續子網
13.手工匯總
14.向rip內注入一跳默認路由
15.RIPv2認證
16.直連的網絡不再同一網段
一.RIP基本配置
實驗要求:各個路由器能動態學到路由
實驗拓撲:
實驗過程:
1.按照上面的拓撲配置ip地址
2.宣告網絡
[R1]rip //進入RIP視圖(默認計入的RIP進程1)
[R1-rip-1]network 192.168.1.0 //宣告網絡
[R1-rip-1]net 1.1.1.0
[R1-rip-1]q
[R2]rip
[R2-rip-1]network 192.168.1.0
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 2.2.2.0
[R2-rip-1]network 3.3.3.0
[R2-rip-1]q
[R3]rip
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 4.4.4.0
[R3-rip-1]q
3.RIP的幾個查看命令
查看所有路由
[R1]display ip routing-table
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
3.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
4.0.0.0/8 RIP 100 2 192.168.1.2 S0/2/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.1 S0/2/0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.2/32 Direct 0 0 192.168.1.2 S0/2/0
192.168.2.0/24 RIP 100 1 192.168.1.2 S0/2/0
查看RIP進程信息
[R1]display rip
Public VPN-instance name :
RIP process : 1 //進程號
RIP version : 1 //版本
Preference : 100 //優先級
Checkzero [高1] : Enabled
Default-cost : 0 //默認度量值,可以調整網絡大小
Summary : Enabled //自動匯總開啟
Hostroutes[高2] : Enabled
Maximum number of balanced paths : 6 //支持的負載分擔條數
Update time : 30 sec(s) Timeout time : 180 sec(s)
Suppress time : 120 sec(s) Garbage-collect time : 120 sec(s)
TRIP retransmit time : 5 sec(s)
TRIP response packets retransmit count : 36
Silent interfaces : None //有沒有被動接口
Default routes : Disabled //有沒有默認路由
Verify-source : Enabled
Networks :
1.0.0.0 192.168.1.0
Configured peers : None
Triggered updates sent : 0
Number of routes changes : 0
Number of replies to queries : 0
查看RIP 協議的路由
[R1]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 4
RIP Routing table Status : < Active>
Summary Count : 4
Destination/Mask Proto Pre Cost NextHop Interface
2.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
3.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
4.0.0.0/8 RIP 100 2 192.168.1.2 S0/2/0
192.168.2.0/24 RIP 100 1 192.168.1.2 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
查看路由的跟新時間等
[R1]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.1.2 on Serial0/2/0
Destination/Mask Nexthop Cost Tag Flags Sec
2.0.0.0/8 192.168.1.2 1 0 RA[高3] 22
3.0.0.0/8 192.168.1.2 1 0 RA 22
192.168.2.0/24 192.168.1.2 1 0 RA 22
4.0.0.0/8 192.168.1.2 2 0 RA 22
查看RIP接口,包括度量值、水平分割是否開啟
[R1]display rip 1 interface
Interface-name: LoopBack0
Address/Mask:1.1.1.1/32 Version:RIPv1
MetricIn:0 MetricIn route policy:Not designated
MetricOut:1 MetricOut route policy:Not designated
Split-horizon/Poison-reverse:on/off Input/Output:on/on [高4]
Current packets number/Maximum packets number:0/2000
Interface-name: Serial0/2/0
Address/Mask:192.168.1.1/24 Version:RIPv1
MetricIn:0 MetricIn route policy:Not designated
MetricOut:1 MetricOut route policy:Not designated
Split-horizon/Poison-reverse:on/off Input/Output:on/on
Current packets number/Maximum packets number:0/2000
從此命令可以看出,水平分割時開啟的,而毒化逆轉時關閉的。
二.水平分割
通常情況下,為了防止路由環的出現,水平分割都是必要的。只是在某些特殊情況
下,為保證協議的正確執行,需要關閉水平分割。例如在NBMA 網絡中,對於采用
幀中繼封裝的主接口和點對多點子接口,為了使接口可以發送從該接口學到的路由,
則需要禁止水平分割。在關閉水平分割時一定要確認是否必要。
關閉水平分割的命令
[R1]int s0/2/0
[R1-Serial0/2/0]un rip split-horizon
我們來測試一下水平分割的影響
開啟了水平分割
<R1>terminal monitor
% Current terminal monitor is on
<R1>terminal debugging
% Current terminal debugging is on
<R1>debugging rip 1 packet
*Dec 2 16:21:44:16 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response[高5] from 192.168.1.2 on Serial0/2/0
*Dec 2 16:21:44:16 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 84
*Dec 2 16:21:44:16 2010 R1 RM/6/RMDEBUG: AFI 2, dest 2.0.0.0, cost 1
*Dec 2 16:21:44:16 2010 R1 RM/6/RMDEBUG: AFI 2, dest 3.0.0.0, cost 1
*Dec 2 16:21:44:16 2010 R1 RM/6/RMDEBUG: AFI 2, dest 4.0.0.0, cost 2
*Dec 2 16:21:44:16 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.2.0, cost 1
*Dec 2 16:21:45:812 2010 R1 RM/6/RMDEBUG: RIP 1 : Sending response on interface Serial0/2/0 from 192.168.1.1 to 255.255.255.255
*Dec 2 16:21:45:812 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 24
*Dec 2 16:21:45:812 2010 R1 RM/6/RMDEBUG: AFI 2, dest 1.0.0.0, cost 1
從上面我們可以看出,RIP包沒有向自己宣告的網絡發送跟新包!--這是水平分割起的作用!
關閉了水平分割
<R1>debugging rip 1 packet
*Dec 2 16:26:49:844 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response from 192.168.1.2 on Serial0/2/0
*Dec 2 16:26:49:844 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 84
*Dec 2 16:26:49:844 2010 R1 RM/6/RMDEBUG: AFI 2, dest 2.0.0.0, cost 1
*Dec 2 16:26:49:844 2010 R1 RM/6/RMDEBUG: AFI 2, dest 3.0.0.0, cost 1
*Dec 2 16:26:49:844 2010 R1 RM/6/RMDEBUG: AFI 2, dest 4.0.0.0, cost 2
*Dec 2 16:26:49:844 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.2.0, cost 1
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: RIP 1 : Sending response on interface Serial0/2/0 from 192.168.1.1 to 255.255.255.255
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 124
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: AFI 2, dest 1.0.0.0, cost 1
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: AFI 2, dest 2.0.0.0, cost 2
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: AFI 2, dest 3.0.0.0, cost 2
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: AFI 2, dest 4.0.0.0, cost 3
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.1.0, cost 1
*Dec 2 16:26:56:125 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.2.0, cost 2
*Dec 2 16:27:11:437 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response from 192.168.1.2 on Serial0/2/0
*Dec 2 16:27:11:437 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 84
*Dec 2 16:27:11:437 2010 R1 RM/6/RMDEBUG: AFI 2, dest 2.0.0.0, cost 1
*Dec 2 16:27:11:437 2010 R1 RM/6/RMDEBUG: AFI 2, dest 3.0.0.0, cost 1
*Dec 2 16:27:11:437 2010 R1 RM/6/RMDEBUG: AFI 2, dest 4.0.0.0, cost 2
*Dec 2 16:27:11:437 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.2.0, cost 1
從上面我們可以看出,在關閉水平分割后RIP包會想自己發送自己宣告的網絡,從而產生了路由環路。
三.毒化逆轉
在接口下面開啟毒化逆轉功能
[R1]int s0/2/0
[R1-Serial0/2/0]rip poison-reverse
<R1>debugging rip 1 packet
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: RIP 1 : Sending response on interface Serial0/2/0 from 192.168.1.1 to 255.255.255.255
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 104
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: AFI 2, dest 1.0.0.0, cost 1
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.2.0, cost 16
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: AFI 2, dest 2.0.0.0, cost 16
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: AFI 2, dest 3.0.0.0, cost 16
*Dec 2 16:31:15:937 2010 R1 RM/6/RMDEBUG: AFI 2, dest 4.0.0.0, cost 16
*Dec 2 16:31:25:62 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response from 192.168.1.2 on Serial0/2/0
*Dec 2 16:31:25:62 2010 R1 RM/6/RMDEBUG: Packet : vers 1, cmd response, length 84
*Dec 2 16:31:25:62 2010 R1 RM/6/RMDEBUG: AFI 2, dest 2.0.0.0, cost 1
*Dec 2 16:31:25:62 2010 R1 RM/6/RMDEBUG: AFI 2, dest 3.0.0.0, cost 1
*Dec 2 16:31:25:62 2010 R1 RM/6/RMDEBUG: AFI 2, dest 4.0.0.0, cost 2
*Dec 2 16:31:25:62 2010 R1 RM/6/RMDEBUG: AFI 2, dest 192.168.2.0, cost 1
從上面可以看出,R1會向自己學習到的路由發送為16條的RIP測試包。來測試下一跳是否已經不可達,當可達是對方會發送可達信息回應,如果對方不可達,會根據3大時間處理!!
四.被動接口
有被動接口我感覺肯定會有單播跟新,單播跟新的命令是在RIP下:#peer +ip地址
作用:不發送RIP包,但接受RIP跟新包
在RIP模式下設置被動接口
[R1]rip
[R1-rip-1]silent-interface s0/2/0
[R1-rip-1]q
[R2]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.1.1 on Serial0/2/0
Destination/Mask Nexthop Cost Tag Flags Sec
1.0.0.0/8 192.168.1.1 1 0 RA 180
Peer 192.168.2.2 on Serial0/2/2
Destination/Mask Nexthop Cost Tag Flags Sec
4.0.0.0/8 192.168.2.2 1 0 RA 19
再120秒
[R2]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.1.1 on Serial0/2/0
Destination/Mask Nexthop Cost Tag Flags Sec
1.0.0.0/8 192.168.1.1 16 0 RSG 120
Peer 192.168.2.2 on Serial0/2/2
Destination/Mask Nexthop Cost Tag Flags Sec
4.0.0.0/8 192.168.2.2 1 0 RA 15
[R2]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.2.2 on Serial0/2/2
Destination/Mask Nexthop Cost Tag Flags Sec
4.0.0.0/8 192.168.2.2 1 0 RA 16
對r1沒有影響=----因為被動接口是不發送RIP包,但是接受路由跟新包,但是ping不同
[R1]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 4
RIP Routing table Status : < Active>
Summary Count : 4
Destination/Mask Proto Pre Cost NextHop Interface
2.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
3.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
4.0.0.0/8 RIP 100 2 192.168.1.2 S0/2/0
192.168.2.0/24 RIP 100 1 192.168.1.2 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
五.五.允許接口接受或發送RIP信息
rip input 命令用來允許接口接收RIP 報文(默認開啟的)
rip output 命令用來允許接口向外發送RIP 報文(默認開啟的)
[R1]int s0/2/0
[R1-Serial0/2/0]undo rip input
[R1-Serial0/2/0]q
[R1]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.1.2 on Serial0/2/0
Destination/Mask Nexthop Cost Tag Flags Sec
2.0.0.0/8 192.168.1.2 1 0 RA 162
3.0.0.0/8 192.168.1.2 1 0 RA 162
192.168.2.0/24 192.168.1.2 1 0 RA 162
4.0.0.0/8 192.168.1.2 2 0 RA 162
從上面可以看出,路由已經超時!!!!
但是不影響R2和R3學習路由,雖然R2、R3學到了路由,但是ping不同R1!!
rip output 命令用來允許接口向外發送RIP 報文(默認開啟的)
[R1]int s0/2/0
[R1-Serial0/2/0]undo rip output
[R1-Serial0/2/0]
六.RIP優先級
每一種路由協議都有自己的優先級,它的缺省取值由具體的路由策略決定。優先級
的高低將最后決定IP 路由表中的路由采取哪種路由算法獲取的最佳路由。可以利用
此命令手動調整RIP 的優先級。
[R1]rip
[R1-rip-1]preference ?
INTEGER<1-255> Value of Preference
route-policy Route-policy
[R1-rip-1]preference 50
[R1-rip-1]q
[R1]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 4
RIP Routing table Status : < Active>
Summary Count : 4
Destination/Mask Proto Pre Cost NextHop Interface
2.0.0.0/8 RIP 50 1 192.168.1.2 S0/2/0
3.0.0.0/8 RIP 50 1 192.168.1.2 S0/2/0
4.0.0.0/8 RIP 50 2 192.168.1.2 S0/2/0
192.168.2.0/24 RIP 50 1 192.168.1.2 S0/2/0
從上面可以看出,優先級已經是50了。
只供本設備進行路由選擇,不影響其他設備的路由,R2上的依舊是100
七.配置RIP度量值
根據上面的圖,進行實驗
rip metricin 命令用來設置接口接收RIP 報文時給路由增加的附加路由權值,
[R2]int s0/2/0
[R2-Serial0/2/0]rip metricin 5
[R2]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 2
RIP Routing table Status : < Active>
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
1.0.0.0/8 RIP 100 6 192.168.1.1 S0/2/0
4.0.0.0/8 RIP 100 1 192.168.2.2 S0/2/2
RIP Routing table Status : < Inactive>
Summary Count : 0
<R3>display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 4
RIP Routing table Status : < Active>
Summary Count : 4
Destination/Mask Proto Pre Cost NextHop Interface
1.0.0.0/8 RIP 100 7 192.168.2.1 S0/2/0
2.0.0.0/8 RIP 100 1 192.168.2.1 S0/2/0
3.0.0.0/8 RIP 100 1 192.168.2.1 S0/2/0
192.168.1.0/24 RIP 100 1 192.168.2.1 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
rip metricout 命令用來設置接口發送RIP 報文時給路由增加的附加路由權值
[R2]int s0/2/0
[R2-Serial0/2/0]undo rip metricin
[R2-Serial0/2/0]rip metricout ?
INTEGER<1-16> The value of metric added to outgoing routes
route-policy Route-policy
[R2-Serial0/2/0]rip metricout 10
八.配置time三大時間設置
timers 命令用來修改RIP 的三個定時器Period update 、Timeout 和
Garbage-collection 的值
[R1-rip-1]timers ?
garbage-collect Config RIP route garbage-collect timer interval
suppress Config RIP route suppress timer interval
timeout Config RIP route Age timer interval
update Config RIP route period update timer interval
九.不同進程間通信
按照上圖配置做不同進程之間的通信
注意:不同進程針對的是一個路由器上出現兩個不同的進程,如果每台交換機的進程不一樣是可以相互學習到路由的。
引入rip路由和引入直連路由是有很大區別的。
[R2]rip
[R2-rip-1]un net 192.168.2.0
[R2-rip-1]un net 3.3.3.0
[R2-rip-1]q
[R2]rip 2
[R2-rip-2]net 192.168.2.0
[R2-rip-2]net 3.3.3.0
[R2-rip-2]q
[R3]undo rip 1
Warning : Undo RIP process? [Y/N]:y
[R3]rip 2
[R3-rip-2]
[R3-rip-2]net 192.168.2.0
[R3-rip-2]net 4.4.4.0
[R3-rip-2]q
當我們查看路由表的時候是可以看出。不同進程之間是不能通信的!
R1學習不到進程2的所有路由
[R1]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 1
RIP Routing table Status : < Active>
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
2.0.0.0/8 RIP 100 1 192.168.1.2 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
R2可以學習到兩邊的路由
[R2]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 2
RIP Routing table Status : < Active>
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
1.0.0.0/8 RIP 100 1 192.168.1.1 S0/2/0
4.0.0.0/8 RIP 100 1 192.168.2.2 S0/2/2
RIP Routing table Status : < Inactive>
Summary Count : 0
同樣R3是不能學到進程1的所有路由的
[R3]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 1
RIP Routing table Status : < Active>
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
3.0.0.0/8 RIP 100 1 192.168.2.1 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
解決方法:使用引入路由命令
[R2]rip
[R2-rip-1]import-route ?
bgp Border Gateway Protocol (BGP) routes
direct Direct routes
isis Intermediate System to Intermediate System (IS-IS) routes
ospf Open Shortest Path First (OSPF) routes
rip Routing Information Protocol (RIP) routes
static Static routes
[R2-rip-1]import-route rip 2 ?
cost Metric for imported route
route-policy Apply the specified route policy to filter route
tag Specify route tag
<cr>
[R2-rip-1]import-route rip 2
[R2-rip-1]q
[R2]rip 2
[R2-rip-2]import-route rip 1
[R2-rip-2]
十.觸發跟新
只在R1和R2之間開啟觸發跟新
進入接口模式,開啟觸發跟新
[R1]int s0/2/0
[R1-Serial0/2/0]rip triggered
[R2]int s0/2/0
[R2-Serial0/2/0]rip triggered
注意:直連的兩個端口必須都要開啟觸發跟新,如果R1開啟觸發跟新,R2不開啟,R2不會定期收到R1的數據包,所以相互之間是學習不到路由的!!
[R1]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.1.2 on Serial0/2/0 (TRIP)
Destination/Mask Nexthop Cost Tag Flags Sec
2.0.0.0/8 192.168.1.2 1 0 TP _
3.0.0.0/8 192.168.1.2 1 0 TP _
4.0.0.0/8 192.168.1.2 2 0 TP _
192.168.2.0/24 192.168.1.2 1 0 TP _
從上面可以看出,模式已近是觸發跟新模式,跟新時間為無!
[R2]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.2.2 on Serial0/2/2
Destination/Mask Nexthop Cost Tag Flags Sec
4.0.0.0/8 192.168.2.2 1 0 RA 19
Peer 192.168.1.1 on Serial0/2/0 (TRIP)
Destination/Mask Nexthop Cost Tag Flags Sec
1.0.0.0/8 192.168.1.1 1 0 TP _
十一.RIP 的版本兼容問題
修改R1的RIP為版本2
[R1]rip
[R1-rip-1]ver 2
[R1-rip-1]q
[R1]display rip 1 route
Route Flags: R - RIP, T - TRIP
P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect
----------------------------------------------------------------------------
Peer 192.168.1.2 on Serial0/2/0
Destination/Mask Nexthop Cost Tag Flags Sec
2.0.0.0/8 192.168.1.2 1 0 RA 131
3.0.0.0/8 192.168.1.2 1 0 RA 131
192.168.2.0/24 192.168.1.2 1 0 RA 131
4.0.0.0/8 192.168.1.2 2 0 RA 131
對於上面的路由,已經是超時的了!
|
怎樣能讓R1學習到R2的路由呢???請看下面
1.把R1的接口模式改為廣播方式
2.把R2上的s0/2/0改為主播方式的
[R1-Serial0/2/0]rip version 2 ?
broadcast RIPv2 broadcast mode which is compatible with RIPv1
multicast RIPv2 multicast mode
<cr>
[R1-Serial0/2/0]rip version 2 multicast
十二.不連續子網
[R1]rip
[R1-rip-1]un summary
[R1-rip-1]net 192.168.1.0
[R1-rip-1]net 172.16.1.0
[R1-rip-1]net 172.16.2.0
[R2]rip
[R2-rip-1]un s
[R2-rip-1]un summary
[R2-rip-1]net 192.168.1.0
[R2-rip-1]net 192.168.2.0
[R3]rip
[R3-rip-1]un su
[R3-rip-1]un summary
[R3-rip-1]net 172.16.0.0
[R2]display ip routing-table p r
Public Routing Table : RIP
Summary Count : 1
RIP Routing table Status : < Active>
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
172.16.0.0/16 RIP 100 1 192.168.1.1 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
我們可以看到,上面的路由信息是很粗略的,此時ping兩邊的任意一個都是一個通一個不通!!
解決方法是:使用RIPv2
在學習Cisco時,是有子接口的,在華3也有,不過比較特殊,因為在華3的loopback口的所有地址都是32位的,看不到輔助接口的效果,如果用網段去驗證是可以實現用輔助地址解決不連續子網問題。不過在同一路由器上宣告相同的主網。
[R1]rip
[R1-rip-1]ver 2
[R2]rip
[R2-rip-1]ver 2
[R3]rip
[R3-rip-1]ver 2
[R2]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 5
RIP Routing table Status : < Active>
Summary Count : 4
Destination/Mask Proto Pre Cost NextHop Interface
172.16.1.1/32 RIP 100 1 192.168.1.1 S0/2/0
172.16.2.1/32 RIP 100 1 192.168.1.1 S0/2/0
172.16.5.1/32 RIP 100 1 192.168.2.2 S0/2/2
172.16.6.1/32 RIP 100 1 192.168.2.2 S0/2/2
RIP Routing table Status : < Inactive>
Summary Count : 1
上面的輸出已經解決了不連續子網問題
十三.手工匯總
實現手工匯總
上面的實驗十二,我們該成了ver2
當該成ver2后,原有的不un sunmmary生效。
要重新開啟一遍
注意:手工匯總對loopback口是不行的,因為所有的loopback口都是32個掩碼,不能匯總,針對網段可以實現自動匯總。
[R1]int s0/2/0
[R1-Serial0/2/0]rip summary-address 172.16.0.0 22
注意,即使在R2上顯示的是172.16.0.0,仍然不影響實驗十二的效果!!
十四.向rip內注入一跳默認路由
[H3C]sys R1
[R1]int lo0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1]int s0/2/0
[R1-Serial0/2/0]ip add 192.168.1.1 24
[R1-Serial0/2/0]q
[R1]rip
[R1-rip-1]ver 2
[R1-rip-1]undo summary
[R1-rip-1]net 1.0.0.0
[R1-rip-1]net 192.168.1.0
[R1-rip-1]q
[H3C]sys R2
[R2]int s0/2/0
[R2-Serial0/2/0]ip add 192.168.1.2 24
[R2-Serial0/2/0]q
[R2]int s0/2/2
[R2-Serial0/2/2]ip add 192.168.2.1 24
[R2-Serial0/2/2]q
[R2]rip
[R2-rip-1]ver 2
[R2-rip-1]undo summary
[R2-rip-1]net 192.168.1.0
[R2-rip-1]net 192.168.2.0
[R2-rip-1]q
[H3C]sys R3
[R3]int lo0
[R3-LoopBack0]ip add 4.4.4.4 32
[R3-LoopBack0]q
[R3]int s0/2/0
[R3-Serial0/2/0]ip add 192.168.2.2 24
[R3]rip
[R3-rip-1]net 192.168.2.0
[R3-rip-1]net 4.0.0.0
[R3-rip-1]ver 2
[R3-rip-1]undo summary
[R3-rip-1]q
此時我們在R3上設置lo1口的ip地址。然后再R3上注入一跳默認路由
[R3]int lo0
[R3-LoopBack0]ip add 10.10.10.10 32
[R3]rip
[R3-rip-1]default-route originate cost 10 //為什么非要設置cost值呢??本實驗最后講解
從R1上查看
[R1]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 2
RIP Routing table Status : < Active>
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 RIP 100 11 192.168.1.2 S0/2/0
192.168.2.0/24 RIP 100 1 192.168.1.2 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
R1的默認路由cost值為11
R1能ping通10.10.10.10
[R1]ping 10.10.10.10
PING 10.10.10.10: 56 data bytes, press CTRL_C to break
Reply from 10.10.10.10: bytes=56 Sequence=1 ttl=254 time=4 ms
Reply from 10.10.10.10: bytes=56 Sequence=2 ttl=254 time=1 ms
Reply from 10.10.10.10: bytes=56 Sequence=3 ttl=254 time=4 ms
Reply from 10.10.10.10: bytes=56 Sequence=4 ttl=254 time=19 ms
Reply from 10.10.10.10: bytes=56 Sequence=5 ttl=254 time=5 ms
--- 10.10.10.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/6/19 ms
|
十五.RIPv2認證
[R1]rip
[R1-rip-1]ver 2
[R1-rip-1]un summary
[R1-rip-1]net 192.168.1.0
[R1-rip-1]net 1.1.1.0
[R2]rip
[R2-rip-1]ver 2
[R2-rip-1]un summary
[R2-rip-1]net 192.168.1.0
[R1]int s0/2/0
[R1-Serial0/2/0]rip ?
authentication-mode Authentication type
input Receive RIP packets
metricin Metric added to incoming routes
metricout Metric added to outgoing routes
output Send RIP packets
poison-reverse Configure poison reverse
split-horizon Split-horizon control
summary-address Configure summary address on this interface
triggered Triggered RIP
version RIP version switch
[R1-Serial0/2/0]rip authentication-mode ?
md5 MD5 authentication
simple Simple text authentication
[R1-Serial0/2/0]rip authentication-mode simple 123
[R2]int s0/2/0
[R2-Serial0/2/0]rip authentication-mode simple 123
兩邊都要開啟
[R2-Serial0/2/0]rip authentication-mode md5 ?
rfc2082 RFC 2082 MD5 authentication packet format type
rfc2453 RFC 2453 MD5 authentication packet format type
|
十六.直連的網絡不再同一網段
注意
上面的連線,必須是串行口,E口學習不到直連網絡不同網段的路由!
IPv4在上圖沒有開啟RIP之前是可以學習到不同網段的路由的!
IPV6在沒有開啟RIP前是不能學習到不同網段的路由的!
開啟RIP實驗如下:
[R1]int lo0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]int s0/2/0
[R1-Serial0/2/0]ip add 192.168.1.1 24
[R1]rip
[R1-rip-1]ver 2
[R1-rip-1]un s
[R1-rip-1]net 1.1.1.0
[R1-rip-1]net 192.168.1.0
[R1-rip-1]q
[R2]int s0/2/0
[R2-Serial0/2/0]
[R2-Serial0/2/0]ip add 192.168.2.1 24
[R2-Serial0/2/0]q
[R2]int s0/2/2
[R2-Serial0/2/2]ip add 192.168.3.1 24
[R2-Serial0/2/2]q
[R2]rip
[R2-rip-1]ver 2
[R2-rip-1]un summary
[R2-rip-1]net 192.168.2.0
[R2-rip-1]net 192.168.3.0
[R2-rip-1]q
[R3]int lo0
[R3-LoopBack0]ip add 4.4.4.4 32
[R3-LoopBack0]int s0/2/0
[R3-Serial0/2/0]ip add 192.168.4.1 24
[R3]rip
[R3-rip-1]net 192.168.4.0
[R3-rip-1]ver 2
[R3-rip-1]un summary
[R3-rip-1]net 4.4.4.0
[R1]display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.4/32 RIP 100 2 192.168.2.1 S0/2/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.1 S0/2/0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.2.1/32 Direct 0 0 192.168.2.1 S0/2/0
192.168.3.0/24 RIP 100 1 192.168.2.1 S0/2/0
[R1]display ip routing-table protocol rip
Public Routing Table : RIP
Summary Count : 2
RIP Routing table Status : < Active>
Summary Count : 2
Destination/Mask Proto Pre Cost NextHop Interface
4.4.4.4/32 RIP 100 2 192.168.2.1 S0/2/0
192.168.3.0/24 RIP 100 1 192.168.2.1 S0/2/0
RIP Routing table Status : < Inactive>
Summary Count : 0
在R1上我們是學習不到R3上的192.168.4.0網段,可以學習到4.4.4.0網段。
因為公司之間通信不需要知道路由直連ip地址!
十七.直連的網絡不再同一網段IPv6
ipv6
[R1]int lo0
[R1-LoopBack0]ipv6 add 1::1/128
[R1-LoopBack0]q
[R1]int s0/2/0
[R1-Serial0/2/0]ipv6 add 2001::1/64
[R1-Serial0/2/0]q
[R2]int s0/2/0
[R2-Serial0/2/0]ipv6 add 2002::1/64
[R2-Serial0/2/0]q
[R2]int s0/2/2
[R2-Serial0/2/2]ipv6 add 2003::1/64
[R3]int lo0
[R3-LoopBack0]ipv6 add 2::1/128
[R3]int s0/2/0
[R3-Serial0/2/0]ipv6 add 2004::1/64
學習不到直連的網絡,
[R1]display ipv6 routing-table
Routing Table :
Destinations : 3 Routes : 3
Destination: ::1/128 Protocol : Direct
NextHop : ::1 Preference: 0
Interface : InLoop0 Cost : 0
Destination: 3001::1/128 Protocol : Direct
NextHop : ::1 Preference: 0
Interface : InLoop0 Cost : 0
Destination: FE80::/10 Protocol : Direct
NextHop : :: Preference: 0
Interface : NULL0 Cost : 0
開啟rip看看
[R1]int lo0
[R1-LoopBack0]ripn
[R1-LoopBack0]ripng 1 enable
[R1-LoopBack0]q
[R1]int s0/2/0
[R1-Serial0/2/0]ripng 1 enable
[R1-Serial0/2/0]q
[R2-ripng-1]int s0/2/0
[R2-Serial0/2/0]ripng 1 enable
[R2-Serial0/2/0]int s0/2/2
[R2-Serial0/2/2]ripng 1 enable
[R3]int lo0
[R3-LoopBack0]ripng 1 enable
[R3-LoopBack0]q
[R3]int s0/2/0
[R3-Serial0/2/0]ripng 1 enable
[R3-Serial0/2/0]q
截圖00,可以學習到所有的
RIP-1 缺省進行零域檢查操作。
根據協議(RFC1058)規定,RIP-1 的報文中有些區域必須為零,稱之為零域(zero
field)。可以使用checkzero 命令來啟動和禁止對RIP-1 報文的查零操作。進行查
零操作時如果收到零域不為零的RIP-1 報文,則拒絕處理。
由於 RIP-2 的報文沒有零域,所以此命令對RIP-2 沒有作用。
缺省情況下,路由器接收主機路由。
在某些特殊情況下,RIP 會收到大量的同一網段的主機路由,這些路由對於選路沒
有多少作用,卻占用了大量的資源。這時可以使用undo host-route 來拒絕接受主
機路由。
RIP老化時間
在下面實驗五中將詳細介紹----5.允許接口接受或發送RIP信息。
RIP路由初始化時,發送兩種報文,request和response!
Request是目的地址是廣播地址!
Respons是回應request請求包,並在路由建立后維護路由表!!