卡饭网 > 交换机 > 正文

思科三层交换机路由功能配置教程

来源:本站整理 作者:梦在深巷 时间:2013-11-21 10:51:48

普通交换机工作在链路层,即二层交换机,无路由功能,也就是只能同一个网段的机器才能通信。
而三层交换机可以在网络层配置路由功能,使不同网段的设备可以通信。现以思科3550交换机为例配置三层路由功能。以实现如下拓扑通信。

----------------------------------
| 思科3550三层交换机 |
---- -------------------- -------
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

打开交换机路由转发开关
Switch#configure terminal
Switch(config)#ip routing
Switch(config)#ip cef (这个默认是打开的)

此时可以查看下23口的状态
Switch#show interfaces fastEthernet 0/23

此时在交换机上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的数据包通过50.1.1.1转发:
route ADD 60.1.1.0 MASK 255.255.255.0 50.1.1.1 METRIC 3

对应的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即可通信。

如果使用了交换机口的路由功能,那么此口(即这里的23,24口)就没有交换能力了。
如果又要交换机有路由功能,又有交换功能,那么交换功能可以由其它口负担。

相关推荐