1. 概述
RIP,Routing Information Protocol,路由信息协议
RIP采用距离矢量算法来计算路由。
RIP有两个版本,RIPv1和RIPv2。RIPv1已经不用,如果使用都是RIPv2。“v”是version 英 [ˈvɜːʃn] 版本的缩写。
RIPv2支持无类域间路由和可变长子网掩码。
无类域间路由,Classless Inter-Domain Routing, CIDR
可变长子网掩码,Variable Length Subnet Mask, VLSM
RIP只适用于小型的同构网络,是以跳数表示距离(每经过一个路由器则跳数加1),允许的最大跳数为15,因此任何超过15个中间站点的目的地均被表示为不可达。
思考:什么是“同构网络”
RIP定期更新路由表,每隔30秒广播一次路由信息。
2. 思科路由器中配置RIP路由常用的命令:
华为路由器中也可以实现相同功能,但命令不同
命令 | 说明 |
router rip | 指定使用RIP协议 |
version {1|2} | 指定RIP协议版本 |
network network-addr | 指定与该路由器直接相连的网络 |
neighbor ip-addr | 说明邻接路由器,以使他们能够自动更新路由 |
passive interface 接口 | 阻止在指定的接口发送路由更新信息 |
show ip route | 查看路由表信息 |
show router rip | 查看RIP协议路由信息 |
3.配置RIP_4台路由器
1. 说明
本门课程仅仅使用思科3560交换机和思科2911路由器。
本实验使用的是cisco 2911路由器。
2. 拓扑
R1上的网段有:
10.10.10.0 255.255.255.252
10.10.10.4 255.255.255.252
192.168.10.0 255.255.255.0
R2上的网段有:
10.10.10.0 255.255.255.252
192.168.20.0 255.255.255.0
10.10.10.12 255.255.255.252
R3上的网段有:
10.10.10.4 255.255.255.252
10.10.10.8 255.255.255.252
192.168.30.0 255.255.255.0
R4上的网段有:
10.10.10.12 255.255.255.252
10.10.10.8 255.255.255.252
192.168.40.0 255.255.255.0
解释:
192.168.1.1/24中的"/24"表示24位掩码,也可以写成255.255.255.0
10.10.10.1/30中的“/30”表示30位掩码,也可以写成255.255.255.252
-
10.10.10.1/30的网段IP地址范围是10.10.10.0-10.10.10.3,其中10.10.10.0是网络地址,10.10.10.3是广播地址,可用IP是10.10.10.1和10.10.1.2
-
10.10.10.5/30的网段IP地址范围是10.10.10.4-10.10.10.7,其中10.10.10.4是网络地址,10.10.10.7是广播地址,可用IP是10.10.10.5和10.10.1.6。
-
10.10.10.9/30的网段IP地址范围是10.10.10.8-10.10.10.11,其中10.10.10.8是网络地址,10.10.10.11是广播地址,可用IP是10.10.10.9和10.10.1.10。
-
10.10.10.12/30的网段IP地址范围是10.10.10.12-10.10.10.15,其中10.10.10.12是网络地址,10.10.10.15是广播地址,可用IP是10.10.10.13和10.10.1.14。
脚本
R1
enable
configure terminal
no logging on
no ip domain-lookup
hostname R1
interface GigabitEthernet 0/0
no shutdown
ip address 10.10.10.5 255.255.255.252
exit
interface GigabitEthernet 0/1
no shutdown
ip address 10.10.10.1 255.255.255.0
exit
interface GigabitEthernet 0/2
no shutdown
ip address 192.168.10.1 255.255.255.0
exit
router rip
version 2
network 10.10.10.0
network 10.10.10.4
network 192.168.10.0
passive-interface gigabitethernet 0/2
no auto-summary
exit
exit
write
copy running-config startup-config
R2
enable
configure terminal
no logging on
no ip domain-lookup
hostname R2
interface GigabitEthernet 0/0
no shutdown
ip address 192.168.20.1 255.255.255.0
exit
interface GigabitEthernet 0/1
no shutdown
ip address 10.10.10.2 255.255.255.252
exit
interface GigabitEthernet 0/2
no shutdown
ip address 10.10.10.13 255.255.255.252
exit
router rip
version 2
network 10.10.10.0
network 10.10.10.12
network 192.168.20.0
passive-interface gigabitethernet 0/0
no auto-summary
exit
exit
write
copy running-config startup-config
R3
enable
configure terminal
no logging on
no ip domain-lookup
hostname R3
interface GigabitEthernet 0/0
no shutdown
ip address 10.10.10.6 255.255.255.252
exit
interface GigabitEthernet 0/1
no shutdown
ip address 10.10.10.9 255.255.255.252
exit
interface GigabitEthernet 0/2
no shutdown
ip address 192.168.30.1 255.255.255.0
exit
router rip
version 2
network 10.10.10.4
network 10.10.10.8
network 192.168.30.0
passive-interface gigabitethernet 0/2
no auto-summary
exit
exit
write
copy running-config startup-config
R4
enable
configure terminal
no logging on
no ip domain-lookup
hostname R4
interface GigabitEthernet 0/0
no shutdown
ip address 192.168.40.1 255.255.255.0
exit
interface GigabitEthernet 0/1
no shutdown
ip address 10.10.10.10 255.255.255.252
exit
interface GigabitEthernet 0/2
no shutdown
ip address 10.10.10.14 255.255.255.252
exit
router rip
version 2
network 10.10.10.12
network 10.10.10.8
network 192.168.40.0
passive-interface gigabitethernet 0/0
no auto-summary
exit
exit
write
copy running-config startup-config
配制过程
R1
R2
R3
R4
配制验证
pc1能够ping通pc2、pc3、pc4