?問題
在三層交換機(jī)上配置RIP路由協(xié)議联四,以三層交換機(jī)代替路由器撑教。
通過RIP實(shí)現(xiàn)路由間通信
?方案
動(dòng)態(tài)路由協(xié)議配置靈活伟姐,路由器會(huì)發(fā)送自身的路由信息給其他路由器,同時(shí)也會(huì)接收其他路由器發(fā)來的路由信息建立自己的路由表鹿霸。這樣在路由器上就不必像靜態(tài)路由那樣為每個(gè)目標(biāo)地址都配置路由秆乳,因?yàn)槁酚善骺梢酝ㄟ^協(xié)議學(xué)習(xí)這些路由。網(wǎng)絡(luò)拓?fù)涓淖兏匾保酚尚畔⒁矔?huì)自動(dòng)更新,無需管理員干預(yù)珊肃。
步驟
1.按拓?fù)鋱D配置路由接口IP分別
2.在交換機(jī)上配置
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.分別在三層交換機(jī)和路由器上配置RIP路由協(xié)議
RIP路由協(xié)議在配置network時(shí)伦乔,只需要配置該路由器所直連的主類網(wǎng)絡(luò)评矩,不與該路由器直連的網(wǎng)絡(luò)不需要包含在network中阱飘。
RIP默認(rèn)工作在第一版本下,但是RIP-V1是有類路由協(xié)議蔗喂,而且通過廣播的方式進(jìn)行路由更新缰儿,無論是功能上還是效率上都有一些缺陷散址,這些缺陷RIP-V2可以彌補(bǔ)。在使用時(shí)建議采用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.分別在三層交換機(jī)和路由器上查看路由表
注意以R開頭的路由对蒲,這些路由表示通過RIP協(xié)議從其他運(yùn)行RIP的路由器學(xué)習(xí)過來的路由蹈矮。每條路由都寫明了目標(biāo)網(wǎng)絡(luò)鸣驱、下一跳IP地址以及從自己哪個(gè)端口發(fā)出去踊东。
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上測試到五個(gè)VLAN中主機(jī)的通信
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