要求:
配置RIPV1协议,实现全网互通,并防止RIP路由向不必要的接口通告,然后验证水平分割特性。
基础配置
1. 设置路由器R1和R2的IP地址;
2. 为PC1—PC3设置IP地址,并将网关指为R1的F0/0的地址1.251,将PC4的网关设为3.1。
配置RIPV1
1. RIPV1的配置
r1(config)#router rip
r1(config-router)#network 192.168.1.0
r1(config-router)#network 192.168.2.0
r2(config)#router rip
r2(config-router)#network 192.168.2.0
r2(config-router)#network 192.168.3.0
然后,查看路由表,显示如下:
r1#sh 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
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial1/0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:21, Serial1/0
r2#sh ip route
R 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:12, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
在PC1上测试,结果显示PC1可以通过R1和R2访问PC2。
PC>ping 192.168.3.2
Reply from 192.168.3.2: bytes=32 time=125ms TTL=126
Reply from 192.168.3.2: bytes=32 time=109ms TTL=126
2. 查看 RIP的Debug调试信息:V1的更新目标为广播255.255.255.255 ,V2为组播224.0.0.9。
R1# debug ip rip 调试RIP运行状况
r1# undebug all 关闭所有调试
r1#terminal monitor 打开telnet 日志显示功能
RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.2.1)
RIP: build update entries
network 192.168.1.0 metric 1
RIP: received v1 update from 192.168.2.2 on Serial1/0
192.168.3.0 in 1 hops
3. 抑制RIP传播,不要把路由告诉不需要知道的设备。
Passive-interface(被动接口---只接收,不发送)命令可以防止RIP更新向不必要的网络
扩散,如局域网的PC 、loopback接口 和Internet.
R1(config –router )# Passive-interface f0/0
实验结果:没有配置置Passive-interface f0/0前,RIP会向f0/0发送路由,配置之后就不再发送。
4. 查看水平分割作用: 不要把路由告诉你的老师
R1(config )# int s1/0
# no ip split-horizon ( 关闭水平分割,默认开启 )
实验结果:默认开启水平分割,R1不会向R2通告2.0和3.0;当关闭水平分割后,R1会向R2通告2.0和3.0 。