RIP offset-list

RIPoffset-list实验拓扑图如下:


                       1offset-list实验拓扑图


首先,按照上图配置一下,把RIP配通。这里就不做详细的说明了。

配置offset-list
r1(config)#router rip
r1(config-router)#offset-l 1 in 16 s1/0
r1(config-router)#end
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



1.0.0.0/24 is subnetted, 1 subnets

//
所有的RIP路由信息都没有了,因为已经把跳数改为16跳,即不可达。
C
1.1.1.0 is directly connected, Loopback0


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial1/0


r1#sh ru
Building configuration...

Current configuration : 614 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r1
!
!
clock timezone CST 8
ip subnet-zero
no ip domain lookup
!
!
!
!
interface Loopback0

ip address 1.1.1.1 255.255.255.0

!
interface Ethernet0/0

no ip address


shutdown

!

interface Serial1/0

ip address 12.1.1.1 255.255.255.0

!

interface Serial2/0

no ip address


shutdown

!

router rip

offset-list 1 in 16 Serial1/0


network 1.0.0.0


network 12.0.0.0

!

ip classless
no ip http server
!

!

!

!

!

line con 0

exec-timeout 0 0


logging synchronous

line aux 0
line vty 0 4
!

End

Offset-list命令就是手工把协议的Matric值修改了。
通过这个实验得知,在正常没有人工配置任何破环机制的情况下,RIP知道一个接口或网断16跳,即不可达。它会立即删除路由表里的对应项,然后把这个信息转发给自己的下一跳路由器
删除16跳修改取消后在改为8跳。
offset-list 1 in 8 Serial1/0在原来的基础之上加8跳,而不是改为8跳。
r1#conf t
Enter configuration commands, one per line.
End with CNTL/Z.

r1(config)#router rip
r1(config-router)#offset-l 1 in 8 s1/0
r1(config-router)#end


更新前:
r1#sh ip rou
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


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:27, Serial1/0

R
3.0.0.0/8
[120/2] via 12.1.1.2, 00:00:27, Serial1/0

R
5.0.0.0/8
[120/1] via 12.1.1.2, 00:00:27, Serial1/0

R
23.0.0.0/8
[120/1] via 12.1.1.2, 00:00:27, Serial1/0

R
8.0.0.0/8
[120/1] via 12.1.1.2, 00:00:27, Serial1/0


12.0.0.0/24 is subnetted, 1 subnets

C

12.1.1.0 is directly connected, Serial1/0


更新后:
r1#sh ip rou
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


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/9] via 12.1.1.2, 00:00:05, Serial1/0

R
3.0.0.0/8
[120/10] via 12.1.1.2, 00:00:05, Serial1/0

R
5.0.0.0/8
[120/9] via 12.1.1.2, 00:00:05, Serial1/0

R
23.0.0.0/8
[120/9] via 12.1.1.2, 00:00:05, Serial1/0

R
8.0.0.0/8
[120/9] via 12.1.1.2, 00:00:05, Serial1/0


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial1/0


把更新前和更新后的路由表对比一下便不难得出结论。他自己的路由表全加上了8跳。

R2的路由表信息
r2#sh ip rou
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
1.0.0.0/8 [120/1] via 12.1.1.1, 00:00:09, Serial2/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:24, Serial1/0


5.0.0.0/24 is subnetted, 1 subnets

C
5.5.5.0 is directly connected, Loopback1


23.0.0.0/24 is subnetted, 1 subnets

C
23.1.1.0 is directly connected, Serial1/0


8.0.0.0/24 is subnetted, 1 subnets

C
8.8.8.0 is directly connected, Loopback2


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial2/0


R3的路由表信息
r3# sh ip rou
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
1.0.0.0/8 [120/2] via 23.1.1.2, 00:00:00, Serial2/0

R
2.0.0.0/8 [120/1] via 23.1.1.2, 00:00:00, Serial2/0


3.0.0.0/24 is subnetted, 1 subnets

C
3.3.3.0 is directly connected, Loopback0

R
5.0.0.0/8 [120/1] via 23.1.1.2, 00:00:00, Serial2/0


23.0.0.0/24 is subnetted, 1 subnets

C
23.1.1.0 is directly connected, Serial2/0

R
8.0.0.0/8 [120/1] via 23.1.1.2, 00:00:00, Serial2/0

R
12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:00, Serial2/0


R2R3的路由表信息与R1的信息对比便知,如果命令里是in那么R2R3的路由表里的跳数是不会变的。
要取消修改用r1(config-router)#no offset-l 1 in 8 s1/0

下面在看一下修改为out的情况
R1上:
r1(config)#router rip
r1(config-router)#offset-l 1 out 8 s1/0
r1(config-router)#end

R1的路由表信息
r1#sh ip rou
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


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:02, Serial1/0

R
3.0.0.0/8 [120/2] via 12.1.1.2, 00:00:02, Serial1/0

R
5.0.0.0/8 [120/1] via 12.1.1.2, 00:00:02, Serial1/0

R
23.0.0.0/8 [120/1] via 12.1.1.2, 00:00:02, Serial1/0

R
8.0.0.0/8 [120/1] via 12.1.1.2, 00:00:02, Serial1/0


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial1/0


R1自身路由表的信息没有变化。
R2的路由表信息
r2#sh ip rou
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
1.0.0.0/8
[120/9] via 12.1.1.1, 00:00:04, Serial2/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:23, Serial1/0


5.0.0.0/24 is subnetted, 1 subnets

C
5.5.5.0 is directly connected, Loopback1


23.0.0.0/24 is subnetted, 1 subnets

C
23.1.1.0 is directly connected, Serial1/0


8.0.0.0/24 is subnetted, 1 subnets

C
8.8.8.0 is directly connected, Loopback2


12.0.0.0/24 is subnetted, 1 subnets

C
12.1.1.0 is directly connected, Serial2/0


R3的路由表信息
r3# sh ip rou
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
1.0.0.0/8
[120/10] via 23.1.1.2, 00:00:18, Serial2/0

R
2.0.0.0/8 [120/1] via 23.1.1.2, 00:00:18, Serial2/0


3.0.0.0/24 is subnetted, 1 subnets

C
3.3.3.0 is directly connected, Loopback0

R
5.0.0.0/8 [120/1] via 23.1.1.2, 00:00:18, Serial2/0


23.0.0.0/24 is subnetted, 1 subnets

C
23.1.1.0 is directly connected, Serial2/0

R
8.0.0.0/8 [120/1] via 23.1.1.2, 00:00:18, Serial2/0

R
12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:18, Serial2/0


而其他的路由器针对R1的条目信息发生了变化。


通过上边的两个尝试得知,命令中inout的区别:
区别是inout都是把定义自己是第8跳。所不同的是in是在路由表信息进来的时候那个接口改的,自然其它路由器就不改了,当自身路由器的路由更新发出去的时候再减回去;而out是把发给其他路由器的条目修改了,所以其他路由器的条目也就随之更新了,而自己却不做任何修改,其他路由器更新发回来时它再减回去。也可以理解为in是在接口告诉进来的更新自己是第8跳,出去时再告诉更新自己是第0跳;而out则相反只告诉出去的更新自己是第8跳,进来的更新会告诉它自己是第0跳。
所以就出现下列现象,
InR1认为,R29R310;而R3认为R21R12
OutR1认为,R21R32;而R3认为R29R110