版權聲明:
原創做品,如需轉載,請與做者聯繫。不然將追究法律責任。
|
拓撲如上:
R1
:
Router>en
Router#conf t Router(config)#hostname R1 R1(config)#int R1(config)#interface f0/0 R1(config-if)#ip address 192.168.1.254 255.255.255.0 R1(config-if)#no sh R1(config-if)#int f0/1 R1(config-if)#ip add R1(config-if)#ip address R1(config-if)#no sh R1(config-if)#exit R1(config)#router rip -- 進入並啓用 RIP 配置模式 R1(config-router)#version 2 -- 指定版本 2 R1(config-router)#no auto-summary -- 不要自動彙總 R1(config-router)#network 12.1.1.0 -- 宣告直連的網段 R1(config-router)#network 192.168.1.0 -- 宣告直連的網段 R1(config-router)#end 查看路由表: R1#show ip route 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
C 12.1.1.0 is directly connected, FastEthernet0/ R 192.168.2.0/24 [120/1] vi
R
是經過
RIP
路由學習到
192.168.2.0/24
網段
R2
:
Router(config)#hostname R2 R2(config)#interface f0/1 R2(config-if)#ip address R2(config-if)#no sh R2(config)#interface f0/0 R2(config-if)#ip address 192.168.2.254 255.255.255.0 R2(config-if)#no sh R2(config-if)#exit R2(config)#router rip R2(config-router)#version 2 R2(config-router)#no auto-summary R2(config-router)#network 192.168.2.0 R2(config-router)#network 12.1.1.0 R2(config-router)#end
R2#show ip route
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
C 12.1.1.0 is directly connected, FastEthernet0/1 R 192.168.1.0/24 [120/1] vi
驗證在
PC0
上拼
PC1
:
PC>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=73ms TTL=126
Reply from 192.168.2.1: bytes=32 time=28ms TTL=126 Reply from 192.168.2.1: bytes=32 time=53ms TTL=126 Reply from 192.168.2.1: bytes=32 time=62ms TTL=126
Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 28ms, Maximum = 73ms, Average = 54ms
總結:
RIP
的工做原理在前面都有介紹,下面解釋一下爲何要指定版本
2
(
version 2
),版本
1
與版本
2
最大的區別就是,
2
是以組播的方式發送更新,地址爲
224.0.0.9
,且支持可變長子網掩碼,而
1
是
廣播的方式發送更新,且不支持變長子網掩碼!
|