论坛: 系统集成 标题: 在cisco4006划的vlan之间实现互访控制的具体命令如何??? 复制本贴地址    
作者: godman [good_2004]    论坛用户   登录
我刚接触一台4006在上面划了三个VLAN1,2,3,可不知如何启动或关闭它的三层交换功能的具体命令,而且如何控制VLAN之间的互访命令也不知道。 我打了SH ? 可就是找不到. 哪位兄弟能提供具体命令比如我想VLAN 2与VLAN 3 之间不能互访, 但它们可以访问VLAN 1 。
先谢了

地主 发表时间: 04-01-31 23:56

回复: Achieve [achieve]   版主   登录
见以下例子:
4006# configure terminal

4006(config)# interface range fastethernet2/1 - 5

4006(config-if-range)# no shutdown
40065(config-if-range)#
*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet2/1, changed state to up
*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet2/2, changed state to up
*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet2/3, changed state to up
*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet2/4, changed state to up
*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet2/5, changed state to up
*Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/05,
changed state to up
*Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/3, changed
state to up
*Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/4, changed
state to up

以下的例子显示使用逗号来配置不同类型端口的组:
4006# configure terminal

4006(config)# interface range fastethernet2/1 �C 3, gigabitethernet3/1 - 2

4006(config-if-range)# no shutdown
4006(config-if-range)#
*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet2/1, changed state to up
*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet2/2, changed state to up
*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet2/3, changed state to up
*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet3/1, changed state to up
*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet3/2, changed state to up
*Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/ 1,
changed state to up
*Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 2,
changed state to up
*Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 3,
changed state to up

配置二层端口
4006的所有端口缺省的端口都是二层口,如果此端口已经配置成三层端口的话,则需要用switchport来使其成为二层端口。
配置端口速率及双工模式
可以配置快速以太口的速率为10/100Mbps及千兆以太口的速率为10/100/1000 -Mbps; 但对于GBIC端口则不能配置速率及双工模式,有时可以配置nonegotiate, 当需要联接不支持自适应的其它千兆端口时
命令 目的
Step 1  configure terminal 进入配置状态.
Step 2  interface interface-id 进入端口配置状态.
Step 3  speed {10 | 100 | 1000 | auto | nonegotiate} 设置端口速率 注  1000 只工作在千兆口. GBIC模块只工作在1000 Mbps下. nonegotiate 只能在这些GBIC上用 1000BASE-SX, -LX, and -ZX GBIC.
Step 4  duplex {auto | full | half} 设置全双工或半双工.
Step 5  end 退出
Step 6  show interfaces interface-id 显示有关配置情况
Step 7  copy running-config startup-config 保存


Switch# configure terminal

Switch(config)# interface fastethernet2/3

Switch(config-if)# speed 10

Switch(config-if)# duplex half
端口描述

命令 目的
Step 1  configure terminal 进入配置模式
Step 2  interface interface-id 进入要加入描述的端口
Step 3  description string 加入描述 (最多240个字符).
Step 4  end 退回.
Step 5  show interfaces interface-id descriptionorshow running-config 验证.
Step 6  copy running-config startup-config 保存

Use the no description interface configuration command to delete the description.
This example shows how to add a description on Fast Ethernet interface 0/4 and to verify the description:
4006# config terminal

Enter configuration commands, one per line.  End with CNTL/Z.
4006(config)# interface fastethernet2/4

4006(config-if)# description Connects to Marketing

4006(config-if)# end

4006# show interfaces fastethernet2/4 description

Interface Status        Protocol Description
Fa2/4    up            down    Connects to Marketing
配置三层口
Catalyst 4006支持三种类型的三层端口:
・ SVIs: 即interface vlan

  Note  当生成一个interface Vlan时,只有当把某一物理端口分配给它时才能被激活

・ 三层以太网通道口(EtherChannel)
・ .路由口:路由口是指某一物理端口在端口配置状态下用no switchport命令生成的端口
所有的三层都需要IP地址以实现路由交换
配置步骤如下:
命令 目的
Step 1  configure terminal 进入配置状态
Step 2  interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port-channel port-channel-number} 进入端口配置状态
Step 3  no switchport 把物理端口变成三层口
Step 4  ip address ip_address subnet_mask  配置IP地址和掩码
Step 5  no shutdown 激活端口
Step 6  end 退出
Step 7  show interfaces [interface-id]show ip interface [interface-id]show running-config interface [interface-id] 验证配置
Step 8  copy running-config startup-config 保存配置

配置举例如下:
4006# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.
4006(config)# interface gigabitethernet3/2

4006(config-if)# no switchport

4006(config-if)# ip address 192.20.135.21 255.255.255.0

4006(config-if)# no shutdown

4006(config-if)# end


show ip interface命令:
4006# show ip interface gigabitethernet3/2

GigabitEthernet3/2 is up, line protocol is up
  Internet address is 192.20.135.21/24
  Broadcast address is 255.255.255.255
  Address determined by setup command
  MTU is 1500 bytes
  Helper address is not set
  Directed broadcast forwarding is disabled

<output truncated>
监控及维护端口
监控端口和控制器的状态
主要命令见下表:
Show Commands for Interfaces Command  目的
show interfaces [type slot/interface]  显示所有端口或某一端口的状态和配置.
show interfaces interface-id status [err-disabled] 显示一系列端口的状态或错误-关闭的状态
show interfaces [interface-id] switchport 显示二层端口的状态,可以用来决定此口是否为二层或三层口。
show interfaces [interface-id] description 显示端口描述
show protocols [type slot/interface] 显示在任何已配置协议下全局和接口的状态
show running-config interface [interface-id] 显示当前配置中的端口配置情况
show version 显示软硬件等情况

举例如下:
Switch#show interfaces status
Port Name Status Vlan Duplex Speed Type
Gi1/1 notconnect 1 auto auto No Gbic
Gi1/2 notconnect 1 auto auto No Gbic
Gi5/1 notconnect 1 auto auto 10/100/1000-TX
Gi5/2 notconnect 1 auto auto 10/100/1000-TX
Gi5/3 notconnect 1 auto auto 10/100/1000-TX
Gi5/4 notconnect 1 auto auto 10/100/1000-TX
Fa6/1 connected 1 a-full a-100 10/100BaseTX
Fa6/2 connected 2 a-full a-100 10/100BaseTX
Fa6/3 notconnect 1 auto auto 10/100BaseTX
Fa6/4 notconnect 1 auto auto 10/100BaseTX
Switch#
This example shows how to display the status of interfaces in error-disabled state:
Switch# show interfaces status err-disabled
Port Name Status Reason
Fa9/4 err-disabled link-flap
informational error message when the timer expires on a cause
--------------------------------------------------------------
5d04h:%PM-SP-4-ERR_RECOVER:Attempting to recover from link-flap err-disable state on Fa9/4
Switch#

Switch# show protocols fastethernet 5/5
FastEthernet5/5 is up, line protocol is up
Switch#

刷新、重置端口及计数器
Clear命令 目的
clear counters {type slot/interface} 清除端口计数器.
clear interface {type slot/interface} 重置某一端口的硬件逻辑
clear line [number | console 0 | vty number] 重置异步串口的硬件逻辑


  Note  clear counters 命令只清除用show interface所显示的计数,不影响用snmp得到的计数

举例如下:
Switch# clear counters fastethernet 5/5
Clear "show interface" counters on this interface [confirm] y
Switch#
*Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface FastEthernet5/5
by vty1 (171.69.115.10)
Switch#
可使用clear interface 或 clear line 命令来清除或重置某一端口或串口,在大部分情况下并不需要这样做:
Switch# clear interface fastethernet0/5

关闭和打开端口
命令  目的
Step 1  configure terminal 进入配置状态
Step 2  interface {vlan vlan-id} | {{fastethernet | gigabitethernet} slot/port} | {port-channel port-channel-number} 选择要关闭的端口
Step 3  shutdown 关闭
Step 4  end 退出
Step 5  show running-config 验证

使用 no shutdown 命令重新打开端口.
举例如下:
Switch# configure terminal

Switch(config)# interface fastethernet2/5
Switch(config-if)# shutdown
Switch(config-if)#
*Sep 30 08:33:47: %LINK-5-CHANGED: Interface FastEthernet2/5, changed state to a
administratively down

Switch# configure terminal

Switch(config)# interface fastethernet2/5
Switch(config-if)# no shutdown
Switch(config-if)#
*Sep 30 08:36:00: %LINK-3-UPDOWN: Interface FastEthernet2/5, changed state to up

配置VLAN
理解VLAN
一个VLAN就是一个交换网,其逻辑上按功能、项目、应用来分而不必考虑用户的物理位置。任何交换口都可以属于某一VLAN, IP包、广播包及组播包均可以发送或广播给在此VLAN内的最终用户。每一个VLAN均可看成是一个逻辑网络,发往另一VLAN的数据包必须由路由器或网桥转发(如下图)。由于VLAN被看成是一个逻辑网络,其具有自己的网桥管理信息�� (MIB) 并可支持自己的生成树

VLAN作为逻辑定义的网络示意图


VLAN常常与IP子网相联系,同一IP子网属于同一VLAN。在3550上VLAN之间的数据包可以由VLAN端口进行转发。
可支持的VLAN
Catalyst 4006交换机将来的版本可支持4096个VLAN,可以分别是VTP client, server, 及 transparent modes. VLAN号可以从1到4094. VLAN号1002到1005保留给令牌环及FDDI VLAN. VTP只能学习到普通范围的VLAN, 即从VLAN到1到1005; VLAN号大于1005属于扩展VLAN,不存在VLAN数据�熘小� 交换机必须配置成VTP透明模式当需要生成VLAN 号从1006到4094.
本交换机支持基于每一VLAN的生成树(PVST),最多支持128个生成树。本交换机支持ISL及IEEE 802.1Q trunk二种封装。
配置正常范围的VLAN
VLAN号1, 1002到1005是自动生成的不能被去掉。
生成、修改以太网VLAN

命令 目的
Step 1  configure terminal 进入配置状态
Step 2  vlan vlan-id 输入一个VLAN号, 然后进入vlan配置状态,可以输入一个新的VLAN号或旧的来进行修改。
Step 3  name vlan-name (可选)输入一个VLAN名,如果没有配置VLAN名,缺省的名字是VLAN号前面用0填满的4位数,如VLAN0004是VLAN4的缺省名字
Step 4  mtu mtu-size (可选) 改变MTU大小
Step 5  end 退出
Step 6  show vlan {name vlan-name | id vlan-id} 验证
Step 7  copy running-config startup config (可选) 保存配置
用no vlan name 或 no vlan mtu 退回到缺省的vlan配置状态
举例如下:
Switch# configure terminal

Switch(config)# vlan 20

Switch(config-vlan)# name test20

Switch(config-vlan)# end



也可以在enable状态下,进行VLAN配置:
命令  目的
Step 1  vlan database 进入VLAN配置状态
Step 2  vlan vlan-id name vlan-name 加入VLAN号及VLAN名
Step 3  vlan vlan-id mtu mtu-size (可选) 修改MTU大小
Step 4  exit 更新VLAN数据�觳⑼顺�
Step 5  show vlan {name vlan-name | id vlan-id} 验证配置
Step 6  copy running-config startup config 保存配置(可选)

举例如下:
Switch# vlan database

Switch(vlan)# vlan 20 name test20

Switch(vlan)# exit

APPLY completed.
Exiting....
Switch#
删除VLAN
当删除一个处于VTP服务器的交换机上删除VLAN时,则此VLAN将在所有相同VTP的交换机上删除。当在透明模式下删除时,只在当前交换机上删除。
  注意  当删除一个VLAN时,原来属于此VLAN的端口将处于非激活的状态,直到将其分配给某一VLAN。



命令  目的
Step 1  configure terminal 进入配置状态
Step 2  no vlan vlan-id 删除某一VLAN.
Step 3  end 退出
Step 4  show vlan brief 验证
Step 5  copy running-config startup config 保存

也可用vlan database 进入VLAN配置状态,用no vlan vlan-id 来删除。
将端口分配给一个VLAN

命令  目的
Step 1  configure terminal 进入配置状态
Step 2  interface slot/port 进入要分配的端口
Step 3  switchport mode access 定义二层口
Step 4  switchport access vlan vlan-id 把端口分配给某一VLAN
Step 5  end 退出
Step 6  show running-config interface slot/port 验证端口的VLAN号
Step 7  show interfaces slot/port switchport 验证端口的管理模式和VLAN情况
Step 8  copy running-config startup-config 保存配置

使用 default interface slot/port还原到缺省配置状态。
举例如下:
Switch# configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)# interface fastethernet2/1

Switch(config-if)# switchport mode access

Switch(config-if)# switchport access vlan 2

Switch(config-if)# end
Switch#
配置VLAN Trunks

命令  目的
Step 1  configure terminal 进入配置状态
Step 2  interface interface-id 进入端口配置状态
Step 3  switchport trunk encapsulation {isl | dot1q | negotiate} 配置trunk封装ISL 或 802.1Q 或自动协商
Step 4  switchport mode {dynamic {auto | desirable} | trunk} 配置二层trunk模式。・ dynamic auto―自动协商是否成为trunk・ dynamic desirable―把端口设置为trunk如果对方端口是trunk, desirable, 或自动模式・ trunk―设置端口为强制的trunk方式,而不理会对方端口是否为trunk
Step 5  switchport access vlan vlan-id (可选) 指定一个缺省VLAN, 如果此端口不再是trunk
Step 6  switchport trunk native vlan vlan-id 指定802.1Q native VLAN号
Step 7  end 退出
Step 8  show interfaces interface-id switchport 显示有关switchport 的配置
Step 9  show interfaces interface-id trunk 显示有关trunk的配置
Step 10  copy running-config startup-config 保存配置
举例:
Switch# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)# interface fastetherne2/4

Switch(config-if)# switchport mode trunk

Switch(config-if)# switchport trunk encapsulation dot1q

Switch(config-if)# end
定义trunk允许的VLAN
缺省情况下trunk允许所有的VLAN通过。可以使用 switchport trunk allowed vlan remove vlan-list 来去掉某一VLAN
Command  Purpose
Step 1  configure terminal 进入配置状态
Step 2  interface interface-id 进入端口配置
Step 3  switchport mode trunk 配置二层口为trunk
Step 4  switchport trunk allowed vlan {add | all | except | remove} vlan-list  (可选) 配置trunk允许的VLAN. 使用add, all, except,  remove关健字
Step 5  end 退出
Step 6  show interfaces interface-id switchport  验证VLAN配置情况.
Step 7  copy running-config startup-config 保存配置

回到允许所有VLAN通过时, 可用no switchport trunk allowed vlan 端口配置命令.
举例如下:
Switch(config)# interface fastethernet2/1

Switch(config-if)# switchport trunk allowed vlan remove 2

Switch(config-if)# end

配置Native VLAN(802.1q)
封装802.1q的trunk端口可以接受带有标签和不带标签的数据流,交换机向native vlan传送不带标签的数据流,缺省情况下native VLAN是1。

命令  目的
Step 1  configure terminal 进入配置状态
Step 2  interface interface-id 进入配置成802.1qtrunk的端口
Step 3  switchport trunk native vlan vlan-id 配置native VLAN号
Step 4  end 退出
Step 5  show interfaces interface-id switchport 验证native VLAN配置
Step 6  copy running-config startup-config 保存配置
使用no switchport trunk native vlan 端口配置命令回到缺省的状态
使用STP实现负载均衡
负载均衡可以使用流量分流到其它平行的trunks上去. 交换机为了避免环路, STP通常是阻断所有端口交换机之间只留一条链路 。使用负载均衡后, 可以把不同VLAN的流量分配到不同的trunk上。
可以通过配置STP端口权值STP路径值来实现负载均衡. 如果使用STP端口权值来配置那么二条负载均衡的trunk必须联同一交换机上。使用路径值则即可以联相同的交换机与可以联不同的交换机。
使用STP端口权值的负载均衡
当同一台交换机的二个口形成环路时, STP端口权值用来决定那个口是enable的,那个口是阻断的。 可以通过配置端口权值来决定二对trunk各走那些VLAN, 有较高权值的端口(数字较小的)vlan, 将处于转发状态,同一个VLAN在另一个trunk有较低的权值(数字较大)则将处在阻断状态。 即同一VLAN只在一个trunk上发送接受。

基于端口权值的负载均衡示意图
trunk1将发送和接收VLAN8-10的数据,trunk2将发送和接收VLAN3-6的数据

配置如下:
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2  vtp domain domain-name 配置VTP域
Step 3  vtp mode server 将Switch 1配置成VTP server.
Step 4  end 退出
Step 5  show vtp status 验证VTP的配置
Step 6  show vlan 验证VLAN
Step 7  configure terminal 进入配置状态
Step 8  interface fastethernet 0/1 进入F0/1端口
Step 9  switchport trunk encapsulation {isl | dot1q | negotiate} 配置trunk封装
Step 10  switchport mode trunk 配置成trunk
Step 11  end 退出
Step 12  show interfaces fastethernet0/1 switchport 验证VLAN配置
Step 13  在switch1上的F0/2上重复7到11步骤
Step 14  在Switch 2的F0/1,F0/2上重复7到11步骤。
Step 15  show vlan 当trunk已经起来,在switch2上验证已经学到相关的vlan配置
Step 16  configure terminal 在Switch 1上进入配置状态
Step 17  interface fastethernet0/1 进入要配置的端口
Step 18  spanning-tree vlan 8 port-priority 10 将端口权值10赋与VLAN 8.
Step 19  spanning-tree vlan 9 port-priority 10 将端口权值10赋与VLAN 9.
Step 20  spanning-tree vlan 10 port-priority 10 将端口权值10赋与VLAN 10.
Step 21  exit 退回.
Step 22  interface fastethernet0/2 进入F0/2
Step 23  spanning-tree vlan 3 port-priority 10 将端口权值10赋与VLAN 3.
Step 24  spanning-tree vlan 4 port-priority 10 将端口权值10赋与VLAN 4.
Step 25  spanning-tree vlan 5 port-priority 10 将端口权值10赋与VLAN 5.
Step 26  spanning-tree vlan 6 port-priority 10 将端口权值10赋与VLAN 10.
Step 27  end 退出
Step 28  show running-config 验证配置
Step 29  copy running-config startup-config 保存配置

配置STP路径值的负载均衡
也可以通过配置配置STP路径值来实现负载均衡,如下图所示
Trunk1走VLAN8-10,Trunk2走VLAN2-4



命令  目的
Step 1  configure terminal 进入 Switch 1配置状态
Step 2  interface fastethernet 0/1 进入F0/1
Step 3  switchport trunk encapsulation {isl | dot1q | negotiate} 配置封装
Step 4  switchport mode trunk 配置Trunk,缺省是ISL封装
Step 5  exit 退回
Step 6  在F0/2口上重复2-4步骤
Step 7  end 退出
Step 8  show running-config 验证配置
Step 9  show vlan 验证switch1已经学到Vlan
Step 10  configure terminal 进入配置状态
Step 11  interface fastethernet 0/1 进入F0/1
Step 12  spanning-tree vlan 2 cost 30 设置Vlan2生成树路径值为30
Step 13  spanning-tree vlan 3 cost 30 设置Vlan3生成树路径值为30
Step 14  spanning-tree vlan 4 cost 30 设置Vlan4生成树路径值为30
Step 15  end 退出
Step 16  在switch1的F0/2上重复9-11步骤设置VLAN8,9,10生成树路径值为30
Step 17  exit 退出
Step 18  show running-config 验证配置
Step 19  copy running-config startup-config 保存配置

配置EtherChannel
以太通道捆绑几个以太端口为一个独立的逻辑链路。在三代引擎的确4006与其它交换机之间,可提供达1600Mbps(百兆双工以太通道)或16Gbps(千兆以太通道)的带宽。一台4006交换机最多可支持64个以太通道。
你可以捆绑在4006任何模块上最多8个兼容的具有相同速率的端口。
每个以太通道具有一个port-channel端口号。要捆绑一个以太通道时,会产生一个逻辑port-channel端口,逻辑端口下的配置可影响与之捆绑的物理端口,但物理端口下的配置不能影响逻辑端口的配置。
三层以太通道配置
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2  Switch(config)# interface port-channelport_channel_number 产生一个逻辑端口
Step 3  Switch(config-if)# ip address ip_address mask 配置IP地址
Step 4  end 退出
Step 5 Switch# show running-config interfaceport-channel port_channel_number 确认配置
例子:
Switch# configure terminal
Switch(config)# interface port-channel 1
Switch(config-if)# ip address 172.32.52.10 255.255.255.0
Switch(config-if)# end
Switch# show running-config interface port-channel 1
Building configuration...
Current configuration:
!
interface Port-channel1
ip address 172.32.52.10 255.255.255.0
no ip directed-broadcast
end
Switch#
三层物理端口配置
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2  Switch(config)# interface {fastethernet |gigabitethernet} slot/port 进入物理端口配置模式
Step 3  Switch(config-if)# no switchport 改变该端口为三层接口
Step 4  Switch(config-if)# no ip address 确认接口没有配置IP地址
Step 5 Switch(config-if)# channel-group port_channel_numbermode {auto | desirable | on} 将该物理端口加入一个以太通道中,并确定PagP模式
Step 6 end 退出
Step 7 Switch# show running-config interface port-channelport_channel_numberSwitch# show running-config interface {fastethernet| gigabitethernet} slot/portSwitch# show interfaces {fastethernet |gigabitethernet} slot/port etherchannelSwitch# show etherchannel 1 port-channel 确认配置
例子:
Switch# configure terminal
Switch(config)# interface range fastethernet 5/4 - 5 (Note: Space is mandatory.)
Switch(config-if)# no switchport
Switch(config-if)# no ip address
Switch(config-if)# channel-group 1 mode desirable
Switch(config-if)# end
二层以太通道配置
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2  Switch(config)# interface {fastethernet | gigabitethernet}slot/port 进入物理端口
Step 3  Switch(config-if)# channel-group port_channel_numbermode {auto | desirable | on} 将该物理端口加入一个以太通道中,并确定PagP模式
Step 4  end 退出
Step 5 Switch# show running-config interface {fastethernet |gigabitethernet} slot/portSwitch# show interface {fastethernet | gigabitethernet}slot/port etherchannel 确认配置

例子:
Switch# configure terminal
Switch(config)# interface range fastethernet 5/6 - 7 (注意: 空格是必需的)
Switch(config-if-range)# channel-group 2 mode desirable
Switch(config-if-range)# end
Switch# show running-config interface port-channel 2
Building configuration...
Current configuration:
!
interface Port-channel2
switchport access vlan 10
switchport mode access
end
Switch#
下面两个例子是如何确认Fast Ethernet interface 5/6的配置的:
Switch# show running-config interface fastethernet 5/6
Building configuration...
Current configuration:
!
interface FastEthernet5/6
switchport access vlan 10
switchport mode access
channel-group 2 mode desirable
end
Switch# show interfaces fastethernet 5/6 etherchannel
Port state = EC-Enbld Up In-Bndl Usr-Config
Channel group = 1 Mode = Desirable Gcchange = 0
Port-channel = Po1 GC = 0x00010001
Port indx = 0 Load = 0x55
Flags: S - Device is sending Slow hello. C - Device is in Consistent state.
A - Device is in Auto mode. P - Device learns on physical port.
Timers: H - Hello timer is running. Q - Quit timer is running.
S - Switching timer is running. I - Interface timer is running.
Local information:
Hello Partner PAgP Learning Group
Port Flags State Timers Interval Count Priority Method Ifindex
Fa5/6 SC U6/S7 30s 1 128 Any 56
Partners information:
Partner Partner Partner Partner Group
Port Name Device ID Port Age Flags Cap.
Fa5/6 JAB031301 0050.0f10.230c 2/47 18s SAC 2F
Age of the port in the current state: 00h:10m:57s
下面例子显示如何确认接口配置后的port-channel interface 2 配置的:
Switch# show etherchannel 2 port-channel
Port-channels in the group:
----------------------
Port-channel: Po2
------------
Age of the Port-channel = 00h:23m:33s
Logical slot/port = 10/2 Number of ports in agport = 2
GC = 0x00020001 HotStandBy port = null
Port state = Port-channel Ag-Inuse
Ports in the Port-channel:
Index Load Port
-------------------
1 00 Fa5/6
0 00 Fa5/7
Time since last port bundled: 00h:23m:33s Fa5/6
Switch#

配置以太通道负载均衡
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2  Switch(config)# [no] port-channel load-balance {src-mac | dst-mac | src-dst-mac | src-ip |dst-ip | src-dst-ip | src-port | dst-port |src-dst-port} 配置以太通道负载均衡。使用no的命令使负载均衡变回缺省状态
Step 3  end 退出
Step 4 Switch# show etherchannel load-balance 确认配置

负载均衡关键字表示如下:
&#8226; src-mac―源MAC地址
&#8226; dst-mac―目标MAC地址
&#8226; src-dst-mac―源和目标MAC地址
&#8226; src-ip―源IP地址
&#8226; dst-ip―目标IP地址
&#8226; src-dst-ip―源和目标IP地址 (缺省)
&#8226; src-port―源第四层端口
&#8226; dst-port―目标第四层端口
&#8226; src-dst-port―源和目标第四层端口

例子:
Switch(config)# port-channel load-balance src-dst-ip
Switch(config)# end
Switch(config)#
This example shows how to verify the configuration:
Switch# show etherchannel load-balance
Source XOR Destination IP address
Switch#
配置SPAN
理解SPAN
SPAN通过诸如SwitchProbe设备或其它Remote Monitoring (RMON) probe等的网络分析仪来选择分析网络流量。SPAN从任意VLAN上的一个或多个源端口来镜像流量作为分析。如下图所示:所有从E5(源端口)的流量被镜像到E10。在E10上的一个网络分析仪可以在没有与E5端直接物理互连的情况接受到它的所有网络流量。对于进行SPAN配置,所有的源和目标端口必须在同一个交换机上。SPAN不影响源端口的网络流量的交换;一个由源接口接收或传输的复制会送到目标接口。






SPAN会话
一个SPAN会话是指一个目标端口与一组源端口的联系。你可以使用指定网络流量监控类型的参数来配置SPAN会话。SPAN会话允许你在监视一个或多个接口,或一个或多个VLAN,发送进来流量,出去流量,或进出两种流量到目标端口。你最多可以用独立或重复使用的SPAN源接口组或者VLAN来配置6个独立的SPAN会话(2个进,4个出)。双向SPAN会话指一个进和一个出会话。交换端口和可路由接口都可以作为SPAN的源接口。SPAN会话不会妨碍交换机的正常操作,当它启动时,一个SPAN会话基于不同的事件或活动而活跃或不活跃,一个syslog信息可以显示它的活动情况。show monitor session命令显示一个SPAN会话的操作状态。一个SPAN会话在系统重启后处于不活跃状态,直到目标端口可以进行操作后才会活跃。
目标端口
目标端口(监视端口)送包来进行分析的可交换或可路由端口。一旦一个接口成为活动的目标端口,该端将不会接收进入该端口的包。你不能配置一个SPAN目标端口来接收外来的包。除了SPAN会话需要的包,该接口不会转发任何其它的流量。一个被指定来作为目标端口的接口只 存在于一个SPAN会话中,不能再用于其它会话,而且不能再作为源端口。以太通道逻辑端口不能作为SPAN目标端口。指定一个trunk接口作为目标端口会断掉接口上的trunk通道。
源端口
源端口是指被用来进行监视流量的接口。在一个独立的,基于用户指定应用于源端口的流量类型(进,出或两者的流量)的SPAN会话中可监视一个或多个源端口。一个特定SPAN会话中所有的源端口会被统计分析到同一个目的地去。你可以给任意VLAN配置源端口,你也可配置VLAN作为源端口,这意味着所有在指定VLAN下的接口都是SPAN会话的源端口。Trunk接口也可以配置为源端口,同时也可以混同非trunk源接口使用。然而目标端口是不能进行封装的,因此你不可能在SPAN目标端口看到封装。
流量类型
进入的SPAN (Rx) 复制网络流量是由源端口接收的流量,给目标端口进行分析。出口SPAN (Tx) 复制网络流量是由源端口发送出去的流量。指定“both”配置选项,是指定进入和出去的流量送去目标端口进行分析。
基于VLAN的SPAN
基于VLAN的SPAN分析一个或多个VLAN的网络流量。你可以基于VLAN的SPAN作为进入SPAN,出去SPAN或同时两者均存在。所有属于源VLAN的接口将作为基于VLAN的SPAN会话的源端口。
使用以下向导来配置基于VLAN的SPAN会话:
&#8226; Trunk接口可包括于基于VLAN的SPAN会话的源端口中。
&#8226; 对于具有进出SPAN的基于VLAN SPAN的配置,如果包在同一个VLAN中交换,那它将转发到目标端口。
&#8226; 当清掉一个VLAN后,它会从基于VLAN的SPAN的源列表中清除掉。
&#8226; 不活跃的VLAN不允许进行基于VLAN的SPAN配置。
&#8226; 如果一个VLAN用来进行进入流量监视,那么从其它VLAN进入被监视VLAN来的交换路由流量不会被监视到-它不会被目标端口看到。另外,从一个监视出去流量的VLAN路由到其它LAN的流量也不会被看到。基于VLAN的SPAN仅监视离开和进入该交换的流量,而不是在VLAN之间路由的流量。
SPAN流量
所有网络流量,包括多播和桥协议数据单元(BPDU)包,都可以使用SPAN来进行监视。在一些SPAN配置中,同一个源端口的多个复制都可以发送到SPAN端口。例如,一个双向的SPAN会话配置源a1和a2到目标端口d1,如果一个通过a1进入交换机,到达a2进行交换的包,那么进来和出去的包同时将被发送到目标端口d1,两个包将是相同的包(除非产生三层的重写,那么包可能会不同)。
配置SPAN
指定源
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2 Switch(config)# [no] monitor session{session_number} {source {interfacetype/num} | {vlan vlan_ID}} [, | - | rx | tx| both] 指定SPAN会话号(1到6),源端口(以太或千兆口),或者VLAN,同时指定监视的流量方向。使用no关键字来恢复缺省配置。
Step 3 end 退出
例子:
Switch(config)# monitor session 1 source interface fastethernet 5/1

指定目标
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2 Switch(config)# [no] monitor session{session_number} {destination {interfacetype/num} } 指定SPAN会话号(1到6)和目标端口,或者VLAN,同时指定监视的流量方向。使用no关键字来恢复缺省配置。
Step 3 end 退出
例子:
Switch(config)# monitor session 1 destination interface fastethernet 5/48

监视一个trunk接口上的源VLAN
Command  Purpose
Step 1  configure terminal 进入Switch 1配置状态
Step 2 Switch(config)# [no] monitor session{session_number} {filter vlan {vlan_ID}[, | - ]} 当一个SPAN源是trunk接口时监视指定VLAN,filter过滤关键字限制监视在指定VLAN上的流量,一般用于监视trunk接口。监视是通过在指定VLAN上的所有端口进行的。使用no关键字来恢复缺省配置。
Step 3 end 退出
例子:
Switch(config)# monitor session 2 filter vlan 1 - 5 , 9


B1层 发表时间: 04-02-01 01:48

回复: tuzi [tuzi]   版主   登录
老A辛苦了 送进精华区吧


B2层 发表时间: 04-02-01 10:27

论坛: 系统集成

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号