rip v2 路由更新中的子网掩码哪来的

2025-01-20 02:01:56
推荐回答(5个)
回答1:

V2 的更新是携带子网掩码的,你可以开DEBUG仔细观察.

------------R1--------------R2--------------
N1 N2 N3

N1:1.1.1.1 /24
N2:192.168.1.0/24
N3:2.2.2.2/24

V1
*Mar 1 00:11:29.679: RIP: received v1 update from 192.168.1.2 on Serial0/0
*Mar 1 00:11:29.679: RIP-DB: network_update with 2.0.0.0/8 succeeds
*Mar 1 00:11:29.679: RIP-DB: adding 2.0.0.0/0 (metric 1) via 192.168.1.2 on Serial0/0 to RIP database
*Mar 1 00:11:29.683: RIP-DB: add 2.0.0.0/8 (metric 1) via 192.168.1.2 on Serial0/0
*Mar 1 00:11:29.683: RIP-DB: Adding new rndb entry 2.0.0.0/8
*Mar 1 00:11:29.683: RIP-DB: Created rip ndb summary entry for 2.0.0.0/8
*Mar 1 00:11:29.687: RIP-DB: Adding new rndb entry 2.0.0.0/8
*Mar 1 00:11:29.687: RIP: Update contains 1 routes
R1#show ip rip database
1.0.0.0/8 auto-summary
1.1.1.0/24 directly connected, Loopback0
2.0.0.0/8 auto-summary
2.0.0.0/8
[1] via 192.168.1.2, 00:00:04, Serial0/0
192.168.1.0/24 auto-summary
192.168.1.0/24 directly connected, Serial0/0
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 192.168.1.2, 00:00:03, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/0
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````
V2
*Mar 1 00:06:07.995: RIP: received v2 update from 192.168.1.2 on Serial0/0
*Mar 1 00:06:07.995: RIP-DB: network_update with 2.2.2.0/24 succeeds
*Mar 1 00:06:07.999: RIP-DB: adding 2.2.2.0/24 (metric 1) via 192.168.1.2 on Serial0/0 to RIP database
*Mar 1 00:06:07.999: RIP-DB: add 2.2.2.0/24 (metric 1) via 192.168.1.2 on Serial0/0
*Mar 1 00:06:07.999: RIP-DB: Adding new rndb entry 2.2.2.0/24
*Mar 1 00:06:08.003: RIP-DB: Created rip ndb summary entry for 2.0.0.0/8
*Mar 1 00:06:08.003: RIP-DB: Adding new rndb entry 2.0.0.0/8
*Mar 1 00:06:08.003: RIP: Update contains 1 routes
R1#show ip rip database
1.0.0.0/8 auto-summary
1.1.1.0/24 directly connected, Loopback0
2.0.0.0/8 auto-summary
2.2.2.0/24
[1] via 192.168.1.2, 00:00:04, Serial0/0
192.168.1.0/24 auto-summary
192.168.1.0/24 directly connected, Serial0/0
R1#show ip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 192.168.1.2, 00:00:22, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/0

回答2:

RIPv2以主类网络来发布网段,不管你network后面跟的是什么,它都给你划到主类网络中去的。例如network 1.1.1.1 ,实际有效的show run 中会显示1.0.0.0 ;再如network 172.16.18.0 实际有效的是172.16.0.0

回答3:

我前天也在想这个问题 现在想明白了 rip 的路由条目是根据ip地址的掩码学来的 所以ip掩到第几位 路由表里就掩到第几位。。。

回答4:

以最初路由来源接口的掩码为路由消息网络前缀,在更新中是包含掩码信息的。一直传播下去

回答5:

刚好看完课程。其实宣告只是宣告接口,形式是主类宣告。但发送更新的时候,报头里是有subnet mask字段的。所以就携带掩码了