您的位置:首页 > 其它

RIP协议的基本配置

2008-06-04 14:58 330 查看
RIP协议的基本配置

2007-09-27 16:28:57
 标签:rip    [推送到技术圈]

本实验对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.拓扑结构及配置说明
  
    本实验拓扑结构如图5.1所示,首先把DCE电缆和DTE电缆进行对接,共组成3对电缆。然后用这3对电缆把R1和R2"RE和R3、R2和R3分别连接起来。各路由器使用的接口及其编号见图5.1中的标注。
    IP地址分配如下:
    R1: E0 172.16.1.1, S0 172.16.12.1, S1 172.16.13.1;
    R2: E0 172.16.2.2, S0 172.16.12.2, S1 172.16.23.2;
    R3: E0 172.16.3.3, S0 172.16.13.3, S1 172.16.23.30
    子网掩码均为 255.255.255.00



实验中R、R2之间和R、R3之间的串行线路速率设置为5OOkbit/s;R2、R3之间的串行线路速率设置为64kbit/s。
    本实验要求通过对RIP路由选择协议的配置,实现全网的连通。
  
    4.实验配置及监测结果
  
    实验环境准备就绪后,打开PC机、访问服务器和路由器的电源。开始进行实验。
    现在假设我们不知道各路由器串行接口所连接的电缆是DCE电缆还是DTE电缆,同时路由器的E0接口均没有连接任何设备。在这样的基础上开始配置3台路由器,并启动RIP路由选择协议。
    具体配置过程如配置清单5-1、5-2所示,配置清单后有详细的讲解。
  
    配置清单5-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_Server>2
    [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_Server>3
    [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
    
    Type escape sequence to abort.
    Sending 5,100-byte ICMP Echos to 172.16.13.1,timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5),
    R3#ping 172.16.23.2
    
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 172.16.23,2, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max=32/121/480 ms
    R3#
  
    (1)为了查明串行接口所连接电缆的类型,从而正确配置串行接口,使用show controllersserial命令查看相应的控制器(Controller)。
    从命令结果的第2行我们看到,接口S0和S1所连接的电缆为DCE类型。
    (2)在全局配置模式下,使用no logging console配置命令,可以防止大量的端口状态变化信息和报警信息对配置过程的影响。
    (3)配置E0接口的命令中,除了我们己经熟知的ip address和no shutdown命令外,nokeepaIive能便此接口不检测keepalive(存活)信号,从而在不连接任何设备的情况下,可以激活此接口。
    在实际的网络环境中,此命令不应被使用,从而使接口状态的显示反映真实的情况。
    (4)对于连接DCE电缆的接口,配置时钟,用以对DTE端提供时钟同步信号,命令clockrate500000设置S0和S1接口的时钟频率均为500kHz,即对应速率为500kbMs。
    clockrate命令只能在连接了DCE电缆的串行接口上使用,在连接了DTE电缆的串行接口上使用时会报错。
    bandwidth命令指明相应接口上的带宽为多少,单位为kbits。在show int s0命令中可以看到其带宽值。在缺省情况下,不论clockrate如何设置,接口上的带宽显示值都为1544kbit/s。对于RIP协议而言,带宽不是敏感因素,不影响路由的选择,因为RIP的惟一度量值是跳数。
    (5)在配置各接口时,应注意使用no shut命令。缺省情况下各种物理接口是处于关闭状态的。对于回送接口则不需要如此,因为回送接口被创建后缺省状态是激活的。
    (6)使用show interface s0命令可以看到S0接口的配置和统计信息,对于我们非常有用的信息是:
    接口状态和线路协议状态,均为down,这是因为与它相连的R2路由的S0接口还没有进行配置;
    IP地址,为所设的地址;
    封装类型,为缺省的HDLC;
    5min统计信息,各种值均为0;
    5个重要的物理层信息,即DCD、DSR、DTR、RTS、CTS,可以看到DTR和RTS是Down的状态。只有所有信号的状态都为Up的时候,接口的状态才能是Up。
    (7)在第2段中,使用了与第1段中相同的命令来查看其串行接口的连接类型。配置完成后使用Ping命令检查R2与R1的连通性,结果为成功。
    (8)第3段重复了前两段的配置方法,所不同的只是IP地址。
    (9)配置结束后的Ping测试是十分重要的,这是一个良好的习惯,即在每完成一个阶段的配置后都对配置结果进行相应的确认。
配置清单5-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_Server>2
    [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_Server>3
    [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_Server>2
    [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_Server>3
    [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#
  
    (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路由协议在进行路由计算时只考虑两个网段之间的跳数这个惟一的度量值,而不考虑诸如带宽。延迟等其他因素。
  
    监测清单5-1记录了RIP协议常用的监测命令的使用。
  
    监测清单5-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
    Enter configuration commands, one per line. End with CNTL/Z.
    R3(config)#int s1
    R3(config-if)#shut
    R3(config-if)#end
    R3#sh ip route
    Codes: C - connecte-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, 5 subnets
    R   172.16.12.0 [120/1] via 172.16.13.1, 00:00:04, Serial0
    C   172.16.13.0 is directly connected, Serial0
    R   172.16.1.0 [120/1] via 172.16.13.1, 00:00:04, Serial0
    R   172.16.2.0 (.120/21 via 17246.13.1, 00:00:04,Serial0
    C   172.16.3.01s directly connected, Ethernet0
    R3#trace 172.16.2.2
  
    Type escape sequence to abort.
    Tracing the route to 172.16.2.2
  
    1 172.16.13.14 msec 4 msec 8 msec
    2 172.16.12.2 16 msec 8 msec*
    R3#conft
    Enter configuration commands,one per line.End with CNTL/Z.
    R3(config)#int s1
    R3(ocnfig-if)#no sh
    R3(config-if)#exit
    R3(config)#logg con
    R3(config)#exit
    R3#de
    01:29:45:%SYS-5CONFIG_I:Configured from console by console
    R3:debug ip rip
    RIP protocol debugging is on
    R3#
    01:29:56:RIP:sending v1 update to 255.255.255.255 via Ethernet0(172.16.3.3)
    01:29:56:RIP:build update entries
    01:29:56: subnet 172.16.1.0 metric 2
    01:29:56: subnet 172.16.2.0 metric 2
    01:29:56: subnet 172.16.12.0 metric 2
    01:29:56: subnet 172.16.13.0 metric 1
    01:29:56: subnet 172.16.23.0 metric 1
    01:29:56: RIP: sending v1 update to 255.255.255.255 via Serial0 (172.16.13.3)
    01:29:56: RIP: build update entries
    01:29:56: subnet 172.16.2.0 metric 2
    01:29:56: subnet 172.16.3.0 metric 1
    01:29:56: subnet 172.16.23.0 metric 1
    01:29:56: RIP: sending v1 update to 255.255.255.255 via Serial1 (172.16.23.3)
    01:29:56: RIP: build update entries
    01:29:56: subnet 172.16.1.0 metric 2
    01:29:56: subnet 172.16.3.0 metric 1
    01:29:56: subnet 172.16.13.0 metric 1
    01:30:00: RIP: received v1 update from 172.16.23.2 on Serial1
    01:30:00:   172.16.1.0 in 2 hops
    01:30:00:   172.16.2.0 in 1 hops
    01:30:00:   172.16.12.0 in 1 hops
    R3#
    01:30:07: RIP: received v1 update from 172.16.13.1 on Serial0
    01:30:07:   172.16.1.0 in 1 hops
    01:30:07:   172.16.2.0 in 2 hops
    01:30:07:   172.16.12.0 in 1 hops
    R3-#indebug all
  
    (1)show ip protocol命令的执行结果中包含了有关RIP协议的大量信息,主要有:各种计时器信息;
    版本信息,发送version 1,接收任何version;
    各接口的发送(Send)和接收(Receive)的版本;
    自动汇总生效(Automatic network summarization is in effect);
    所路由的网络,172.16.0.0;
    路由信息源,即从何处学月来的路由;
    管理距离,缺省值为120。
    (2)用ping和trace命令测试网络连通性,尤其是trace命令给出了相应的路径信息。
    (3)我们把R3路由器的S1接口关闭后,使用show ip route指令查看路由表,显示到达172.16.2.0的路由己经变为R1,度量值也变为2.
    trace命令的结果也显示了这一变化。
    (4)使用debug ip rip命令可以监测到RIP协议的路由更新发送和接收情况,在此命令后面的若干行中,可以看出RIP协议工作的特点,大致有以下几点:
    更新信息缺省情况下向所有参与路由的接口发送;
    RIP版木1的更新包是广播包,即目的地址为255.255.255.255;
    RIP把整个路由表向相邻路由器发送;
    当前所有接口发送和接收的RIP更新包的版本均为1。
    (5)最后应关闭debug进程。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  配置 协议 RIP