cisco Switching-三层交换配置RIP动态路由
在三层交换机上配置RIP路由协议,以三层交换机代替路由器。 通过RIP实现路由间通信动态路由协议配置灵活,路由器会发送自身的路由信息给其他路由器,同时也会接收其他路由器发来的路由信息建立自己的路由表。这样在路由器上就不必像静态路由那样为每个目标地址都配置路由,因为路由器可以通过协议学习这些路由。网络拓扑改变,路由信息也会自动更新,无需管理员干预。Switch(config)#interface f0/6Switch(config-if)#no switchportSwitch(config-if)#ip address 192.168.6.1 255.255.255.0Switch(config-if)#no shutdownRIP路由协议在配置network时,只需要配置该路由器所直连的主类网络,不与该路由器直连的网络不需要包含在network中。RIP默认工作在第一版本下,但是RIP-V1是有类路由协议,而且通过广播的方式进行路由更新,无论是功能上还是效率上都有一些缺陷,这些缺陷RIP-V2可以弥补。在使用时建议采用RIP-V2而不是RIP-V1。tarenasw-3L(config)#router riptarenasw-3L(config-router)#version 2tarenasw-3L(config-router)#no auto-summarytarenasw-3L(config-router)#network 192.168.1.0tarenasw-3L(config-router)#network 192.168.2.0tarenasw-3L(config-router)#network 192.168.3.0tarenasw-3L(config-router)#network 192.168.4.0tarenasw-3L(config-router)#network 192.168.5.0tarenasw-3L(config-router)#network 192.168.6.0tarena-router(config)#router riptarena-router(config-router)#version 2tarenasw-3L(config-router)#no auto-summarytarena-router(config-router)#network 192.168.6.0tarena-router(config-router)#network 192.168.7.0注意以R开头的路由,这些路由表示通过RIP协议从其他运行RIP的路由器学习过来的路由。每条路由都写明了目标网络、下一跳IP地址以及从自己哪个端口发出去。tarenasw-3L#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Vlan1C 192.168.2.0/24 is directly connected, Vlan2C 192.168.3.0/24 is directly connected, Vlan3C 192.168.4.0/24 is directly connected, Vlan4C 192.168.5.0/24 is directly connected, Vlan5C 192.168.6.0/24 is directly connected, FastEthernet0/6R 192.168.7.0/24 [120/1] via 192.168.6.2, 00:00:12, FastEthernet0/6 0Router#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setR 192.168.1.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0R 192.168.2.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0R 192.168.3.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0R 192.168.4.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0R 192.168.5.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0C 192.168.6.0/24 is directly connected, FastEthernet0/0C 192.168.7.0/24 is directly connected, FastEthernet0/15.在PC上测试到五个VLAN中主机的通信PC>ipconfigFastEthernet0 Connection:(default port)Link-local IPv6 Address.........: FE80::2E0:8FFF:FE14:BB43IP Address......................: 192.168.7.1Subnet Mask.....................: 255.255.255.0Default Gateway.................: 192.168.7.254SERVER>ping 192.168.1.10Pinging 192.168.1.10 with 32 bytes of data:Reply from 192.168.1.1: bytes=32 time=0ms TTL=126Reply from 192.168.1.1: bytes=32 time=0ms TTL=126Reply from 192.168.1.1: bytes=32 time=0ms TTL=126Reply from 192.168.1.1: bytes=32 time=1ms TTL=126Ping statistics for 192.168.1.1:Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 1ms, Average = 0msPC >ping 192.168.2.1Pinging 192.168.2.10 with 32 bytes of data:Reply from 192.168.2.1: bytes=32 time=0ms TTL=126Reply from 192.168.2.1: bytes=32 time=0ms TTL=126Reply from 192.168.2.1: bytes=32 time=0ms TTL=126Reply from 192.168.2.1: bytes=32 time=0ms TTL=126Ping statistics for 192.168.2.1:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 0ms, Average = 0msPC >ping 192.168.3.1Pinging 192.168.3.10 with 32 bytes of data:Reply from 192.168.3.1: bytes=32 time=1ms TTL=126Reply from 192.168.3.1: bytes=32 time=0ms TTL=126Reply from 192.168.3.1: bytes=32 time=0ms TTL=126Reply from 192.168.3.1: bytes=32 time=0ms TTL=126Ping statistics for 192.168.3.1:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 1ms, Average = 0msPC >31% /misc/nfsdir SERVER>SERVER>ping 192.168.3.10Pinging 192.168.3.10 with 32 bytes of data:Reply from 192.168.4.1: bytes=32 time=1ms TTL=126Reply from 192.168.4.1: bytes=32 time=0ms TTL=126Reply from 192.168.4.1: bytes=32 time=0ms TTL=126Reply from 192.168.4.1: bytes=32 time=0ms TTL=126Ping statistics for 192.168.4.1:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 1ms, Average = 0ms31% /misc/nfsdirSERVER>ping 192.168.5.1Pinging 192.168.5.1 with 32 bytes of data:Reply from 192.168.5.1: bytes=32 time=1ms TTL=126Reply from 192.168.5.1: bytes=32 time=0ms TTL=126Reply from 192.168.5.1: bytes=32 time=0ms TTL=126Reply from 192.168.5.1: bytes=32 time=0ms TTL=126Ping statistics for 192.168.5.1:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 1ms, Average = 0ms 31% /misc/nfsdir
