實(shí)驗(yàn)四
課程名稱:
網(wǎng)絡(luò)互連技術(shù)
任課教師:
曹洪武
機(jī) ???房:
?
計(jì)算機(jī)編號:
?
實(shí)驗(yàn)班級:
網(wǎng)絡(luò)工程2020級???班
學(xué)生姓名:
?
實(shí)驗(yàn)日期:
2023年4月?日
實(shí)驗(yàn)成績:
?
實(shí)驗(yàn)名稱:
實(shí)驗(yàn)4 RIP計(jì)時(shí)器實(shí)驗(yàn)
實(shí)驗(yàn)設(shè)備、環(huán)境
計(jì)算機(jī)、Windows 10、Cisco packet tracer 8.2模擬器
1、實(shí)驗(yàn)?zāi)繕?biāo):
通過實(shí)驗(yàn)調(diào)試RIP,觀察定時(shí)器的情況,理解定時(shí)器的原理。
2、實(shí)驗(yàn)連接圖:
?
圖1 ?路由器連接示意圖
?
?
3、實(shí)驗(yàn)要點(diǎn):
RIP?的四個(gè)主要計(jì)時(shí)器:
(1)更新定時(shí)器:30秒(用于設(shè)置定期路由更新的時(shí)間間隔)
(2)無效定時(shí)器:180秒(路由器在認(rèn)定一個(gè)路由成為無效路由之前所需要等待的時(shí)間)
(3)保持定時(shí)器:180秒(用于設(shè)置路由信息被抑制的時(shí)間)
(4)刷新定時(shí)器:240秒(用于設(shè)置某個(gè)路由成為無效路由并將它從路由表中刪除的時(shí)間)
4、實(shí)驗(yàn)調(diào)試及監(jiān)測步驟:
(1)基本配置:
R1的配置:
R2的配置:
!
hostname R2
!
interface Loopback0
?ip address 2.2.2.2 255.255.255.0
!
interface Serial1/0
no shut
?ip address 12.1.1.2 255.255.255.0
!
interface Serial1/1
?no shut
?ip address 23.1.1.2 255.255.255.0
!
router rip
?network 0.0.0.0
!
R3的配置:
!
hostname R3
!
interface Loopback0
?ip address 3.3.3.3 255.255.255.0
!
interface Serial1/0
?no shut
?ip address 23.1.1.3 255.255.255.0
clock rate 64000
!
router rip
network 0.0.0.0
!
(2)詳細(xì)配置級測試步驟
查看各路由器路由表的情況:
R1#show ip route
?????1.0.0.0/24 is subnetted, 1 subnets
C???????1.1.1.0 is directly connected, Loopback0
R????2.0.0.0/8 [120/1] via 12.1.1.2,?00:00:00, Serial1/1
R????3.0.0.0/8 [120/2] via 12.1.1.2,?00:00:00, Serial1/1
R????23.0.0.0/8 [120/1] via 12.1.1.2,?00:00:00, Serial1/1
?????12.0.0.0/24 is subnetted, 1 subnets
C???????12.1.1.0 is directly connected, Serial1/1
R2#show ip route
R????1.0.0.0/8 [120/1] via 12.1.1.1,?00:00:26, Serial1/0
?????2.0.0.0/24 is subnetted, 1 subnets
C???????2.2.2.0 is directly connected, Loopback0
R????3.0.0.0/8 [120/1] via 23.1.1.3,?00:00:10, Serial1/1
?????23.0.0.0/24 is subnetted, 1 subnets
C???????23.1.1.0 is directly connected, Serial1/1
?????12.0.0.0/24 is subnetted, 1 subnets
C???????12.1.1.0 is directly connected, Serial1/0
R3#show ip route
R????1.0.0.0/8 [120/2] via 23.1.1.2,?00:00:20, Serial1/0
R????2.0.0.0/8 [120/1] via 23.1.1.2,?00:00:20, Serial1/0
?????3.0.0.0/24 is subnetted, 1 subnets
C???????3.3.3.0 is directly connected, Loopback0
?????23.0.0.0/24 is subnetted, 1 subnets
C???????23.1.1.0 is directly connected, Serial1/0
R????12.0.0.0/8 [120/1] via 23.1.1.2,?00:00:20,?Serial1/0
通過路由表已經(jīng)看到各個(gè)路由器都學(xué)到了路由信息,只要通過重復(fù)show ip route?就可以查看到路由器條目陰影部分的時(shí)間在30s內(nèi)變化。
?
?
?
?
看看在R1上show ip protocols輸出的信息,留意定時(shí)器部分:
R1#show ip protocols
Routing Protocol is "rip"
??Sending updates every?30 seconds, next due in 24 seconds
??Invalid after?180 seconds,?hold down?180,?flushed after?240
??Outgoing update filter list for all interfaces is not set
??Incoming update filter list for all interfaces is not set
??Redistributing: rip
??Default version control: send version 1, receive any version
????Interface???Send??Recv??Triggered RIP??Key-chain
????Serial1/1????1?????1 ?????????2?
????Loopback0????1????1??????????2?
??Automatic network summarization is in effect
??Maximum path: 4
??Routing for Networks:
????0.0.0.0
??Routing Information Sources:
????Gateway?????????Distance??????Last Update
????12.1.1.2????????????120??????????00:00:26
??Distance: (default is 120)
?
下面通過debug觀察路由表的變化情況:
1:R1#debug ip routing
R1#debug ip rip
2:在R1上,做個(gè)訪問列表,不接收來自R2的rip數(shù)據(jù)包
R1(config)#access-list 110?deny udp any any eq rip
R1(config)#access-list 110 permit ip any any
R1(config-if)#ip access-group 110 in
3:再看看R1這是的debug信息:
R1#
*Mar??4 16:21:46.123: RT:?delete route to 2.0.0.0?via 12.1.1.2, rip metric [120/1]
*Mar??4 16:21:46.123: RT: no routes to 2.0.0.0, entering holddown
*Mar??4 16:21:46.127: RT:?delete route to 3.0.0.0?via 12.1.1.2, rip metric [120/2]
*Mar??4 16:21:46.131: RT: no routes to 3.0.0.0, entering holddown
*Mar??4 16:21:46.131: RT:?delete route to 23.0.0.0?via 12.1.1.2, rip metric [120/1]
*Mar??4 16:21:46.135: RT: no routes to 23.0.0.0, entering holddown
R1#
*Mar??4 16:21:48.127: RIP: sending v1 flash update to 255.255.255.255 via Loopback0 (1.1.1.1)
*Mar??4 16:21:48.127: RIP: build flash update entries
*Mar??4 16:21:48.131:???network 2.0.0.0 metric 16
*Mar??4 16:21:48.131:???network 3.0.0.0 metric 16
*Mar??4 16:21:48.131:???network 23.0.0.0 metric 16
會在180之后,來自R2路由條目,被宣告無效(即invail計(jì)時(shí)器走完)。
?
R1#show ip route
Codes: C - connected, S - static, 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
???i - IS-IS, su - IS-IS summary, 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?1.0.0.0/24 is subnetted, 1 subnets
C???????1.1.1.0 is directly connected, Loopback0
R????2.0.0.0/8 is?possibly down, routing via 12.1.1.2, Serial1/1
R????3.0.0.0/8 is?possibly down, routing via 12.1.1.2, Serial1/1
R????23.0.0.0/8 is?possibly down, routing via 12.1.1.2, Serial1/1
?????12.0.0.0/24 is subnetted, 1 subnets
C???????12.1.1.0 is directly connected, Serial1/1
查看R1路由表已經(jīng)出現(xiàn)了possibly down,在保持時(shí)間計(jì)時(shí)器段。
?
R1#
*Mar??4 16:22:46.135: RT:?delete network route to 2.0.0.0
*Mar??4 16:22:46.135: RT: NET-RED 2.0.0.0/8
*Mar??4 16:22:46.139: RT:?delete network route to 3.0.0.0
*Mar??4 16:22:46.139: RT: NET-RED 3.0.0.0/8
*Mar??4 16:22:46.143: RT:?delete network route to 23.0.0.0
*Mar??4 16:22:46.143: RT: NET-RED 23.0.0.0/8
?
通過上面時(shí)間的對比,在宣布無效之后的大概60s內(nèi),學(xué)自R2的路由條目在路由表里面被刪除,即刷新計(jì)時(shí)器如圖所示為180+60=240s。這個(gè)計(jì)時(shí)器是剛開始就啟動的,一直到保持計(jì)時(shí)器進(jìn)行到60s時(shí)(即刷新計(jì)時(shí)器和無效計(jì)時(shí)器同時(shí)觸發(fā)),它將路由表刷新.在將它(無效路由)從表中刪除前,路由器會通告它的鄰居這個(gè)路由即將消亡。
?
上面的是使用默認(rèn)的時(shí)間,調(diào)試過程時(shí)間較長,我們可以通過修改timer來使調(diào)試的結(jié)果更加明顯。
?
R1(config)#int s1/1
R1(config-if)#no ip access-group 110 in
R1(config-router)#timer basic ?
??<0-4294967295>??Interval between?updates
R1(config-router)#timer basic 5 ?
??<1-4294967295>??Invalid
R1(config-router)#timer basic 5 10 ?
??<0-4294967295>??Holddown
R1(config-router)#timer basic 5 10 15 ?
??<1-4294967295>??Flush
R1(config-router)#timer basic?5 10 15 20
?
R2(config)#router rip
R2(config-router)#timer basic 5 10 15 20
?
R3(config)#router rip
R3(config-router)#timer basic 5 10 15 20
?
觀察留意show ip protocols?各個(gè)時(shí)間值已經(jīng)改變了
?
R1#show ip protocols
Routing Protocol is "rip"
??Sending updates every?5?seconds, next due in 2 seconds
??Invalid after?10?seconds, hold down?15, flushed after?20
??Outgoing update filter list for all interfaces is not set
??Incoming update filter list for all interfaces is not set
??Redistributing: rip
??Default version control: send version 1, receive any version
????Interface?????????????Send??Recv??Triggered RIP??Key-chain
????Serial1/1?????????????1?????1 2?????????????????????????????????
????Loopback0?????????????1?????1 2??????????????????????????????????
??Automatic network summarization is in effect
??Maximum path: 4
??Routing for Networks:
????0.0.0.0
??Routing Information Sources:
????Gateway?????????Distance??????Last Update
????12.1.1.2?????????????120??????00:00:01
??Distance: (default is 120)
現(xiàn)在再次恢復(fù)訪問列表,使R1不接收來自R2的RIP路由,且在R1上打開debug?觀察:
?
R1(config)#int s1/1
R1(config-if)#ip access-group 110 in
?
R1#debug ip rip
RIP protocol debugging is on
?
R1#
*Mar??4 17:02:26.795: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (12.1.1.1)
*Mar??4 17:02:26.795: RIP: build update entries
*Mar??4 17:02:26.799:???network 1.0.0.0 metric 1
*Mar??4 17:02:26.799:???network 2.0.0.0 metric?16
*Mar??4 17:02:26.799:???network 3.0.0.0 metric?16
*Mar??4 17:02:26.803:???network 23.0.0.0 metric?16
*Mar??4 17:02:28.151: RIP: sending v1 flash update to 255.255.255.255 via Serial1/1 (12.1.1.1)
-------------------------------省略部分信息-------------------------------------
R1#
*Mar??4 17:02:33.067: RIP: sending v1 update to 255.255.255.255 via Loopback0 (1.1.1.1)
*Mar??4 17:02:33.067: RIP: build update entries
*Mar??4 17:02:33.071:???network 2.0.0.0 metric 16
*Mar??4 17:02:33.071:???network 3.0.0.0 metric 16
*Mar??4 17:02:33.071:???network 12.0.0.0 metric 1
*Mar??4 17:02:33.071:???network 23.0.0.0 metric 16
R1#
*Mar??4 17:02:36.687: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (12.1.1.1)
*Mar??4 17:02:36.687: RIP: build update entries
*Mar??4 17:02:36.691:???network 1.0.0.0 metric 1
從以上debug結(jié)果觀察到,第一次通告不可達(dá)(metric 16)的時(shí)間為02:26?到來自R2的路由消失時(shí)間為02:36?的間隔為10s(即是Invalid計(jì)時(shí)器和Flush計(jì)時(shí)器差為10s),與我們設(shè)置的時(shí)間一致。
?
?
5、總結(jié):
在距離矢量路由協(xié)議里面,路由器會將它學(xué)習(xí)的整張路由表信息更新發(fā)出去,Rip使用4種計(jì)時(shí)器來管理它的性能:
1:周期更新計(jì)時(shí)器 周期更新計(jì)時(shí)器用于設(shè)置定期路由更新的時(shí)間間隔(一般為30s),在這個(gè)間隔里路由器發(fā)送一個(gè)自己路由表的完整拷貝到所有相鄰的路由器。
2:無效計(jì)時(shí)器 用于決定一個(gè)時(shí)間長度,即路由器在認(rèn)定一個(gè)路由成為無效路由之前所需要等待的時(shí)間(180s,實(shí)際情況往往略大于180s).如果路由器在更新計(jì)時(shí)器期間沒有得到關(guān)于某個(gè)指定路由的任何更新消息,它將認(rèn)為這個(gè)路由失效,這時(shí)就會進(jìn)入到無效計(jì)時(shí)器階段.當(dāng)這一情況發(fā)生時(shí),這個(gè)路由器將會給它所有的鄰居發(fā)送一個(gè)更新消息以通知它們這個(gè)路由已經(jīng)無效。
?3:保持計(jì)時(shí)器 用于設(shè)置路由信息被抑制的時(shí)間數(shù)量.當(dāng)上述無效計(jì)時(shí)器計(jì)時(shí)完畢后,就會進(jìn)入到保持計(jì)數(shù)器階段.也可理解為,當(dāng)指示某個(gè)路由為不可達(dá)的更新數(shù)據(jù)包被接受到時(shí),路由器將會進(jìn)入保持失效狀態(tài).這個(gè)狀態(tài)將會一直持續(xù)到一個(gè)帶有更好度量的更新數(shù)據(jù)包被接受到或者這個(gè)保持計(jì)時(shí)器到期.默認(rèn)時(shí),它的取值是180s.在進(jìn)入到這個(gè)階段的前60s,會顯示一個(gè)如下的路由信息possibly down,這時(shí)路由器并沒有直接刪除這條路由信息,但記住,若此時(shí)該路由恢復(fù)正常通訊,路由表信息也不會更新,在接下來的120s會起到一個(gè)保持網(wǎng)絡(luò)穩(wěn)定的作用。
4:刷新計(jì)時(shí)器 用于設(shè)置某個(gè)路由成為無效路由并將它從路由表中刪除的時(shí)間間隔(240s).這個(gè)計(jì)時(shí)器是剛開始就啟動的,一直到保持計(jì)時(shí)器進(jìn)行到60s時(shí),它將路由表刷新.在將它(無效路由)從表中刪除前,路由器會通告它的鄰居這個(gè)路由即將消亡。
5:我們也可以用time basic?來改變計(jì)時(shí)器的時(shí)間間隔。
timers basic?update invalid holddown flush
?
?