rip路由协议配置实验
路由器和Wi-Fi的设置可能看起来很复杂,但实际上很简单。本文将为你提供易懂的教程和建议,帮助你快速上网。
本文内容目录一览:
动态路由协议 rip version2的问题
问题1:为什么用show run和show ip protocols 看到的是1.0.0.0 ,172.16.0.0,192.168.2.0这三个网络,而用show ip route看到的结果是却是无类的?就是不明白为什么用show run显示的是有类的,用show ip route 显示的是无类的!
答:RIP是有类路由协议,路由的宣告自然是有类宣告,所以SH RUN和SH IP PRO中看到的是主类,SH IP ROU中能看到无类路由是因为你看到的是C直连路由,C路由不是R路由,C直连路由是根据你配置的掩码信息来显示路由信息的。
问题2:竟然用show ip protocols 看到 Default version control: send version 2, receive version 2,那么下面怎么还出现:Routing for Networks:1.0.0.0172.16.0.0192.168.2.0我觉得应该是:Routing for Networks:1.1.1.0172.16.2.0192.168.2.0才对啊!
答:同问题1,有类路由协议啊有类路由协议,主类宣告,自然是routing for network:A B C类
路由器的协议配置
一、RIP协议
RIP(Routing information Protocol)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离向量(distance-vector)协议。文档见RFC1058、RFC1723。
RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同目标有二个不等速或不同带宽的路由器,但跳跃计数相同,则RIP认为两个路由是等距离的。RIP最多支持的跳数为15,即在源和目的网间所要经过的最多路由器的数目为15,跳数16表示不可达。
1. 有关命令
任务 命令
指定使用RIP协议 router rip
指定RIP版本 version {1|2}1
指定与该路由器相连的网络 network network
注:1.Cisco的RIP版本2支持验证、密钥管理、路由汇总、无类域间路由(CIDR)和变长子网掩码(VLSMs)
二、IGRP协议
IGRP (Interior Gateway Routing Protocol)是一种动态距离向量路由协议,它由Cisco公司八十年代中期设计。使用组合用户配置尺度,包括延迟、带宽、可靠性和负载。
缺省情况下,IGRP每90秒发送一次路由更新广播,在3个更新周期内(即270秒),没有从路由中的第一个路由器接收到更新,则宣布路由不可访问。在7个更新周期即630秒后,Cisco IOS 软件从路由表中清除路由。
1. 有关命令
任务 命令
指定使用RIP协议 router igrp autonomous-system1
指定与该路由器相连的网络 network network
指定与该路由器相邻的节点地址 neighbor ip-address
注:1、autonomous-system可以随意建立,并非实际意义上的autonomous-system,但运行IGRP的路由器要想交换路由更新信息其autonomous-system需相同。
三、OSPF协议
OSPF(Open Shortest Path First)是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由。与RIP相对,OSPF是链路状态路有协议,而RIP是距离向量路由协议。
链路是路由器接口的另一种说法,因此OSPF也称为接口状态路由协议。OSPF通过路由器之间通告网络接口的状态来建立链路状态数据库,生成最短路径树,每个OSPF路由器使用这些最短路径构造路由表。
文档见RFC2178。
1.有关命令
全局设置
任务 命令
指定使用OSPF协议 router ospf process-id1
指定与该路由器相连的网络 network address wildcard-mask area area-id2
指定与该路由器相邻的节点地址 neighbor ip-address
注:1、OSPF路由进程process-id必须指定范围在1-65535,多个OSPF进程可以在同一个路由器上配置,但最好不这样做。多个OSPF进程需要多个OSPF数据库的副本,必须运行多个最短路径算法的副本。process-id只在路由器内部起作用,不同路由器的process-id可以不同。
2、wildcard-mask 是子网掩码的反码, 网络区域ID area-id在0-4294967295内的十进制数,也可以是带有IP地址格式的x.x.x.x。当网络区域ID为0或0.0.0.0时为主干域。不同网络区域的路由器通过主干域学习路由信息。
网络路由问题
Cicso 网络协议配置介绍之一 RIP (1)
本实验对RIP协议进行基本的配置,涉及到配置RIP协议所必须的命令和常用的监测命令。
1.实验目的
通过本实验,读者可以掌握以下技能:
在路由器上启动RIP协议;
声明相应网络进入RIP路由进程;
查看路由表并理解相关字段含义;
查看RIP协议配置信息;
监测RIP协议相关信息。
2.设备需求
本实验需要以下设备:
Cisco路由器3台,分别命名为R1、R2和R3,均要求具有1个以太网接口和2个串行接□;
3条DCE电缆和3条DTE电缆,或3条DCE转DTE电缆;
1台终端服务器,如Cisco 2509路由器。及用于反向Telnet的相应电缆;
1台带有超级终端程序的PC机,以及Console电缆及转接器。
3.拓扑结构及配置说明
本实验拓扑结构如图1所示,首先把DCE电缆和DTE电缆进行对接,共组成3对电缆。然后用这3对电缆把R1和R2"RE和R3、R2和R3分别连接起来。各路由器使用的接口及其编号见图1中的标注。
IP地址分配如下:
R1: E0 172.16.1.1, 50 172.16.12.1, 51 172.16.13.1;
R2: E0 172.16.2.2, 50 172.16.12.2, 51 172.16.23.2;
R3: E0 172.16.3.3, 50 172.16.13.3, 51 172.16.23.30
子网掩码均为 255.255.255.00
如图 1
实验中R、R2之间和R、R3之间的串行线路速率设置为5OOkbit/s;R2、R3之间的串行线路速率设置为64kbit/s。
本实验要求通过对RIP路由选择协议的配置,实现全网的连通。
4.实验配置及监测结果
实验环境准备就绪后,打开PC机、访问服务器和路由器的电源。开始进行实验。
现在假设我们不知道各路由器串行接口所连接的电缆是DCE电缆还是DTE电缆,同时路由器的E0接口均没有连接任何设备。在这样的基础上开始配置3台路由器,并启动RIP路由选择协议。
具体配置过程如配置清单1-1、1-2所示,配置清单后有详细的讲解。
配置清单1-1配置以太网接口和串行接口
第1段:配置R1网络接口
R1#
R1#show controllers serial 0
HD unit 0, idb = 0x95659C, driver stmcture at 0x95C910
buffer size 1524 HD unit 0, V.35 DCE cable
cpb = 0xE2, eda = 0x2904, cda = 0x2918
RX ring with 16 entries at OxE22800
00 bd_ptr==0x2800 pak=0x95DB94 ds=0xE25A4C status==80 pak_size=22
01 bd_ptr=0x2814 pak=0x960328 ds=0xE2CCC8 status=80 pak_size=22
...(类似内容,省略多行)
0 missed datagrams, 0 overruns
0 bad datagram encapsulations, 0 memory errors
0 transmitter underruns
0 residual bit errors
R1#sh controllers ser 1
HD unit 1, idb = 0x961614, driver structure at 0x967988
buffer size 1524 HD unit 1,
cpb = 0xE3, eda = 0x850, cda = 0x864
RX ring with 16 entries at OxE30800
00 bd_ptr=0x0800 pak=Ox9690B4 ds==OxE34E80 status=80 pak_size=22
...(类似内容,省略多行)
01 bd__ptr=0xl014 pak=0x000000 ds=0xE22EA4 status=80 pak_size=22
0 missed datagrams, 0 overruns
0 bad datagram encapsulations, 0 memory errors
0 transmitter underruns
0 residual bit errors
R1#conft
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#no logg con
R1config#int e0
R1(config-if)#ip addr 172.16.1.1255.255.255.0
R1(config-if)#no keepalive
R1(config-if)#no shut
R1(config-if)#mt sO
R1(config-if)#ip addr 172.16.12.1
R1(config-if)#clockrate 500000
R1(config-if)#no sh
R1(config-if)#bandwidth 500
R1(config-if)#int si
R1(config-if)#ip addr 172.16.13.1
R1(config-if)#clockrate 500000
R1(config-if)#no sh
R1(config-if)#bandwidth 500
R1(config-if)#^Z
R1#
R1#sh int s0
Seria10 is down,line protocol is down
Hardware is HD64570
Internet address is 172.16.12.1/24
MTU 1500 bytes, BW 500 Kbit, DLY 20000 usec,
reliability 255/255, txioad 1/255, rxioad 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:01:44, output 00:01:46, output hang never
Last clearing of "show interface" counters 00:00:02
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC,0 frame, 0 overrun, 0 ignored, Ollort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
DCD=up DSR=up DTR=down RTS=down CTSsup
第2段:配置R2网络接口
Term_Server2
[Resuming connection 2 to R2 ...]
R2#sh contr ser 0
HD unit 0, idb = Oxl4DF9C, driver structure at 0x154310
buffer size 1524 HD unit 0, V.35 DTE cable
cpb = 0x1, eda = 0x4878, cda == Ox488C
RX ring with 16 entries at 0x4014800
00 bd@ptr=0x4800 pak=Oxl557E8 ds=Ox40187C4 status=80 pak_size=22
...(类似内容,省略多行)
0 missed datagrams, 0 overruns
0 bad datagram encapsulations, 0 memory errors
0 transmitter underruns
0 residual bit errors
R2#sh ser 1
HD unit 1, idb == 0x159014, driver structure at 0x15F388
buffer size 1524 HD unit 1,
cpb = 0x2, eda = 0x3140, cda = 0x3000
RX ring with 16 entries at 0x4023000
00 bd_ptr==0x3000 pak=Oxl62B4C ds=Ox402CEOC status=80 pak_size=0
...(类似内容,省略多行)
0 missed datagrams, 0 overruns
0 bad datagram encapsulations, 0 memory errors
0 transmitter underruns
0 residual bit errors
R2#conft
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#iso logg con
R2(config)#int e0
R2(config-if)#ip addr 172.16.2.2
R2(config-if)#eo keepalive
R2(config-if)#no sh
R2(config-if)#lnt sO
R2(config-if)#ip addr 172.16.12.2
R2(config-if)#no sh
R1(config-if)#bandwidth 500
R2(config-if)#int s1
R2(config-if)#ip addr 172.16.23@2
R2(config-if)#clockr 64000
R2(config-if)#no sh
R1(config-if)#baiidwldth 64
R2(config-if)#end
R2#pmg 172.16.12.1
Type escape sequence to abort.
Sending 5,100-byte ICMP Echos to 172.16.12.1,timeout is 2 seconds:
!!!!!
R2#
第3段:配置R3网络接口
Term_Server3
[Resuming connection 3 to R3 ... ]
R3#conft
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#no logg con
R3(config)#int e0
R3(config-if)#ip addr 172.16.3.3 255.255.255.0
R3(config-if)#no keepalive
R3(config-if)#no sh
R3(config-if)#int s0
R3(config-if)#ip addr 172.16.13.3 255.255.255.0
R3(config-if)#no sh
R1(config-if)#bandwidth 500
R3(config-if)#int si
R3(config-if)#ip addr 172.16.23.3 255.255.255.0
R1(config-if)#bandwidth 64
R3(config-if)#end
R3#ping 172.16.13.1
配置清单1-2 配置RIP协议
第1段:配置RIP协议
R1#conft
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router rip
R1(config-router)#eetwork 172.16.0.0
R1(config-router)#
Term_Server2
[Resuming connection 2 to R2 ...]
R2#conft
Enter configuration commands, one per line. End with CNTT ./Z
R2(config)#router rip
R2(config-router)#network 172.16.0.0
R2(config-router)#
Term_Server3
[Resuming connection 3 to R3 ...]
R3#conft
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router rip
R3(config-router)#network 172.16.0.0
R3(config-router)#
第2段:查看路由表
Term_Server 1
[Resuming connection I to R1... ]
R1(config-router)#end
R1#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, 0 - OSPF, IA - OSPF inter area
N - 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
172.16.0.0/24 is subnetted, 6 subnets
R 172.16.23.0[20/1]via 172.16.12.2,00:00:06,Serial0
[20/1]via 172.16.13.3,00:00:07,Serial1
C 172.16.12.0 is directly connected, Serial0
C 172.16.13.0 is directly connected. Serial1
C 172.16.1.0 is directly connected, Ethernet0
R 172.16.2.0[20/1]via 172.16.12.2,00:00:06,Serial0
R 172.16.3.0[20/1]via 172.16.13.3,00:00:07,Serial1
R1#
Term_Server2
[Resuming connection 2 to R2 ... ]
R2(config-router)#end
R2#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M " mobile, B - BGP
D - EIGRP, EX - EIGRP external, 0 - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type I, 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
172.16.0.0/24 is subnetted, 6 subnets
C 172.16.23.0 is directly connected, Seriall
C 172.16.12.0 is directly connected, SerialO
R 172.16.13.0[20/1]via 172.16.12.1,00:00:08,Serial0
[20/1]via 172.16.23.3,00:00:09,Serial1
R 172.16.1.0[20/1]via 172.16.12.1,00:00:08,Serial0
C 172.16.2.0 is directly connected, Ethernet0
R 172.16.3.0[20/1]via 172.16.23.3,00:00:09,Serial1
R2#
Term_Server3
[Resuming connection 3 to R3 ... ]
R3(config-.router)#end
R3#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX -EIGRP external, 0 - 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
172.16.0.0/24 is subnetted, 6 subnets
C 172.16.23.0 is directly connected, Serial1
R 172.16.12.0 [120/13 via 172.16.13.1, 00:00:17, Serial0
[120/1} via 172.16.23.2, 00:00:26, Serial1
C 172.16.13.0 is directly connected, SerialO
R 172.16.1.0 [120/1] via 172.16.13.1, 00:00:17, Serial0
R 172.16.2,0 [120/1] via 172.16.23.2,00:00:26, Serial1
C 172.16.3.0 is directly connected, Ethemet0
R3#
PS:
(1)RIP协议的基本配置非常简单。首先使用router ip命令进入RIP协议配置模式,然后用network语句声明进入RIP进程的网络。
可以看到netwo比语句中使用的是网络号,而不是子网号。当我们试图把172.16.1.0这一子网号码加入R1的RIP路由进程中而发出network l72.16.0.0的命令后,show running-config的结果会显示此处的语句变成为network 172.16.0.0,即B类网络172.16.0.0下的所有子网都加入了RIP路由进程。
(2)使用show ip route命令查看路由表。在R1路由器上可以看到,通过RIP协议,学到了与R1不直接相连的网段172.16.23.0、172.16.2.0和17216.3.0。路由表中的项目解释如下。
R 172.16.2.0[120/1]via 172.16.12.2,00:00:06,Serial0
R:表示此项路由是由RIP协议获取的,另外,"C,代表直连的网段。
172.16.2.0: 目标网络。
[120/1]:12O是RIP协议的管理距离,1是该条路由的度量值,即Metric值,即跳数。
via:经由的意思。
172.16.12.2:是由当前路由器出发,到达目标网段所需经过的下一个跳点的IP地址。
00:00:06:此条路由产生的时间,即65钟。
Serial0:由此路由器到达目标网段所需使用的接口。
(3)从3台路由器的路由表中可以看出RIP协议工作正常,所有网段的路由条目都已具备。
(4)对于路由器R1的路由表而言。172.16.23.0这条路由项具有2个路径,即表中列出的172.26.12.2和172.16.13.3,表示到达172.16.23.0网段可以通过R2路由器,也可以通过R3路由器,表明有两条等值的路径存在,其度量值均为1。路由器R2和R3都有类似的路由存在。
(5)从实验拓扑图可以分析出,从R2发送到R3的数据包如果经由R1的话会有较高的带宽(5OOkbit/s),是应该首选的路由。但路由表中显示的实际情况是选择了由R2直接发送到R3。这表明RIP路由协议在进行路由计算时只考虑两个网段之间的跳数这个惟一的度量值,而不考虑诸如带宽。延迟等其他因素。
监测清单1-1记录了RIP协议常用的监测命令的使用。
监测清单1-1 RIP协议常用监测命令
R3#sh ip protocol
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 24 second
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered TIP Key-chain
Ethernet0 1 12
Serial0 1 12
Serial1 1 12
Autonaatic network sunamarization is in effect
Routing for Networks:
172.16.0.0
Routing Information Sources:
Gateway Distance Last Update
172.16.23.2 120 00:00:14
172.16.13.1 120 00:00:00
Distance: (default is 120)
R3#pmg 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-bytelCMPEchos to 172.16.1.1,timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), rouad-tripmin/avg/max=8/8/8 ms
R3#trace 172.16.1.1
Type escape sequence to abort.
Tracing the route to 172.16.1.1
1 172.16.13.14 msec *
R3#conft
光猫动态路由配置rip要打开吗
光猫动态路由配置rip要打开。光猫动态路由配置要关闭接口再打开rip。创建RIP路由进程、创建,路由进程:路由器要运行RIP路由协议,需要创建RIP路由进程,并定义与RIP路由进程关联的网络。
了解这些技巧和方法可以帮助您更好地保护和管理您的网络,从而获得更好的上网体验。