问题
在三层交换机上配置RIP路由协议,以三层交换机代替路由器。
通过RIP实现路由间通信
方案
动态路由协议配置灵活,路由器会发送自身的路由信息给其他路由器,同时也会接收其他路由器发来的路由信息建立自己的路由表。这样在路由器上就不必像静态路由那样为每个目标地址都配置路由,因为路由器可以通过协议学习这些路由。网络拓扑改变,路由信息也会自动更新,无需管理员干预。
拓扑图步骤
1.按拓扑图配置路由接口IP分别
2.在交换机上配置
Switch(config)#interface f0/6
Switch(config-if)#no switchport
Switch(config-if)#ip address 192.168.6.1 255.255.255.0
Switch(config-if)#no shutdown
3.分别在三层交换机和路由器上配置RIP路由协议
RIP路由协议在配置network时,只需要配置该路由器所直连的主类网络,不与该路由器直连的网络不需要包含在network中。
RIP默认工作在第一版本下,但是RIP-V1是有类路由协议,而且通过广播的方式进行路由更新,无论是功能上还是效率上都有一些缺陷,这些缺陷RIP-V2可以弥补。在使用时建议采用RIP-V2而不是RIP-V1。
tarenasw-3L(config)#router rip
tarenasw-3L(config-router)#version 2
tarenasw-3L(config-router)#no auto-summary
tarenasw-3L(config-router)#network 192.168.1.0
tarenasw-3L(config-router)#network 192.168.2.0
tarenasw-3L(config-router)#network 192.168.3.0
tarenasw-3L(config-router)#network 192.168.4.0
tarenasw-3L(config-router)#network 192.168.5.0
tarenasw-3L(config-router)#network 192.168.6.0
tarena-router(config)#router rip
tarena-router(config-router)#version 2
tarenasw-3L(config-router)#no auto-summary
tarena-router(config-router)#network 192.168.6.0
tarena-router(config-router)#network 192.168.7.0
4.分别在三层交换机和路由器上查看路由表
注意以R开头的路由,这些路由表示通过RIP协议从其他运行RIP的路由器学习过来的路由。每条路由都写明了目标网络、下一跳IP地址以及从自己哪个端口发出去。
tarenasw-3L#show 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
C 192.168.1.0/24 is directly connected, Vlan1
C 192.168.2.0/24 is directly connected, Vlan2
C 192.168.3.0/24 is directly connected, Vlan3
C 192.168.4.0/24 is directly connected, Vlan4
C 192.168.5.0/24 is directly connected, Vlan5
C 192.168.6.0/24 is directly connected, FastEthernet0/6
R 192.168.7.0/24 [120/1] via 192.168.6.2, 00:00:12, FastEthernet0/6 0
Router#show 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
R 192.168.1.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0
R 192.168.3.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0
R 192.168.4.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0
R 192.168.5.0/24 [120/1] via 192.168.6.1, 00:00:25, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
5.在PC上测试到五个VLAN中主机的通信
PC>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::2E0:8FFF:FE14:BB43
IP Address......................: 192.168.7.1
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.7.254
SERVER>ping 192.168.1.10
Pinging 192.168.1.10 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=0ms TTL=126
Reply from 192.168.1.1: bytes=32 time=0ms TTL=126
Reply from 192.168.1.1: bytes=32 time=0ms TTL=126
Reply from 192.168.1.1: bytes=32 time=1ms TTL=126
Ping 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 = 0ms
PC >ping 192.168.2.1
Pinging 192.168.2.10 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=0ms TTL=126
Reply from 192.168.2.1: bytes=32 time=0ms TTL=126
Reply from 192.168.2.1: bytes=32 time=0ms TTL=126
Reply from 192.168.2.1: bytes=32 time=0ms TTL=126
Ping 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 = 0ms
PC >ping 192.168.3.1
Pinging 192.168.3.10 with 32 bytes of data:
Reply from 192.168.3.1: bytes=32 time=1ms TTL=126
Reply from 192.168.3.1: bytes=32 time=0ms TTL=126
Reply from 192.168.3.1: bytes=32 time=0ms TTL=126
Reply from 192.168.3.1: bytes=32 time=0ms TTL=126
Ping 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 = 0ms
PC >
31% /misc/nfsdir SERVER>
SERVER>ping 192.168.3.10
Pinging 192.168.3.10 with 32 bytes of data:
Reply from 192.168.4.1: bytes=32 time=1ms TTL=126
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Ping 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 = 0ms
31% /misc/nfsdir
SERVER>ping 192.168.5.1
Pinging 192.168.5.1 with 32 bytes of data:
Reply from 192.168.5.1: bytes=32 time=1ms TTL=126
Reply from 192.168.5.1: bytes=32 time=0ms TTL=126
Reply from 192.168.5.1: bytes=32 time=0ms TTL=126
Reply from 192.168.5.1: bytes=32 time=0ms TTL=126
Ping 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
网友评论