RIP路由快速入门(接下)
MSCD龙帝国计算机和语言学习论坛 :: 网络技术交流区 :: 路由器技术交流区
第1页/共1页
RIP路由快速入门(接下)
对每一台路由器重复上述操作,一个使用RIP路由的网络就建成了。 1r 4m iX
iNnTT>O
测试配置正确性 'bJwiLy
Wg|i;%1*z
配置RIP之后,要检查数据是否可以被正确路由。除了可以使用上面提到的连通性测试工具之外,还有以下几个命令: i @sh ip route用于检测路由表; TKAx!% d&G
sh ip protocols用于检查路由协议状况; NY+pt7K
debug ip rip用于调试RIP协议信息。 U=?{u)LP[9
=bQ5[&/s2
使用sh ip route命令显示各台路由器的路由表。 Kpf![Y.
R+|5y_1<
testBJ#sh ip route AP>WKIHE
4Q` n 3
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP $y#s:,*D
(@h{Yxp
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area $ j(SO1
Rf9A7kof
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 CNqD@EE_
uzlmuvY
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP \|4 n3ordn
`[Sm7PO)
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, SC @0P Q
U1Q2{Kd'4
* - candidate default, U - per-user static route, o - ODR zF7BMqC
'z^OYaW
Gateway of last resort is not set dN9_V%=R
"yi)PI/F
172.16.0.0/24 is subnetted, 4 subnets e fYx_1,x
ziFP>A[3V
R 172.16.4.0 [120/1] via 172.16.2.2, 00:00:12, Serial1/0 3G(hrcG*
ja8 uJ
C 172.16.1.0 is directly connected, Ethernet0/1 :(Xo{6<0k
o#-?jKs
C 172.16.2.0 is directly connected, Serial1/0 ~sV9swt
04{`hnc
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:09, Ethernet0/1 pa' I8
YrXu~,Dtb
[120/1] via 172.16.2.2, 00:00:22, Serial1/0 f=k5NoA
]+[ k
上面显示的是北京路由器的路由信息。字母C开头的是直接相连的网络,有172.16.1.0和172.16.2.0,分别连接在e0/1和s1/0端口上。字母R开头的是RIP协议学习到的路由,有172.16.3.0和172.16.4.0,其中,到172.16.3.0有两条路径供选择,分别经由testSH和testTJ路由器。对比网络拓扑图,可以看出实际情况与设计的完全一致。 z" QxCBI$
B>.%$ 'Z{
中括号里的内容是路由项的管理距离和度量值,RIP的缺省管理距离是120,到达3、4子网的度量值是1,即经过1个路由器可达。 _jznUJ
RK{ytd!t
同样的命令在另外两台路由器上运行,结果如下。 4hvw>4e
ZtWAS
testSH#sh ip route >8xR[\)N i
Is2Zf lv
Gateway of last resort is not set RVR-X@8<
tORrZ>F?6
172.16.0.0/24 is subnetted, 4 subnets %^&b1X/|
kt/OPGHV(A
R 172.16.4.0 [120/1] via 172.16.3.2, 00:00:13, Ethernet0/0 ~Q:0p:8/
s?|SOs}
C 172.16.1.0 is directly connected, Ethernet0/1 nbQU2;[ .
yJQ r ?n
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:11, Ethernet0/1 4Rj`<.J/
mie&8aC
[120/1] via 172.16.3.2, 00:00:13, Ethernet0/0 r{P_2\Bc
T Sj> J3R
C 172.16.3.0 is directly connected, Ethernet0/0 ~4,k*bPm
vVF?e05^'
testTJ#sh ip route \y):C(|K
XuCa_A.K
Gateway of last resort is not set C_< CyZb,$
$.6Xv
172.16.0.0/24 is subnetted, 4 subnets gN/fxmR
^/2w`c9
C 172.16.4.0 is directly connected, Ethernet0/0 JsWx$pC
p[Ug1x :
R 172.16.1.0 [120/1] via 172.16.3.3, 00:00:07, Ethernet0/1 a (dd Dss
3xle hZM
[120/1] via 172.16.2.3, 00:00:19, Serial1/0 wbDcDJvF
+6(~%&
C 172.16.2.0 is directly connected, Serial1/0 v|e 4*'
n&Gj{CT
C 172.16.3.0 is directly connected, Ethernet0/1 x@fa%R=!,=
KR 分析上述命令输出时,一定要随时参照拓扑图,离开网络拓扑,上面的信息就没有任何意义。动态路由的灵活性体现在一条链路出现故障,路由算法会自动切换到迂回链路上。例如我们将testBJ和testTJ之间的串行线缆断开,一段时间后,再检查路由表,如下所示。 %{wk331u
buK 8ig
testBJ#sh ip route LD(}S:j
n67***%e
Gateway of last resort is not set qMxaOprS
gC5F42sF
172.16.0.0/24 is subnetted, 3 subnets RO>0x^YR
BC4%P?gA~
R 172.16.4.0 [120/2] via 172.16.1.3, 00:00:22, Ethernet0/1 y:'qr{$m
C 172.16.1.0 is directly connected, Ethernet0/1 R,RF"y`g6
K3nfGk_M
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:22, Ethernet0/1 }!'K|P
我们发现串行链路所在的子网2断开了,到网络172.16.4.0网络的数据包都将绕经testSH路由器。 H5RV80R@5
pnp1]j[6
sh ip protocols命令可以显示当前路由协议的状况,如下所示。 +:3J ~H%
&xSp js"
testBJ#sh ip protocols 1HZ9zv0cC
,b!b'|@T
Routing Protocol is "rip" '$@g {
'TBo(- E8[
Sending updates every 30 seconds, next due in 19 seconds !}(~tAQ
"XP$@*
Invalid after 180 seconds, hold down 180, flushed after 240 x(\QkX
J.M9WgWT$
Outgoing update filter list for all inte***ces is not set /.iayd$jH
CZZ}|
Incoming update filter list for all inte***ces is not set RUlM"w@
;hz ~N8i
Redistributing: connected, rip sRhMQJHa3
8vg ]R~/~
Default version control: send version 1, receive any version Lqkog"|3
Ky R_`| Inte***ce Send Recv Key-chain vO^S/G;V
Y'v(U-
Ethernet0/1 1 1 2 /iO3h!C
bfVZva
Serial1/0 1 1 2 <>)_c4S?
>|S d
Routing for Networks: F6C7r,OA
9 qoy"hX
172.16.0.0 `o(}F21
VHBsATf
Routing Information Sources: ]=R:eZY@
_/`? f (D
Gateway Distance Last Update /EJPZ^nr
Gwtz&W+V
172.16.2.2 120 00:00:05 H^ =_.`j/
`V@ CBHg
172.16.1.3 120 00:00:27 vRon>ex;
~0[3O|JG
Distance: (default is 120) 5USfB /^
+h< `R_
从命令输出中,可以看出RIP协议的基本配置,还可以得知与当前路由器交换信息的路由器有testTJ(172.16.2.2)和testSH(172.16.1.3)两台路由器,上次接收路由信息分别在5秒和27秒之前。 4pFn6 0"
FV6|! 3H
要了解路由器之间交换路由信息的详情,可以使用debug ip rip命令。如下所示,输入命令后,隔一段时间,控制台上出现接收或者发送RIP广播的信息。 $S WIM
zC~,yh7C&
testBJ#debug ip rip ||eAWvt(V
T'i0IZ5-
RIP protocol debugging is on h3zJHWQt
DS%^"(q
testBJ# z5j5lF/ ;
4P#9q)u*
RIP: received v1 update from 172.16.2.2 on Serial1/0 }R!X
>'E TO[e4
172.16.4.0 in 1 hops $;q|>o"8
I,9xHj
172.16.3.0 in 1 hops ("t?.xt
eWSt|t~
RIP: received v1 update from 172.16.1.3 on Ethernet0/1 u4j_R`2qqp
[390J_
172.16.4.0 in 2 hops ct[s}4
pfzbA1qlyV
172.16.3.0 in 1 hops -*T _~,
,iaX!}r
RIP: sending v1 update to 255.255.255.255 via Ethernet0/1 (172.16.1.2) fUZ'(3_
U!YGW$s -g
subnet 172.16.4.0, metric 2 USBFngvr
RT=~hE:'
subnet 172.16.2.0, metric 1 KGjn_v6Gr
Xa35ZobSG
RIP: sending v1 update to 255.255.255.255 via Serial1/0 (172.16.2.3) .Rt:^z{L
U.zltK#y]R
subnet 172.16.1.0, metric 1 On( Y]MV
.lGf9.<
RIP: received v1 update from 172.16.1.3 on Ethernet0/1 W;EJ|J;6
*IbMOa}m+
172.16.4.0 in 2 hops |^Tfc!bx'
E$)vf
172.16.3.0 in 1 hops $#P D1A
g.MIhrf{
RIP: received v1 update from 172.16.2.2 on Serial1/0 zR,Hhp#Pt
cQ+VwX^c
172.16.4.0 in 1 hops F]7-3{8|
S[[%&%O
172.16.3.0 in 1 hops %!w_i0W
K[ #7UEYp
testBJ#no debug all ObljxQ xav
ZDrP+Th_
All possible debugging has been turned off I?=Xd/bNuA
:/cZt.)
testBJ# CQ ?uYub"
}pb'^t*@
从上述信息中可以得到RIP广播的详情。路由器先是从testTJ收到子网3、4的信息,然后又从testSH收到子网3、4的信息。其中,到子网4走testTJ一跳,走testSH两跳,所以,路由表中反映出来的是经由testTJ到子网4;到子网3的距离都是一跳,所以,路由表中有两条并列的路由。 oU_9/GY$eA
f :v)v
一段时间后,当前路由器的更新计时达到30秒,于是,它在两条链路上广播自身的路由表信息。注意,广播路由更新时,RIP采用了水平分割机制,从一个端口上学得的信息就不在这个端口上进行广播,所以当前路由器testBJ只发送子网172.16.1.0的路由信息。 Ew9J`+ZU
2p>k/-q
使用no debug all命令结束调试信息的显示。需要注意的是debug命令非常消耗路由器资源,所以不要在通讯繁忙的路由器上使用,否则,路由器就会象死机一样停止反应。 g < |
Cj GuSh>E
怎么样,你看一遍这篇文章用了多少时间。下面可以找几台路由器,试着配置一下,不是很困难吧
iNnTT>O
测试配置正确性 'bJwiLy
Wg|i;%1*z
配置RIP之后,要检查数据是否可以被正确路由。除了可以使用上面提到的连通性测试工具之外,还有以下几个命令: i @sh ip route用于检测路由表; TKAx!% d&G
sh ip protocols用于检查路由协议状况; NY+pt7K
debug ip rip用于调试RIP协议信息。 U=?{u)LP[9
=bQ5[&/s2
使用sh ip route命令显示各台路由器的路由表。 Kpf![Y.
R+|5y_1<
testBJ#sh ip route AP>WKIHE
4Q` n 3
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP $y#s:,*D
(@h{Yxp
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area $ j(SO1
Rf9A7kof
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 CNqD@EE_
uzlmuvY
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP \|4 n3ordn
`[Sm7PO)
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, SC @0P Q
U1Q2{Kd'4
* - candidate default, U - per-user static route, o - ODR zF7BMqC
'z^OYaW
Gateway of last resort is not set dN9_V%=R
"yi)PI/F
172.16.0.0/24 is subnetted, 4 subnets e fYx_1,x
ziFP>A[3V
R 172.16.4.0 [120/1] via 172.16.2.2, 00:00:12, Serial1/0 3G(hrcG*
ja8 uJ
C 172.16.1.0 is directly connected, Ethernet0/1 :(Xo{6<0k
o#-?jKs
C 172.16.2.0 is directly connected, Serial1/0 ~sV9swt
04{`hnc
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:09, Ethernet0/1 pa' I8
YrXu~,Dtb
[120/1] via 172.16.2.2, 00:00:22, Serial1/0 f=k5NoA
]+[ k
上面显示的是北京路由器的路由信息。字母C开头的是直接相连的网络,有172.16.1.0和172.16.2.0,分别连接在e0/1和s1/0端口上。字母R开头的是RIP协议学习到的路由,有172.16.3.0和172.16.4.0,其中,到172.16.3.0有两条路径供选择,分别经由testSH和testTJ路由器。对比网络拓扑图,可以看出实际情况与设计的完全一致。 z" QxCBI$
B>.%$ 'Z{
中括号里的内容是路由项的管理距离和度量值,RIP的缺省管理距离是120,到达3、4子网的度量值是1,即经过1个路由器可达。 _jznUJ
RK{ytd!t
同样的命令在另外两台路由器上运行,结果如下。 4hvw>4e
ZtWAS
testSH#sh ip route >8xR[\)N i
Is2Zf lv
Gateway of last resort is not set RVR-X@8<
tORrZ>F?6
172.16.0.0/24 is subnetted, 4 subnets %^&b1X/|
kt/OPGHV(A
R 172.16.4.0 [120/1] via 172.16.3.2, 00:00:13, Ethernet0/0 ~Q:0p:8/
s?|SOs}
C 172.16.1.0 is directly connected, Ethernet0/1 nbQU2;[ .
yJQ r ?n
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:11, Ethernet0/1 4Rj`<.J/
mie&8aC
[120/1] via 172.16.3.2, 00:00:13, Ethernet0/0 r{P_2\Bc
T Sj> J3R
C 172.16.3.0 is directly connected, Ethernet0/0 ~4,k*bPm
vVF?e05^'
testTJ#sh ip route \y):C(|K
XuCa_A.K
Gateway of last resort is not set C_< CyZb,$
$.6Xv
172.16.0.0/24 is subnetted, 4 subnets gN/fxmR
^/2w`c9
C 172.16.4.0 is directly connected, Ethernet0/0 JsWx$pC
p[Ug1x :
R 172.16.1.0 [120/1] via 172.16.3.3, 00:00:07, Ethernet0/1 a (dd Dss
3xle hZM
[120/1] via 172.16.2.3, 00:00:19, Serial1/0 wbDcDJvF
+6(~%&
C 172.16.2.0 is directly connected, Serial1/0 v|e 4*'
n&Gj{CT
C 172.16.3.0 is directly connected, Ethernet0/1 x@fa%R=!,=
KR
buK 8ig
testBJ#sh ip route LD(}S:j
n67***%e
Gateway of last resort is not set qMxaOprS
gC5F42sF
172.16.0.0/24 is subnetted, 3 subnets RO>0x^YR
BC4%P?gA~
R 172.16.4.0 [120/2] via 172.16.1.3, 00:00:22, Ethernet0/1 y:'qr{$m
C 172.16.1.0 is directly connected, Ethernet0/1 R,RF"y`g6
K3nfGk_M
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:22, Ethernet0/1 }!'K|P
我们发现串行链路所在的子网2断开了,到网络172.16.4.0网络的数据包都将绕经testSH路由器。 H5RV80R@5
pnp1]j[6
sh ip protocols命令可以显示当前路由协议的状况,如下所示。 +:3J ~H%
&xSp js"
testBJ#sh ip protocols 1HZ9zv0cC
,b!b'|@T
Routing Protocol is "rip" '$@g {
'TBo(- E8[
Sending updates every 30 seconds, next due in 19 seconds !}(~tAQ
"XP$@*
Invalid after 180 seconds, hold down 180, flushed after 240 x(\QkX
J.M9WgWT$
Outgoing update filter list for all inte***ces is not set /.iayd$jH
CZZ}|
Incoming update filter list for all inte***ces is not set RUlM"w@
;hz ~N8i
Redistributing: connected, rip sRhMQJHa3
8vg ]R~/~
Default version control: send version 1, receive any version Lqkog"|3
Ky R_`|
Y'v(U-
Ethernet0/1 1 1 2 /iO3h!C
bfVZva
Serial1/0 1 1 2 <>)_c4S?
>|S d
Routing for Networks: F6C7r,OA
9 qoy"hX
172.16.0.0 `o(}F21
VHBsATf
Routing Information Sources: ]=R:eZY@
_/`? f (D
Gateway Distance Last Update /EJPZ^nr
Gwtz&W+V
172.16.2.2 120 00:00:05 H^ =_.`j/
`V@ CBHg
172.16.1.3 120 00:00:27 vRon>ex;
~0[3O|JG
Distance: (default is 120) 5USfB /^
+h< `R_
从命令输出中,可以看出RIP协议的基本配置,还可以得知与当前路由器交换信息的路由器有testTJ(172.16.2.2)和testSH(172.16.1.3)两台路由器,上次接收路由信息分别在5秒和27秒之前。 4pFn6 0"
FV6|! 3H
要了解路由器之间交换路由信息的详情,可以使用debug ip rip命令。如下所示,输入命令后,隔一段时间,控制台上出现接收或者发送RIP广播的信息。 $S WIM
zC~,yh7C&
testBJ#debug ip rip ||eAWvt(V
T'i0IZ5-
RIP protocol debugging is on h3zJHWQt
DS%^"(q
testBJ# z5j5lF/ ;
4P#9q)u*
RIP: received v1 update from 172.16.2.2 on Serial1/0 }R!X
>'E TO[e4
172.16.4.0 in 1 hops $;q|>o"8
I,9xHj
172.16.3.0 in 1 hops ("t?.xt
eWSt|t~
RIP: received v1 update from 172.16.1.3 on Ethernet0/1 u4j_R`2qqp
[390J_
172.16.4.0 in 2 hops ct[s}4
pfzbA1qlyV
172.16.3.0 in 1 hops -*T _~,
,iaX!}r
RIP: sending v1 update to 255.255.255.255 via Ethernet0/1 (172.16.1.2) fUZ'(3_
U!YGW$s -g
subnet 172.16.4.0, metric 2 USBFngvr
RT=~hE:'
subnet 172.16.2.0, metric 1 KGjn_v6Gr
Xa35ZobSG
RIP: sending v1 update to 255.255.255.255 via Serial1/0 (172.16.2.3) .Rt:^z{L
U.zltK#y]R
subnet 172.16.1.0, metric 1 On( Y]MV
.lGf9.<
RIP: received v1 update from 172.16.1.3 on Ethernet0/1 W;EJ|J;6
*IbMOa}m+
172.16.4.0 in 2 hops |^Tfc!bx'
E$)vf
172.16.3.0 in 1 hops $#P D1A
g.MIhrf{
RIP: received v1 update from 172.16.2.2 on Serial1/0 zR,Hhp#Pt
cQ+VwX^c
172.16.4.0 in 1 hops F]7-3{8|
S[[%&%O
172.16.3.0 in 1 hops %!w_i0W
K[ #7UEYp
testBJ#no debug all ObljxQ xav
ZDrP+Th_
All possible debugging has been turned off I?=Xd/bNuA
:/cZt.)
testBJ# CQ ?uYub"
}pb'^t*@
从上述信息中可以得到RIP广播的详情。路由器先是从testTJ收到子网3、4的信息,然后又从testSH收到子网3、4的信息。其中,到子网4走testTJ一跳,走testSH两跳,所以,路由表中反映出来的是经由testTJ到子网4;到子网3的距离都是一跳,所以,路由表中有两条并列的路由。 oU_9/GY$eA
f :v)v
一段时间后,当前路由器的更新计时达到30秒,于是,它在两条链路上广播自身的路由表信息。注意,广播路由更新时,RIP采用了水平分割机制,从一个端口上学得的信息就不在这个端口上进行广播,所以当前路由器testBJ只发送子网172.16.1.0的路由信息。 Ew9J`+ZU
2p>k/-q
使用no debug all命令结束调试信息的显示。需要注意的是debug命令非常消耗路由器资源,所以不要在通讯繁忙的路由器上使用,否则,路由器就会象死机一样停止反应。 g < |
Cj GuSh>E
怎么样,你看一遍这篇文章用了多少时间。下面可以找几台路由器,试着配置一下,不是很困难吧
MSCD龙帝国计算机和语言学习论坛 :: 网络技术交流区 :: 路由器技术交流区
第1页/共1页
您在这个论坛的权限:
您不能在这个论坛回复主题