减少了管理任务
依据从源网络到目标网络所经过的路由器的个数选择路由
综合考虑从源网络到目标网络的各条路径的情况选择路由
定期更新
邻居
广播更新
router rip
network network-number
show ip portocols
版本 | RIP v1 | RIP v2 |
---|---|---|
区别 | 有类路由协议 | 无类路由协议 |
广播更新(255.255.225.255) | 组播更新(224.0.0.9) | |
不支持VLSM | 支持VLSM | |
自动路由汇总,不可关闭 | 自动汇总可关闭,可手工汇总 | |
不支持不连续子网 | 支持不连续子网 |
启用版本v2
router rip
version 2
关闭RIP v2路由自动汇总
no auto-summary
安装GNS 3软件,并在软件中安装路由镜
GNS 3下载 使用方法 c3725路由镜像文件
1、在GNS 3中构建网络拓扑图,使用三个路由设备,在路由设备中设置RIP动态路由,是PC1与PC2互联。(注意接口网段是划分)
2、开启全部设备,并先在R2路由设备,并添加接口网段信息
R2#conf t //进入全局模式
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int f0/0 //进入f0/0接口
R2(config-if)#ip add 192.168.10.1 255.255.255.0 //添加网段
R2(config-if)#no shut //开启接口
R2(config-if)#
*Mar 1 00:03:21.759: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:03:22.759: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#exit //退出接口
R2(config)#int f0/1 //进入f0/1接口
R2(config-if)#ip add 192.168.20.1 255.255.255.252 //添加网段
R2(config-if)#no shut //开启接口
R2(config-if)#
*Mar 1 00:04:13.043: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar 1 00:04:14.043: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config)#do show ip rout //查看路由表,查看网段是否成功添加
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
C 192.168.10.0/24 is directly connected, FastEthernet0/0 //成功添加网段
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, FastEthernet0/1
3、进入R1路由设备,并添加接口网段信息
R1#conf t //进入全局模式
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0 //进入f0/0接口
R1(config-if)#ip add 192.168.20.2 255.255.255.252 //添加网段
R1(config-if)#no shut //开启接口
R1(config-if)#
*Mar 1 00:11:18.063: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:11:19.063: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#exit //退出接口
R1(config)#int f0/1 //进入f0/1接口
R1(config-if)#ip add 192.168.30.1 255.255.255.252 //添加网段
R1(config-if)#no shut //开启接口
R1(config-if)#
*Mar 1 00:12:22.463: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar 1 00:12:23.463: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#exit
R1(config)#do show ip rout //查看路由表,查看网段是否成功添加
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
192.168.30.0/30 is subnetted, 1 subnets
C 192.168.30.0 is directly connected, FastEthernet0/1 //成功添加网段
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, FastEthernet0/0
4、进入R3路由设备,并添加接口网段信息
R3#conf t //进入全局模式
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int f0/0 //进入f0/0接口
R3(config-if)#ip add 192.168.30.2 255.255.255.252 //添加网段
R3(config-if)#no shut //开启接口
R3(config-if)#
*Mar 1 00:15:54.763: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:15:55.763: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#exit //退出接口
R3(config)#int f0/1 //进入f0/1接口
R3(config-if)#ip add 192.168.40.1 255.255.255.0 //添加网段
R3(config-if)#no shut //开启接口
R3(config-if)#
*Mar 1 00:16:36.811: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar 1 00:16:37.811: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#exit
R3(config)#do show ip rout //查看路由表,查看网段是否成功添加
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
192.168.30.0/30 is subnetted, 1 subnets
C 192.168.30.0 is directly connected, FastEthernet0/0 //成功添加网段
C 192.168.40.0/24 is directly connected, FastEthernet0/1
5、在两台PC机上分别配置IP地址
PC1> ip 192.168.10.2 192.168.10.1 //添加IP地址及网关
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1 //成功配置IP地址
PC2> ip 192.168.40.2 192.168.40.1 //添加IP地址及网关
Checking for duplicate address...
PC1 : 192.168.40.2 255.255.255.0 gateway 192.168.40.1 //成功配置IP地址
6、回到R2路由设备中,添加RIP路由协议
R2(config)#router rip //进入路由进程
R2(config-router)#network 192.168.10.0 //宣告直连网段
R2(config-router)#network 192.168.20.0 //宣告直连网段
R2(config-router)#version 2 //启用版本 2
R2(config-router)#no auto-summary //关闭路由自动汇总功能
R2(config-router)#exit //完成后退出路由进程
7、在R1路由设备中,添加RIP路由协议
R1(config)#router rip //进入路由进程
R1(config-router)#network 192.168.20.0 //宣告直连网段
R1(config-router)#network 192.168.30.0 //宣告直连网段
R1(config-router)#version 2 //启用版本 2
R1(config-router)#no auto-summary //关闭路由自动汇总功能
R1(config-router)#exit //完成后退出路由进程
8、在R3路由设备中,添加RIP路由协议
R3(config)#router rip //进入路由进程
R3(config-router)#network 192.168.30.0 //宣告直连网段
R3(config-router)#network 192.168.40.0 //宣告直连网段
R3(config-router)#version 2 //启用版本 2
R3(config-router)#no auto-summary //关闭路由自动汇总功能
R3(config-router)#exit //完成后退出路由进程
9、分别查看路由设备中的路由表,是否成功自动学习网段信息
R2(config)#do show ip rout //查看R2路由设备路由表
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
192.168.30.0/30 is subnetted, 1 subnets
R 192.168.30.0 [120/1] via 192.168.20.2, 00:00:14, FastEthernet0/1 //成功学习网段
C 192.168.10.0/24 is directly connected, FastEthernet0/0
R 192.168.40.0/24 [120/2] via 192.168.20.2, 00:00:14, FastEthernet0/1 //成功学习网段
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, FastEthernet0/1
R1(config)#do show ip rout //查看R1路由设备路由表
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
192.168.30.0/30 is subnetted, 1 subnets
C 192.168.30.0 is directly connected, FastEthernet0/1
R 192.168.10.0/24 [120/1] via 192.168.20.1, 00:00:05, FastEthernet0/0 //成功学习网段
R 192.168.40.0/24 [120/1] via 192.168.30.2, 00:00:05, FastEthernet0/1 //成功学习网段
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, FastEthernet0/0
R3(config)#do show ip rout //查看R3路由设备路由表
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
192.168.30.0/30 is subnetted, 1 subnets
C 192.168.30.0 is directly connected, FastEthernet0/0
R 192.168.10.0/24 [120/2] via 192.168.30.1, 00:00:15, FastEthernet0/0 //成功学习网段
C 192.168.40.0/24 is directly connected, FastEthernet0/1
192.168.20.0/30 is subnetted, 1 subnets
R 192.168.20.0 [120/1] via 192.168.30.1, 00:00:15, FastEthernet0/0 //成功学习网段
10、在PC机中使用ping命令查看两台PC机是否相互通信
PC1> ping 192.168.40.2 //使用ping命令查看是否与PC2通信
192.168.40.2 icmp_seq=1 timeout
192.168.40.2 icmp_seq=2 timeout
192.168.40.2 icmp_seq=3 timeout
84 bytes from 192.168.40.2 icmp_seq=4 ttl=61 time=52.159 ms //成功通信
84 bytes from 192.168.40.2 icmp_seq=5 ttl=61 time=52.522 ms