免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1894 | 回复: 0
打印 上一主题 下一主题

配置rip协议 [复制链接]

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-29 16:46 |只看该作者 |倒序浏览

说明:
1、用小凡搭建实验环境。
2、使用4台3640模拟路由器,1台3640模拟交换机。
3、交换机的fa0/14端口桥接真机vmnet1网卡。
IP地址的划分如下:
R1
F0/0:172.16.3.1/24
Ser1/2:192.168.4.1/24
R2
F0/0:192.168.5.2/24
Ser1/2:192.168.4.2/24
R3
F0/0:192.168.5.3/24
Ser1/1:192.168.6.3/24
R4
F0/0:172.16.7.4/24
Ser1/1:192.168.6.4/24
真机:172.16.3.2/24,网关:172.16.3.1
实验目的:
1、各路由器能学习3条route路由。
2、从真机与R4能互相ping通。
网络拓朴如下图:

实验步骤:
1、按照上图用小凡模拟接好实验环境,SW1的fa0/8与真的vmnet1网卡桥接。
2、使用SecureCRT 5.1控制台开启R1、R2、R3、R4、SW1。
3、配置各设备如下:
R1:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#no ip domain-loo
R1(config)#line co 0
R1(config-line)#no exec-t
R1(config-line)#logg sy
R1(config-line)#end
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#speed 100
R1(config-if)#duplex full
R1(config-if)#ip add 172.16.3.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int ser1/2
R1(config-if)#ip add 192.168.4.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#
R1(config)#
*Mar  1 00:04:06.903: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:04:07.359: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up
*Mar  1 00:04:07.903: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config)#
*Mar  1 00:04:08.359: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up
R1(config)#
R2:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#no ip domain-loo
R2(config)#line co 0
R2(config-line)#no exec-t
R2(config-line)#logg sy
R2(config-line)#end
R2#
*Mar  1 00:06:36.319: %SYS-5-CONFIG_I: Configured from console by console
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#ip add 192.168.5.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int ser1/2
R2(config-if)#ip add 192.168.4.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#
*Mar  1 00:07:26.183: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:07:26.807: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up
*Mar  1 00:07:27.183: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config)#
*Mar  1 00:07:27.807: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up
R2(config)#
R3:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#host R3
R3(config)#no ip domain-loo
R3(config)#line co 0
R3(config-line)#no exec-t
R3(config-line)#logg sy
R3(config-line)#end
R3#
*Mar  1 00:08:11.171: %SYS-5-CONFIG_I: Configured from console by console
R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int f0/0
R3(config-if)#speed 100
R3(config-if)#duplex full
R3(config-if)#ip add 192.168.5.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#int ser1/1
R3(config-if)#ip add 192.168.6.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#
*Mar  1 00:09:33.963: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:09:34.411: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
*Mar  1 00:09:34.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config)#
*Mar  1 00:09:35.411: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
R3(config)#
R4:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R4
R4(config)#no ip domain-loo
R4(config)#line co 0
R4(config-line)#no exec-t
R4(config-line)#logg sy
R4(config-line)#end
R4#
*Mar  1 00:10:13.003: %SYS-5-CONFIG_I: Configured from console by console
R4#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int f0/0
R4(config-if)#speed 100
R4(config-if)#duplex full
R4(config-if)#ip add 172.16.7.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#int ser1/1
R4(config-if)#ip add 192.168.6.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#
R4(config)#
*Mar  1 00:10:48.619: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:10:49.279: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
*Mar  1 00:10:49.619: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config)#
*Mar  1 00:10:50.279: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
R4(config)#
SW1:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host SW1
SW1(config)#no ip domain-loo
SW1(config)#line co 0
SW1(config-line)#no exec-t
SW1(config-line)#logg sy
SW1(config-line)#end
SW1#
*Mar  1 00:19:01.427: %SYS-5-CONFIG_I: Configured from console by console
SW1#vlan dat
SW1(vlan)#vlan 2
VLAN 2 added:
    Name: VLAN0002
SW1(vlan)#vlan 3
VLAN 3 added:
    Name: VLAN0003
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#int fa0/15
SW1(config-if)#sw mo acc
SW1(config-if)#sw acc vlan 2
SW1(config-if)#exit
SW1(config)#int fa0/8
SW1(config-if)#sw mo acc
SW1(config-if)#sw acc vlan 2
SW1(config-if)#exit
SW1(config)#int fa0/12
SW1(config-if)#sw mo acc
SW1(config-if)#sw acc vlan 3
SW1(config-if)#exit
SW1(config)#exit
SW1#show vlan-sw b
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/1, Fa0/2, Fa0/3
                                                Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/13
                                                Fa0/14
2    VLAN0002                         active    Fa0/8, Fa0/15
3    VLAN0003                         active    Fa0/12
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active   
SW1#
*Mar  1 00:22:27.187: %SYS-5-CONFIG_I: Configured from console by console
SW1#
4、在路由器R1上做rip路由协议,并且为版式本1,如下设置:
R1(config)#router rip
R1(config-router)#network 172.16.0.0
R1(config-router)#network 192.168.4.0
R1(config-router)#exit
R1(config)#exit
R1#
*Mar  1 00:19:08.063: %SYS-5-CONFIG_I: Configured from console by console
R1#
5、在路由器R2、R3、R4上配置rip协议,并且运行版本2,如下设置:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.4.0
R2(config-router)#network 192.168.5.0
R2(config-router)#exit
R2(config)#exit
R2#
*Mar  1 00:21:45.035: %SYS-5-CONFIG_I: Configured from console by console
R2#
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.6.0
R3(config-router)#network 192.168.5.0
R3(config-router)#exit
R3(config)#exit
R3#
*Mar  1 00:22:17.031: %SYS-5-CONFIG_I: Configured from console by console
R3#
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#no auto-summary
R4(config-router)#network 192.168.6.0
R4(config-router)#network 172.16.0.0
R4(config-router)#exit
R4(config)#exit
R4#
*Mar  1 00:22:53.731: %SYS-5-CONFIG_I: Configured from console by console
R4#
6、使用show ip route命令查看各路由器信息:
R1#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, 2 subnets
R       172.16.7.0 [120/3] via 192.168.4.2, 00:00:10, Serial1/2
C       172.16.3.0 is directly connected, FastEthernet0/0
C    192.168.4.0/24 is directly connected, Serial1/2
R    192.168.5.0/24 [120/1] via 192.168.4.2, 00:00:10, Serial1/2
R    192.168.6.0/24 [120/2] via 192.168.4.2, 00:00:10, Serial1/2
R1#
R2#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, 1 subnets
R       172.16.7.0 [120/2] via 192.168.5.3, 00:00:00, FastEthernet0/0
C    192.168.4.0/24 is directly connected, Serial1/2
C    192.168.5.0/24 is directly connected, FastEthernet0/0
R    192.168.6.0/24 [120/1] via 192.168.5.3, 00:00:00, FastEthernet0/0
R2#
R3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, 1 subnets
R       172.16.7.0 [120/1] via 192.168.6.4, 00:00:03, Serial1/1
R    192.168.4.0/24 [120/1] via 192.168.5.2, 00:00:23, FastEthernet0/0
C    192.168.5.0/24 is directly connected, FastEthernet0/0
C    192.168.6.0/24 is directly connected, Serial1/1
R3#
R4#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, 1 subnets
C       172.16.7.0 is directly connected, FastEthernet0/0
R    192.168.4.0/24 [120/2] via 192.168.6.3, 00:00:11, Serial1/1
R    192.168.5.0/24 [120/1] via 192.168.6.3, 00:00:11, Serial1/1
C    192.168.6.0/24 is directly connected, Serial1/1
R4#
7、在R1上的路由信息中,R1路由器已经学习到其它路由的信息,因为R1是设置版本1的rip路由协议,是可以学习到版本2的路由信息,而版本2只能学习到版本2的路由信息,所以路由器R2、R3、R4没有学习到R1的路由信息,可以使用show ip protocols查看,如所示:
R1#show ip protocols
Routing Protocol is "rip"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Sending updates every 30 seconds, next due in 17 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Redistributing: rip
  Default version control: send version 1, receive any version
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       1     1 2                                 
    Serial1/2             1     1 2                                 
  Automatic network summarization is in effect
  Maximum path: 4
  Routing for Networks:
    172.16.0.0
    192.168.4.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.4.2          120      00:00:14
  Distance: (default is 120)
R1#
R2#show ip pro
R2#show ip protocols
Routing Protocol is "rip"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Sending updates every 30 seconds, next due in 10 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       2     2                                    
    Serial1/2             2     2                                    
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    192.168.4.0
    192.168.5.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.5.3          120      00:00:08
  Distance: (default is 120)
R2#
8、为了让路由器R2、R3、R4也能学习到R1的路由信息,只需要在R2的ser1/2端口做如下设置就可以,因为rip路由协议是相邻路由器之间路由信息相互复制,所以只要R2路由器学习到了,其它路由器就能学习到。
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int ser1/2
R2(config-if)#ip rip re
R2(config-if)#ip rip receive v
R2(config-if)#ip rip receive version 1 2
R2(config-if)#exit
R2(config)#exit
R2#
*Mar  1 00:37:27.503: %SYS-5-CONFIG_I: Configured from console by console
R2#
10、再次使用show ip protocols查看:
R2#show ip protocols
Routing Protocol is "rip"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Sending updates every 30 seconds, next due in 24 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    FastEthernet0/0       2     2                                    
    Serial1/2             2     1 2                                 
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    192.168.4.0
    192.168.5.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.4.1          120      00:00:22
    192.168.5.3          120      00:00:12
  Distance: (default is 120)
R2#
11、再次使用show ip route命令时,R2、R3、R4学习到R1的路由信息:
R2#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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/16 is variably subnetted, 2 subnets, 2 masks
R       172.16.7.0/24 [120/2] via 192.168.5.3, 00:00:02, FastEthernet0/0
R       172.16.0.0/16 [120/1] via 192.168.4.1, 00:00:12, Serial1/2
C    192.168.4.0/24 is directly connected, Serial1/2
C    192.168.5.0/24 is directly connected, FastEthernet0/0
R    192.168.6.0/24 [120/1] via 192.168.5.3, 00:00:02, FastEthernet0/0
R2#
R3#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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/16 is variably subnetted, 2 subnets, 2 masks
R       172.16.7.0/24 [120/1] via 192.168.6.4, 00:00:09, Serial1/1
R       172.16.0.0/16 [120/2] via 192.168.5.2, 00:00:18, FastEthernet0/0
R    192.168.4.0/24 [120/1] via 192.168.5.2, 00:00:18, FastEthernet0/0
C    192.168.5.0/24 is directly connected, FastEthernet0/0
C    192.168.6.0/24 is directly connected, Serial1/1
R3#
R4#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.7.0/24 is directly connected, FastEthernet0/0
R       172.16.0.0/16 [120/3] via 192.168.6.3, 00:00:19, Serial1/1
R    192.168.4.0/24 [120/2] via 192.168.6.3, 00:00:19, Serial1/1
R    192.168.5.0/24 [120/1] via 192.168.6.3, 00:00:19, Serial1/1
C    192.168.6.0/24 is directly connected, Serial1/1
R4#
12、测试,真机与R4能互相ping通:
R4#ping 172.16.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 136/253/408 ms
R4#
C:\Documents and Settings\Administrator>ping 172.16.7.4
Pinging 172.16.7.4 with 32 bytes of data:
Reply from 172.16.7.4: bytes=32 time=244ms TTL=252
Reply from 172.16.7.4: bytes=32 time=268ms TTL=252
Reply from 172.16.7.4: bytes=32 time=185ms TTL=252
Reply from 172.16.7.4: bytes=32 time=176ms TTL=252
Ping statistics for 172.16.7.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 176ms, Maximum = 268ms, Average = 218ms
C:\Documents and Settings\Administrator>
在R4上使用扩展ping
R4#ping
Protocol [ip]:
Target IP address: 172.16.3.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.16.7.4
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:
Packet sent with a source address of 172.16.7.4
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 108/176/256 ms
R4#
本文出自 “
小张
” 博客,请务必保留此出处
http://chuan.blog.51cto.com/130796/79337
本文出自 51CTO.COM技术博客


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4206/showart_716146.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP