欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Cisco Catalyst 3560-E 配置说明(顶部)

最编程 2024-05-05 13:27:16
...

1、访问设备的方式

管理从用户与设备交互的特点来分,访问设备的方式可以分为命令行方式和Web方式。

(1) 命令行方式:包括从Console口登录进行访问和通过Telnet登录进行访问;

(2) Web方式:包括通过HTTP进行的普通Web访问。

2、查看CISCO 设备的简单运行状态 

(1)Switch> 开机时自动进入

特权模式 配置系统参数,升级IOS软件,备份配置文件 Switch# 

在非特权模式下键入ENABLE 使用quit返回非特权模式全局模式 CISCO交换机大部分配置都是在这个模式下进行 Switch(config)# 

在特权模式下键入configure terminal 使用quit返回特权模式监控模式

 升级IOS系统软件 Switch: 开机时摁住面板上的MODE键约5秒钟 

(2) 基本设置命令

全局设置 config terminal 设置访问用户及密码 Username username password password 设置特权密码 enable secret password 

设置路由器名 Hostname name 

设置静态路由 ip route destination subnet-mask next-hop 

启动IP路由 ip routing 启动IPX路由 ipx routing 

端口设置 interface type slot/number

 设置IP地址 ip address address subnet-mask 

设置IPX网络 ipx network network 

激活端口 no shutdown 

物理线路设置 line type number 

启动登录进程 login [local|tacacs server] 

设置登录密码 Password password 

显示命令任务 命令 查看版本及引导信息 show version 

查看运行设置 show running-config 

查看开机设置 show startup-config 

显示端口信息 show interface type slot/number

显示路由信息 show ip route

3、Catalyst 3560接口说明

FE 电接口:符合100Base-TX物理层规范 GE电接口:1000Base-TX物理层规范工作速率 FE电 接口可以选择10Mbit/s、 100Mbit/s两种速率 GE电接口可以选择10Mbit/s、100Mbit/s、1000Mbit/s三种速率工作模式 自动协商模式

4、Catalyst 3560接口配置

3560的所有端口缺省的端口都是二层口,如果此端口已经配置成三层端口的话,则需要用switchport来使其成为二层端口

(4.1) 配置端口速率及双工模式

可以配置快速以太口的速率为10/100Mbps及千兆以太口的速率为10/100/1000-Mbps; 但对于SFP端口则不能配置速率及双工模式,有时可以配置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 fastethernet0/3

Switch(config-if)# speed 10 

Switch(config-if)# duplex half

(4.2)配置一组端口

Step 1 configure terminal 进入配置状态

Step 2 interface range {port-range} 

Switch(config)# interface range fastethernet0/1 - 5    进入组配置状态

Switch(config-if-range)# no shutdown      启用端口

Step 3 end 退回

Step 4 show interfaces [interface-id] 验证配置

Step 5 copy running-config startup-config 保存 

(4.3)配置不同类型端口的组:

Switch# configure terminal 

Switch(config)# interface range fastethernet0/1 - 3,

Switch(config)#gigabitethernet0/1 - 2 

Switch(config-if-range)# no shutdown

(4.4)配置三层口 

Catalyst 3560支持三种类型的三层端口:  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

(4.5)监控及维护端口

监控端口和控制器的状态主要命令见下表:

show interfaces [interface-id] 显示所有端口或某一端口的状态和配置. show interfaces interface-id status [err-disabled] 显示一系列端口的状态或错误-关闭的状态 

show interfaces [interface-id] switchport 显示二层端口的状态,可以用来决定此口是否为二层或三层口。

show interfaces [interface-id] description 显示端口描述 show ip interface [interface-id] 显示所有或某一端口的IP可用性状态 

show running-config interface [interface-id] 显示当前配置中的端口配置情况

show version 显示软硬件等情况 

(4.6)刷新、重置端口及计数器 Clear命令

clear counters [interface-id] 清除端口计数器. 

clear interface interface-id 重置某一端口的硬件逻辑 

clear line [number | console 0 | vty number] 重置异步串口的硬件逻辑 

Note clear counters 命令只清除用

show interface所显示的计数,不影响用snmp得到的计数 

举例如下:

Switch# clear counters fastethernet0/5 Clear ``show interface`` counters on this interface [confirm] y Switch# *Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface FastEthernet0/5 by vty1 (171.69.115.10) 

可使用clear interface 或 clear line 命令来清除或重置某一端口或串口,在大部分情况下并不需要这样做: Switch# clear interface fastethernet0/5

关闭和打开端口命令Step 1 configure terminal 

进 入配置状态 Step 2 interface {vlan vlan- id} | {{fastethernet | gigabitethernet} interface-id} | {port- channel port-channel-number} 选择要关闭的端口 

Step 3 Shutdown 关闭 

Step 4 End 退出 

Step 5 show running-config 验证使用 no shutdown 命令重新打开端口.

(4.7)交换机端口镜像配置

『端口镜像的数据流程』基于端口的镜像是把被镜像端口的进出数据报文完全拷贝一份到镜像端口,这样来进行流量观测或者故障定位。

4.7.1通过交换机的第2号口监控第1号口的流量 

Switch(config)# monitor session 1 source interface gigabitethernet0/1 

Switch(config)# monitor session 1 destination interface gigabitethernet0/2 

Switch(config)# end 

删除一个span会话: Switch(config)# no monitor session 1 source interface gigabitethernet0/1 S

witch(config)# end

4.7.2以 太通道端口组(Ethernet Port Groups)以太通道端口组提供把多个交换机端口像一个交换端口对待。这些端口组为交换机之间或交换机和服 务器之间提供一条单独的高带宽连接的逻辑端口。以太通道在一个通道中提供穿越链路的负载平衡。如果以太通道中的一个链路失效,流量会自动从失效链路转移到 被用链路。你可以把多干道端口加到一个逻辑的干道端口;把多访问端口加到一个逻辑访问端口;或者多隧道端口加到一个逻辑的隧道接口。绝大多数的协议能够在 单独或是集合的接口上运行,并且不会意识到在端口组中的物理端口。除了DTP、CDP和PAgP,这些协议只能在物理接口上运行。当你配置一个以太通道, 你创建一个端口通道逻辑接口,并且指派一个接口给以太通道。对于三层接口,你人工创建该逻辑接口: Figure

案例:把交换机A,B的1,2号口添加到同一个组5里面 

SwitchA# configure terminal SwitchA (config)# interface range gigabitethernet0/1 -2 

SwitchA (config-if-range)# switchport mode access 

SwitchA (config-if-range)# switchport access vlan 10 

SwitchA (config-if-range)# channel-group 5 mode ON 

Switch(config-if-range)# end SwitchB# configure terminal 

SwitchB(config)# interface range gigabitethernet0/1 -2 

SwitchB(config-if-range)# switchport mode access 

SwitchB(config-if-range)# switchport access vlan 10 

SwitchB(config-if-range)# channel-group 5 mode ON 

SwitchB(config-if-range)# end

5、交换机的启动及基本配置案例:
3560交换机上配置:
sw3560#erase nvram-------------------------全部清除交换机的所有配置
sw3560#reload--------------------------重新启动交换机(初始提示符为 )
sw3560(config)#hostname sw3560-------------------设置交换机的主机名sw3560(config)#enable secret cisco---------------------设置加密密码
sw3560(config)#enable password level 1 cisco1---设置等级密码(1最低)
sw3560(config)#enable password level 15 cisco15设置等级密码(15最高)
sw3560(config)#ip address 192.168.1.1 255.255.255.0--------设置交换机的管理IP地址
sw3560(config)#ip default-gateway 192.168.1.254----------设置交换机的网关地址
sw3560(config)#ip domain-name antaitel.com----设置交换机所连域的域名
sw3560(config)#ip name-server 218.30.19.40--------------设置交换机所连域的域名服务器IP
sw3560#show ip-------------------------------------查看上述设置环境
sw3560#show version--------------------------查看交换机的版本等信息
sw3560#show running-config-------查看交换机的当前运行配置等全部信息
sw3560#show int e0/1---------------------查看交换机的第1个端口信息

 

6、交换机的端口和MAC地址表的设置

3560交换机配置端口属性:
sw3560#conf t--------------------------------------进入全局配置模式
sw3560(config)#interface fastethernet 0/1-------------进入第1个端口
sw3560(config-if)#description sw3560_a-f0/1-pc1--给端口写入注释信息
sw3560(config-if)#duplex auto/full/half----------设置端口的工作模式
sw3560(config-if)#port security----------------------启用端口安全性
sw3560(config-if)#port security max-mac-count 1-------设置该端口允许对应的MAC地址数(默认132个)
sw3560(config-if)#end----------------------------------返回特权模式
sw3560#sh port security-------------------------------查看端口安全性

7、配置VLAN

7.1  vlan简介 

VLAN(Virtual Local Area Network), 是一种通过将局域网内的设备逻辑地而不是物理地划分成一个个网段从而实现虚拟工作组的技术。IEEE于1999年颁布了用以标准化VLAN实现方案的 IEEE 802.1Q协议标准草案。 VLAN技术允许网络管理者将一个物理的LAN逻辑地划分成不同的广播域(或称虚拟LAN,即VLAN),每一个 VLAN都包含一组有着相同需求的计算机,由于VLAN是逻辑地而不是物理地划分,所以同一个VLAN内的各个计算机无须被放置在同一个物理空间里,即这 些计算机不一定属于同一个物理LAN网段。 VLAN的优势在于VLAN内部的广播和单播流量不会被转发到其它VLAN中,从而有助于控制网络流量、减少 设备投资、简化网络管理、提高网络安全性。

7.2 VLAN的的特性

可 支持的VLAN Catalyst 3560交换机支持1005个 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二种封装。 

7.3 VLAN配置

 配置正常范围的VLAN VLAN号1, 1002到1005是自动生成的不能被去掉。 VLAN号1到1005的配置被写到文件vlan.dat 中, 可以用show vlan 命令查看, vlan.dat 文件存放在NVRAM中.

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 

案例二:也可以在VLAN状态下,进行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# 

7.4 VLAN的删除

删 除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 来删除。 

7.5 将端口分配给一个VLAN 

Step 1 configure terminal 进入配置状态 

Step 2 interface interface-id 进入要分配的端口 

Step 3 switchport mode access 定义二层口 

Step 4 switchport access vlan vlan-id 把端口分配给某一VLAN 

Step 5 end 退出 

Step 6 show running-config interface interface-id 验证端口的VLAN号 

Step 7 show interfaces interface-id switchport 验证端口的管理模式和VLAN情况 

Step 8 copy running-config startup-config 保存配置 

使用 default interface interface-id 还原到缺省配置状态。

案例: Switch# configure terminal   Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface fastethernet0/1 

Switch(config-if)# switchport mode access 

Switch(config-if)# switchport access vlan 2

Switch(config-if)# end

Switch# 

7.6 配置VLAN 

以 太网端口有二种链路类型:Access和Trunk。Access类型的端口只能属于1个VLAN,一般用于连接计算机的端口;Trunk类型的端口可以 属于多个VLAN,可以接收和发送多个VLAN的报文,一般用于交换机之间连接的端口;这里的trunk并不是端口干路的概念,即端口汇聚或者链路聚合, 而是允许vlan透传的一个概念。

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 fastethernet0 /4 

Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk encapsulation dot1q Switch(config-if)# end 

缺省情况下trunk允许所有的VLAN通过。可以使用 switchport trunk allowed vlan remove vlan-list 来去掉某一VLAN 

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 fastethernet0/1 

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

Switch(config-if)# end 

7.7 配置VTP DOMAIN VTP DOMAIN 称为管理域。

交换VTP更新信息的所有交换机必须配置为相同的管理域。如果所有的交换机都以中继线相连,那么只要在核心交换机上设置一个管理域,网络上所有的交换机都加入该域,这样管理域里所有的交换机就能够了解彼此的VLAN列表。

 switch#vlan database 进入VLAN配置模式 

switch (vlan)#vtp domain COM 设置VTP管理域名称 COM 

switch (vlan)#vtp server 设置交换机为服务器模式 

switch #vlan database 进入VLAN配置模式 

switch (vlan)#vtp domain COM 设置VTP管理域名称COM 

switch (vlan)#vtp Client 设置交换机为客户端模式 

switch #vlan database 进入VLAN配置模式 

switch (vlan)#vtp domain COM 设置VTP管理域名称COM 

switch (vlan)#vtp Client 设置交换机为客户端模式 

switch #vlan database 进入VLAN配置模式 

switch (vlan)#vtp domain COM 设置VTP管理域名称COM 

switch (vlan)#vtp Client 设 置交换机为客户端模式 注意:这里设置核心交换机为Server模式是指允许在该交换机上创建、修改、删除VLAN及其他一些对整个VTP