首页 > 网管 > 路由交换 > 正文

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

2020-03-07 21:35:46
字体:
来源:转载
供稿:网友
普通交换机工作在链路层,即二层交换机,无路由功能,也就是只能同一个网段的机器才能通信。 
而三层交换机可以在网络层配置路由功能,使不同网段的设备可以通信。现以思科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口)就没有交换能力了。 
如果又要交换机有路由功能,又有交换功能,那么交换功能可以由其它口负担。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表