Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17893206
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: 系统运维

2008-05-20 10:47:33

设置Fast Ethernet的命令如下:
Switch> (enable) set port channel [ports_to_be_channeled] [on|off|desirable|auto]
如下是把快速以太网端口1和2合并为Fast EtherChannel:
Switch_A> (enable) set port channel 1/1-2
Port(s) 1/1-2 channel mode set to on.
使用show port channel命令验证查看channel信息
Configuring Port Protocol Filtering

协议过滤是指端口根据协议,来对流量进行过滤.比如在只基于IP环境工作的工作站,就没必要接收基于IPX协议的广播.这样就减轻了带宽和CPU资源的占用.在协议过滤中,包被分成了4个类别:  
1.IP包
2.IPX包
3.AppleTalk,DECnet,和Banyan Vines包
4.其他类型的包

协议过滤的3种模式:
1.on:允许来自某组的从该端口传输出去
2.off:不允许来自某组的从该端口传输出去
3.aut不允许来自某组的从该端口传输出去,除非该端口先收到该组的流量.比如设置为auto的某端口是不会转发IPX流量,除非IPS流量从该端口进去过
要启用端口的协议过滤,首先使用set protocolfilter命令,如下:
Switch_B> (enable) set protocolfilter enable
Protocol filtering enabled on this switch.
Switch_B> (enable)
要注意的是,端口的协议过滤这一特性不是所有的Catalyst上都具备的,如下:
Switch_A> (enable) set protocolfilter enable
Protocol filtering not supported by this hardware.
Switch_A> (enable)
接下来设置端口协议过滤的模式和对流量的分组,如下:
Switch_B> (enable) set port protocol [mod_num/port_num] [ip|ipx|group] [on|off|auto]
比如,只允许Switch B上的端口2/1-12转发IP流量,如下:
Switch_B> (enable) set port protocol 2/1-12 ip on
IP protocol set to on mode on ports 2/1-12.
Switch_B> (enable) set port protocol 2/1-12 ipx off
IPX protocol disabled on ports 2/1-12.
Switch_B> (enable) set port protocol 2/1-12 group off
Group protocol disabled on ports 2/2-12.
Switch_B> (enable)
验证端口的协议过滤使用show port protocol命令,如下:
Port    Vlan   IP   IP Hosts   IPX    IPX Hosts    Group    Group Hosts
––  –––  –  ––––  ––    ––––    –––   –––––
2/1      1     on    0        off      0          off         0
2/2      1     on    0        off      0          off         0
Configuring Port Security

另外一种安全机制,叫安全端口过滤(secure port filtering),这样的机制只允许端口转发来自某个特定MAC地址的帧,这个MAC地址可以手动指定或者动态决定.设置命令如下:
Switch_B> (enable) set port security [mod_num/port_num] [enable|disable] [mac_addr]
假如你没有指定MAC地址的话,它将自动锁定收到的第一个帧的MAC地址,如下:
Switch_B> (enable) set port security 2/2 enable
Port 2/2 port security enabled with the learned mac address.
Trunking disabled for Port 2/2 due to Security Mode
Switch_B> (enable)
通过自动锁定所学习到的MAC地址可以通过命令show port security查看,如下:
Switch_B> (enable) show port security 2/2
Port    Security     Secure-Src-Addr     Last-Src-Addr    Shutdown   Trap     IfIndex
––   ––––    ––––––       –––––     ––––  –––   ––––
2/2     enabled      22-22-22-22-22-22      No          disabled               10
(略)
Switch_B> (enable)


Working with Sniffers
port mirroring(或叫port spanning)是Catalyst的一种特性,它可以在一个端口上监视流量到达另一端口的过程,这个端口就叫span port.设置监视到达span port的帧的命令如下:   
Switch_B> (enable) set span [source] [span port] [rx | tx | both]
参数source可以为单独的一个端口或者几个端口,还可以是VLAN ID;参数[rx | tx | both]可选,默认为both
例子,监视从端口2/3到端口2/2的帧,如下:
Switch_B> (enable) set span 2/3 2/2
Enabled monitoring of Port 2/3 transmit/receive traffic by Port 2/2
Switch_B> (enable)
监视从端口2/3-12到端口2/2的帧,如下:
Switch_B> (enable) set span 2/3-12 2/2
Enabled monitoring of Port 2/3-12 transmit/receive traffic by Port 2/2
Switch_B> (enable)
监视从VLAN 10到端口2/2的帧,如下:
Switch_B> (enable) set span 10 2/2
Enabled monitoring of VLAN 10 transmit/receive traffic by Port 2/2
Switch_B> (enable)
检查当前span port的设置,使用show span命令,如下:
Switch_B> (enable) show span
Status               : enabled
Admin Source         : VLAN 10
Oper Source          : Port 2/49
Destination           : Port 2/2
Direction             : transmit/receive
Incoming Packets      : disabled
Switch_B> (enable)
Controlling Broadcasts   

可以在交换机的端口进行广播的控制.广播的控制可能因模块的不同而不同.有的模块不能限制单独的某个端口的广播,必须限制全部端口;有的就可以限制单独某个端口.限制广播的命令(百分比),如下:
Switch_A> (enable) set port broadcast [mod_num/port_num] [threshhold%]
例子,限制端口2/1-12的广播流量的百分比不得高于50%,如下:
Switch_A> (enable) set port broadcast 3/1-12 50%
Port 3/1-24 broadcast traffic limited to 50%.
还可以通过广播包数量而不是百分比的方式来进行限制,如下:
Switch_A> (enable) set port broadcast 3/1-12 500
Ports 3/13-24 broadcast traffic unlimited.
Ports 3/1-12 broadcast traffic limited to 500 packets/second.
Switch_A> (enable)
验证端口的广播控制使用show port broadcast命令,如下:
Switch_A> (enable) show port broadcast
Port      Broadcast-Limit         Broadcast-Drop
––     –––––––        –––––––
1/1           -                       0
1/            -                       0
3/1          500p/s                    0
3/2          500 p/s                   0
3/3          500 p/s                   0
3/4          500 p/s                   0
(略)
Working with CAM

bridge table,也叫content address memort(CAM) table.可以使用set cam命令往CAM table中添加条目,这些条目可以是单播或多播.默认交换机会把多播当广播处理,会从每个端口都转发出去,可以使用set cam命令,来把多播和某些端口进行静态的映射.set cam命令语法如下:
Switch_A> (enable) set cam [dynamic|static|permanent] [MAC_address] [mod/port] [VLAN]
注意,当参数指定了VLAN的时候,注意所有端口必须处于同一个VLAN
存放在CAM table中的条目的生存周期是有限的.默认,通过动态学习到的条目将保存5分钟,如果空闲时间超过5分钟,条目将被删除.如果要让条目暂时的保存在cam table中,使用dynamic参数;如果想一直保存直到交换机重启,使用static参数;如果想永久保存,使用permanent参数
例子,把多播映射到某些端口上,如下:   
Switch_A> (enable) set cam static 01-00-12-11-11-11 3/3,3/5,3/7,3/12
Static multicast entry added to CAM table.
Switch_A> (enable)
验证cam table,使用show cam命令,如下:
Switch_A> (enable) show cam [dynamic|static|permanent|system]
如果想修改动态学习到的条目的生存时间,使用set cam agingtime命令(单位为秒),如下:
Switch_A> (enable) set cam agingtime 1-1005 600
Vlans 1-1005 CAM aging time set to 600 seconds.
Switch_A> (enable)
Routing VLANs with an External Router (One-Armed Routing)
可以在外部路由器上,创建子接口(subinterface),来路由多个VLAN,每个子接口对应一个VLAN,IOS版本至少要为11.1(2).如下图:
function ImgZoom(Id)//重新设置图片大小 防止撑破表格 { var w = $(Id).width; var m = 550; if(w < m) { return; } else { var h = $(Id).height; $(Id).height = parseInt(h*m/w); $(Id).width = m; } } window.onload = function() { var Imgs = $("content").getElementsByTagName("img"); var i=0; for(;i
;" border=0>
Cisco4500(config-if)#int fa 0.10
Cisco4500(config-subif)#encap isl 10
Cisco4500(config-subif)#ip addr 172.16.10.1 255.255.255.0
Cisco4500(config-subif)#^Z
Cisco4500#conf t
Cisco4500(config)#int fa 0
Cisco4500(config-if)#int fa 0.20
Cisco4500(config-subif)#encap isl 20
Cisco4500(config-subif)#ip addr 172.16.20.1 255.255.255.0
Configuring the RSM
Route Switch Module(RSM)运行自己的操作系统,IOS.配置命令和配置Cisco路由器是一样的,不同的地方是RSM使用叫做VLAN interface的虚拟接口取代物理接口.按刚才的例子配置VLAN间通信,只需按如下配置即可:   
interface Vlan10
description VLAN 10 FSU
ip address 172.16.10.1 255.255.255.0
!
interface Vlan20
description VLAN 20 Duke
ip address 172.16.20.1 255.255.255.0
!
Multilayer Switching (MLS) Defined
多层交换(multilayer switching)或3层交换(layer 3 switching)有点像路由器的仿制品,它查找路由的方式和路由器查找路由的方式是有所区别的
如下图:

当工作站A要发送帧给工作站B,帧先到达交换机,帧的目标MAC地址为路由器的MAC地址,源MAC地址为工作站A的MAC地址;目标IP地址为工作站B的IP地址,源IP地址问工作站A的IP地址.交换机把帧打上标签,表明该帧来自VLAN 10,转发给路由器

路由器收到帧以后,读取标签,解封装,然后根据目标IP地址做路由决定。由于路由器发现目标IP地址位于和交换机相连的VLAN 20,路由器又重新封装帧,转发给交换机,帧的源MAC地址更改为路由器的MAC地址,目标MAC地址更改为工作站B的MAC地址,并打上标签暗示帧目前属于VLAN 20

交换机收到帧以后,读取标签和目标MAC地址,转发帧给工作站B
整个过程,帧经过trunk line两次,经过路由器一次,经过交换机两次.路由器根据路由表做转发决定,这样有个缺点,就是增加了延时(latency).如果采用MLS或3层交换,可以在不产生多余延时的情况下达到同样效果,这样就不用查找路由表,也无需经过trunk line两次。
阅读(617) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~