转载学习,https://blog.csdn.net/qq_43237999/article/details/89738813
问题
在相对较小而且结构不变的网络中,静态路由是很好的解决方案,它配置简单而且不过多消耗设备资源(动态路由协议在运行时要消耗路由器内部资源,在与其他路由器更新信息时又会消耗网络资源)。
然而在大型网络中,网络非常多,而且很有可能因为某些因素的影响,网络拓扑会有轻微变化。这时如果仍然采用静态路由就非常不方便了。
1)通过RIP实现路由间通信
方案
动态路由协议配置灵活,路由器会发送自身的路由信息给其他路由器,同时也会接收其他路由器发来的路由信息建立自己的路由表。这样在路由器上就不必像静态路由那样为每个目标地址都配置路由,因为路由器可以通过协议学习这些路由。网络拓扑改变,路由信息也会自动更新,无需管理员干预。
网络拓扑如图所示:
步骤
实现此案例需要按照如下步骤进行。
步骤一:VLAN以及端口配置与上面3三层交换配置路由完全一致,不再赘述配置
步骤二:将上面【1.3在三层交换机上配置路由】中的静态、默认路由删除
tarenasw-3L(config)#no ip route 0.0.0.0 0.0.0.0 192.168.10.1
tarena-rouer(config)#no ip route 192.168.1.0 255.255.255.0 192.168.10.2
tarena-rouer(config)#no ip route 192.168.2.0 255.255.255.0 192.168.10.2
tarena-rouer(config)#no ip route 192.168.3.0 255.255.255.0 192.168.10.2
步骤三:分别在三层交换机和路由器上配置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.10.0
tarena-rouer(config)#router rip
tarena-rouer(config-router)#version 2
tarena-rouer(config-router)#network 192.168.10.0
tarena-rouer(config-router)#network 200.1.1.0
步骤四:分别在三层交换机和路由器上查看路由表
注意以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.10.0/24 is directly connected, FastEthernet0/23
R 200.1.1.0/24 [120/1] via 192.168.10.1, 00:00:07, FastEthernet0/23
tarena-rouer#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.10.2, 00:00:10, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.10.2, 00:00:10, FastEthernet0/0
R 192.168.3.0/24 [120/1] via 192.168.10.2, 00:00:10, FastEthernet0/0
C 192.168.10.0/24 is directly connected, FastEthernet0/0
C 200.1.1.0/24 is directly connected, FastEthernet0/1
步骤五:在Server上测试到三个VLAN中主机的通信
SERVER>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::2E0:8FFF:FE14:BB43
IP Address......................: 200.1.1.10
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 200.1.1.1
SERVER>ping 192.168.1.10
Pinging 192.168.1.10 with 32 bytes of data:
Reply from 192.168.1.10: bytes=32 time=0ms TTL=126
Reply from 192.168.1.10: bytes=32 time=0ms TTL=126
Reply from 192.168.1.10: bytes=32 time=0ms TTL=126
Reply from 192.168.1.10: bytes=32 time=1ms TTL=126
Ping statistics for 192.168.1.10:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
SERVER>ping 192.168.2.10
Pinging 192.168.2.10 with 32 bytes of data:
Reply from 192.168.2.10: bytes=32 time=0ms TTL=126
Reply from 192.168.2.10: bytes=32 time=0ms TTL=126
Reply from 192.168.2.10: bytes=32 time=0ms TTL=126
Reply from 192.168.2.10: bytes=32 time=0ms TTL=126
Ping statistics for 192.168.2.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
SERVER>ping 192.168.3.10
Pinging 192.168.3.10 with 32 bytes of data:
Reply from 192.168.3.10: bytes=32 time=1ms TTL=126
Reply from 192.168.3.10: bytes=32 time=0ms TTL=126
Reply from 192.168.3.10: bytes=32 time=0ms TTL=126
Reply from 192.168.3.10: bytes=32 time=0ms TTL=126
Ping statistics for 192.168.3.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
SERVER>
31% /misc/nfsdir
————————————————
版权声明:本文为CSDN博主「秦庚辰」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_43237999/article/details/89738813