思科三層交換機(jī)路由功能配置教程
2020-10-24 11:28:22
供稿:網(wǎng)友
普通交換機(jī)工作在鏈路層,即二層交換機(jī),無路由功能,也就是只能同一個網(wǎng)段的機(jī)器才能通信。
而三層交換機(jī)可以在網(wǎng)絡(luò)層配置路由功能,使不同網(wǎng)段的設(shè)備可以通信。現(xiàn)以思科3550交換機(jī)為例配置三層路由功能。以實現(xiàn)如下拓?fù)渫ㄐ拧?
----------------------------------
| 思科3550三層交換機(jī) |
---- -------------------- -------
50.1.1.1 (23口) 60.1.1.1(24口)
|| ||
|| ||
50.1.1.2 60.1.1.2
(pc1) (pc2)
配置23口:
Switch#enable
Switch#configure terminal
Switch(config)#interface fastEthernet 0/23
Switch(config)ip addr 50.1.1.1 255.255.255.0
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#end
類似的配置24口:
Switch#enable
Switch#configure terminal
Switch(config)#interface fastEthernet 0/24
Switch(config)ip addr 60.1.1.1 255.255.255.0
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#end
打開交換機(jī)路由轉(zhuǎn)發(fā)開關(guān):
Switch#configure terminal
Switch(config)#ip routing
Switch(config)#ip cef (這個默認(rèn)是打開的)
此時可以查看下23口的狀態(tài):
Switch#show interfaces fastEthernet 0/23
此時在交換機(jī)上ping兩個口的地址成功:
Switch#ping 50.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 50.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Switch#ping 60.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 60.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
Switch#
pc1(win7)增加路由:
到60.1.1.0/24的數(shù)據(jù)包通過50.1.1.1轉(zhuǎn)發(fā):
route ADD 60.1.1.0 MASK 255.255.255.0 50.1.1.1 METRIC 3
對應(yīng)的pc2也增加路由:
route ADD 50.1.1.0 MASK 255.255.255.0 60.1.1.1 METRIC 3
此時50.1.1.2和60.1.1.2即可通信。
如果使用了交換機(jī)口的路由功能,那么此口(即這里的23,24口)就沒有交換能力了。
如果又要交換機(jī)有路由功能,又有交換功能,那么交換功能可以由其它口負(fù)擔(dān)。