RIP(Routing Information Protocol——路由信息协议)是使用比较早的内部网关协议(IGP),应用距离矢量(D-V)算法,适合中小型网络,详见RFC1058,RFC1723。
R1基本配置:
Router>
Router>en
Router#conf t
Router1(config)#hostname R1
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#inerfacet s1/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int fa0/0
R1(config-if)#ip address 13.13.13.1 255.255.255.0
R1(config-if)#no shutdown
R2基本配置:
Router>
Router>en
Router(config)#hostname R2
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#int s1/0
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#int s1/1
R2(config-if)#ip address 23.23.23.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R3基本配置:
Router>
Router>en
Router#conf t
Router(config)#hostname R3
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config-if)#int s1/1
R3(config-if)#ip address 23.23.23.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int fa0/0
R3(config-if)#ip address 13.13.13.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
基本配置已经完成,下面在各路由器上起RIP协议,
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)# network 1.1.1.1
R1(config-router)#network 12.12.12.0
R1(config-router)#network 23.23.23.0
R1(config-router)#no auto-summary //RIPv2支持路由自动汇总, 这里要关闭自动汇总
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 2.2.2.2
R2(config-router)#network 12.12.12.0
R2(config-router)#network 13.13.13.0
R2(config-router)#network 23.23.23.0
R2(config-router)#no auto-summary
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 3.3.3.3
R3(config-router)#network 12.12.12.0
R3(config-router)#network 23.23.23.0
R3(config-router)#no auto-summary
下面来验证RIP协议,
R1#show 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
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/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/1] via 12.12.12.2, 00:00:20, Serial1/0
/ /这里看到RIP路由显示,目标网络为2.2.2.2,管理距离(AD)默认为120,度量值(跳数)为1跳,路由有效时间为20秒,每收到一次更新就会重新计时,出接口为 Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/1] via 13.13.13.2, 00:00:28, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, Serial1/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.13.13.0 is directly connected, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
R 23.23.23.0 [120/1] via 12.12.12.2, 00:00:20, Serial1/0
[120/1] via 13.13.13.2, 00:00:28, FastEthernet0/0
//这里去往目标网段23.23.23.0有两个相同度量值的条目,故形成负载均衡
同理,其他路由表也类似,在此不一一列出,以免冗长。
R1(config-if)#exit