RIPv1:
典型的距离矢量算法有类路由选择协议、它的工作原理:它是以广播方式周期性的通告自己的路由表、这个周期默认情况下为30秒,RIPV1每三十秒会向网络中其它的路由器广播自己的路由表。最大跳步数为15跳,跳数最少的条目为最佳路径、当跳数大过15的时候认为目标网络不可达。
RIPv1存在路由环路的问题、
RIPv1跟RIPv2的区别:RIPv1只能支持有类路由、不支持子网划分、路由汇总。RIPv2支持子网划分、路由汇总。
RIPv2特征:
使用多播地址取代广播地址: 用组播的方式更新路由表 、替代了广播通告
采用MD5认证方式接受更新,认证通过接受更新,认证不通过则丢弃路由条目,有效控制了信息来源的真实性、支持无类路由选择协议、路由条目中携带子网掩码支持VLSM 、支持CIDR、
classful 有类路由协议、 classess无类
在端口上声明发送RIP版本1和版本2的路由信息命令
ip rip sed version 1 2 // ip rip send receive 1 2
no auto-summary 关闭RIPv2的路由汇总 // 接口模式下手工汇总 ip summary-address rip (ip地址加掩码)
RIPv2的配置 (首先配置IP):
Router0:
Router#ip classless //支持无类路由
Router#ip subnet-zero //支持O子网
Router#no ip domain-lookup //取消域名解析
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router1
Router1(config)#interface fastethernet 0/0
Router1(config-if)#ip address 201.0.0.1 255.255.255.0
Router1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router1(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
Router1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#interface fastethernet 0/1
Router1(config-if)#ip address 202.0.0.1 255.255.255.0
Router1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router1(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
Router1#sh ip int brief //查看接口状态
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 201.0.0.1 YES manual up down
FastEthernet0/1 202.0.0.1 YES manual up down
Vlan1 unassigned YES unset administratively down down
Router1#
Router1:
Router#ip classless
Router#ip subnet-zero
Router#no ip domain-lookup
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router2
Router2(config)#interface fastethernet 0/0
Router2(config-if)#ip address 201.0.0.2 255.255.255.0
Router2(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router2(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
Router2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#interface fastethernet 0/1
Router2(config-if)#ip address 203.0.0.1 255.255.255.0
Router2(config-if)#no sh\
^
% Invalid input detected at '^' marker.
Router2(config-if)#no sh
Router2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router2(config-if)#
Router2:
Router#ip classless
Router#ip subnet-zero
Router#no ip domain-lookup
Router(config)#hostname Router3
Router3(config)#interface fastethernet 0/0
Router3(config-if)#ip address 202.0.0.2 255.255.255.0
Router3(config-if)#no sht
^
% Invalid input detected at '^' marker.
Router3(config-if)#no sh
Router3(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router3(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
Router3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router3(config)#interface fastethernet 0/1
Router3(config-if)#ip address 203.0.0.2 255.255.255.0
Router3(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router3(config-if)#
RIPv2的配置 :
路由器0上的配置:
Router1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#router rip //开始RIP协议
Router1(config-router)#no auto-summary //关闭RIPv2的路由汇总
Router1(config-router)#ver
Router1(config-router)#version 2 //声明版本号、默认为RIPv1
Router1(config-router)#network 201.0.0.0
Router1(config-router)#network 202.0.0.0 //发布网段也就是直连网段
Router1(config-router)#end
Router1#
%SYS-5-CONFIG_I: Configured from console by console
Router1#show ip pr
Router1#show ip protocols //查看协议
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 20 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
FastEthernet0/1 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
201.0.0.0
202.0.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 120)
Router1#
路由器1上的配置:
Router2:
Router2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#route ?
bgp Border Gateway Protocol (BGP)
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP)
ospf Open Shortest Path First (OSPF)
rip Routing Information Protocol (RIP)
Router2(config)#route rip
Router2(config-router)#no auto-summary //关闭RIPv2的路由汇总
Router2(config-router)#vers
Router2(config-router)#version 2
Router2(config-router)#network 201.0.0.0
Router2(config-router)#network 203.0.0.0
Router2(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Router2#sh ip p
Router2#sh ip protocols //查看协议
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 1 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
FastEthernet0/1 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
201.0.0.0
203.0.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
201.0.0.1 120 00:00:14 //通过RIP学习到了201网络、已存在14秒
Distance: (default is 120)
Router2#
路由器2上的配置:
Router3:
Router3>en
Router3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router3(config)#route rip
Router3(config-router)#no auto-summary //关闭RIPv2的路由汇总
Router3(config-router)#vers
Router3(config-router)#version 2
Router3(config-router)#network 202.0.0.0
Router3(config-router)#network 203.0.0.0
Router3(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Router3#
Router3#sh ip pr
Router3#sh ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 20 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
FastEthernet0/1 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
202.0.0.0
203.0.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
202.0.0.1 120 00:00:09
Distance: (default is 120)
Router3#
Router3#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
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 //通过RIP学习到了201网段、管理距离为120 跳数为1跳
R 201.0.0.0/24 [120/1] via 202.0.0.1, 00:00:25, FastEthernet0/0
[120/1] via 203.0.0.1, 00:00:18, FastEthernet0/1
C 202.0.0.0/24 is directly connected, FastEthernet0/0
C 203.0.0.0/24 is directly connected, FastEthernet0/1
Router3#
本文出自 “技术成就梦想” 博客,谢绝转载!