Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2384235
  • 博文数量: 328
  • 博客积分: 4302
  • 博客等级: 上校
  • 技术积分: 5486
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-01 11:14
个人简介

悲剧,绝对的悲剧,悲剧中的悲剧。

文章分类

全部博文(328)

文章存档

2017年(6)

2016年(18)

2015年(28)

2014年(73)

2013年(62)

2012年(58)

2011年(55)

2010年(28)

分类: 网络与安全

2014-10-13 23:06:26

三层交换机在大中型网络发挥着普通二层交换机无法替代的重要作用。原因很简单,当网络内的计算机数量较多时,必须要划分为若干个虚拟网,以提高网络安全性,减少广播对网络带宽的占用,从而提高网络传输效率和计算机性能。而虚拟网之间的通信,则必须借助三层交换机才能实现。另外,许多安全访问策略也只有在三层交换机上才能实现。


为第三层接口配置IP地址


借助Cisco IOS IP和IP路由协议,Cisco Catalyst 4000/4500/6500系列交换机支持三层接口,用于实现企业内部网络内各逻辑网络之间的数据交换。Cisco三层交换机提供两种类型的三层接口,即逻辑三层VLAN接口和物理三层接口。逻辑三层VLAN接口整合了路由和桥接功能,用于实现VLAN之间的线速路由;借助于物理三层接口,可以在三层交换机上实现类似传统路由的功能,实现端口间的路由。

配置逻辑三层接口

在配置逻辑三层接口前,必须在交换机上已经创建并配置VLAN,并将VLAN成员指定到二层接口。另外,还必须启用IP路由,并指定IP路由协议。
  1. 第一步:进入全局配置模式。
  2. Switch# configure terminal

  3. 第二步:指定欲配置的VLAN。
  4. Switch(config)# vlan vlan_id

  5. 第三步:为该VLAN指定IP地址信息。该VLAN中的计算机,将使用该IP地址作为默认网关。
  6. Switch(config-if)# ip address ip_address subnet_mask

  7. 第四步:启用该逻辑三层接口。
  8. Switch(config-if)# no shutdown

  9. 第五步:退出配置模式。
  10. Switch(config-if)# end

  11. 第六步:将配置保存至NVRAM。
  12. Switch# copy running-config startup-config

  13. 第七步:校验配置。
  14. Switch# show interfaces [type slot/interface]
  15. Switch# show ip interfaces [type slot/interface]
  16. Switch# show running-config interfaces [type slot/interface]
  17. Switch# show running-config interfaces vlan vlan_ID

配置物理三层接口

在配置物理三层接口之前,必须先启用IP路由,并指定IP路由协议。
  1. 第一步:进入全局配置模式。
  2. Switch# configure terminal

  3. 第二步:启用IP路由。
  4. Switch(config)#ip routing

  5. 第三步:指定欲配置的接口。可以是物理接口,也可以是EtherChannel。
  6. Switch(config)# interface interface-id

  7. 第四步:将物理二层接口转换为物理三层接口。
  8. Switch(config-if)#no switchport

  9. 第五步:为该接口配置IP地址信息。
  10. Switch(config-if)# ip address ip_address subnet_mask

  11. 第六步:启用该物理三层接口。
  12. Switch(config-if)# no shutdown

  13. 第七步:退出配置模式。
  14. Switch(config-if)# end

  15. 第八步:将配置保存至NVRAM。
  16. Switch# copy running-config startup-config

  17. 第九步:校验配置。
  18. Switch# show interfaces [type slot/interface]
  19. Switch# show ip interfaces [type slot/interface]
  20. Switch# show running-config interfaces [type slot/interface]

设置静态路由

如果Telnet终端或SNMP网络管理站点与交换机位于不同的网络,并且没有配置路由协议,那么,将需要添加静态路由表以实现与彼此之间的通信。
  1. 第一步:进入全局配置模式。
  2. Switch# configure terminal

  3. 第二步:配置到远程网络的静态路由。
  4. Switch(config)# ip route dest_IP_address mask {forwarding_IP | vlan vlan_ID}

  5. 第三步:返回特权配置模式。
  6. Switch(config)# end

  7. 第四步:校验当前设置。
  8. Switch# show running-config

  9. 第五步:保存当前配置。
  10. Switch# copy running-config startup-config


实例分析


一、网络拓扑图:

 
 

二、路由器的配置: 

interface FastEthernet0/0 
ip address 10.66.88.222 255.255.255.0 
ip nat outside 
duplex auto 
speed auto 
interface FastEthernet0/1 
ip address 192.168.1.1 255.255.255.0 
ip nat inside 
duplex auto 
speed auto 
interface Vlan1 
no ip address 
shutdown 
ip nat inside source list 1 interface FastEthernet0/0 overload 
ip classless 
ip route 192.168.2.0 255.255.255.0 192.168.1.222 
ip route 192.168.3.0 255.255.255.0 192.168.1.222 
access-list 1 permit 192.168.0.0 0.0.255.255 

三、三层交换机的配置: 

hostname L3-SW 
ip dhcp pool vlan2pool 
network 192.168.3.0 255.255.255.0 
default-router 192.168.3.1 
dns-server 202.101.172.35 
ip dhcp pool vlan1pool 
network 192.168.2.0 255.255.255.0 
default-router 192.168.2.1 
dns-server 202.101.172.35 
interface FastEthernet0/1 
no switchport 
ip address 192.168.1.222 255.255.255.0 
duplex auto 
speed auto 
interface FastEthernet0/2 
switchport mode trunk 
interface FastEthernet0/5 
switchport mode trunk 
interface Vlan1 
ip address 192.168.2.1 255.255.255.0 
interface Vlan2 
ip address 192.168.3.1 255.255.255.0 
ip classless 
ip route 0.0.0.0 0.0.0.0 192.168.1.1 

四、二层交换机的配置: 

1、switch0的配置: 
hostname sw0 
interface FastEthernet0/1 
switchport mode trunk 
interface FastEthernet0/2 
switchport mode access 
2、switch1的配置: 
hostname sw1 
interface FastEthernet0/1 
switchport mode trunk 
interface FastEthernet0/2 
switchport access vlan 2 
switchport mode access

参考:
阅读(4828) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~