其它文章
Configuring IPSec Between Two Routers and a Cisco VPN Cl
Configuring NAT
四个系列低端路由器简单配置方法
交换技术之十一-Configuring the Full Duplex Method
交换技术之八-Advanced Configurations of the Catalyst 500
如何配置Cisco PIX防火墙(重新编辑)
网络流量监控器mrtg全攻略
Configuring VLANs
路由器备份配置
交换机配置全接触(1)
Cisco技术 / Cisco技术 / Cisco典型配置 / 交换技术之七-Configuring the Catalyst 5000 Series Switch

交换技术之七-Configuring the Catalyst 5000 Series Switch

作者:红头发(原作者)、net130整理  &     http://cisco.ccxx.net

Written by yUmis(牛奶咖喱) a.k.a. 红头发 
Deion 欢迎转载,请保留作者信息 
Contact Me http://www.Asuqa.com
QQ:13030130 特别感谢yUmi,是她让我懂得了应该如何生活:) 
Jul.1st.2004 
!

对Catalyst 5000系列的交换机进行配置可以有2种方式,可以通过购买一个叫做CWSI(Cisco Works fortched Internetworks)的产品或者通过CLI进行配置.CLI可以通过交换机的console port用类似HyperTerminal的终端程序进行访问,把线缆的一端连接到PC的com口,另一端连接到交换机的console port即可 net130整理

Introduction to the Catalyst Operating System

Catalyst 5000系列使用的操作系统并不是IOS,而是CatOS(Catalyst Operating System).当交换机电源启动以后,会运行正常的bootstrap程序并且进行POST测试.下面的输出摘自使用supervisor engine II的Catalyst 5000:
ATE0
ATS0 = 1
Catalyst 5000 Power Up Diagnostics
Init NVRAM Log
LED Test
ROM CHKSUM
DUAL PORT RAM r/w
RAM r/w
RAM address test
Byte/Word Enable test
RAM r/w 55aa
RAM r/w aa55
EARL test
BOOTROM Version 2.1, Dated Apr 6 1998 16:49:40
BOOT date: 00/00/00 BOOT time: 06:10:23
SIMM RAM address test
SIMM Ram r/w 55aa
SIMM Ram r/w aa55
Start to Uncompress Image . . .
IP address for Catalyst not configured
BOOTP will commence after the ports are online
Ports are coming online . . .
Cisco Systems Console
Enter password:
Mon Apr 14 1999 13:22:11 Module 1 is online
Mon Apr 14 1999 13:22:11 Module 2 is online
Mon Apr 14 1999 13:22:11 Module 3 is online
Mon Apr 14 1999 13:22:11 Module 4 is online
如果是交换机的第一次启动,或者假如交换机的配置文件被擦除了,交换机将发出BOOTP请求,RARP将解析它的IP地址,如下:
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Sending RARP request with address 00:40:02:24:25:ff
Sending bootp request with address: 00:40:02:24:25:ff
Catalyst 5000系列的CLI有点类似Cisco路由器的CLI.同样,CatOS也有在线帮助,使用问号或者help命令查看当前可用命令和介绍,语法等信息,如下:
console> (enable) ?
Commands:
–––––––––––––––––––––––––––––––––––––––
cd              Setdefault flash device
clear            Clear, use 'clear help' for more info
configure        Configure system from network
copy            Copy files between TFTP/module/flash devices
delete           Delete a file on flash device
dir              Show list of files on flash device
disable          Disable privileged mode
disconnect       Disconnect user session
download        Download code to a processor
enable           Enable privileged mode
format           Format a flash device
help            Show this message
history          Show contents of history substitution buffer
ping            Send echo packets to hosts
pwd             Show default flash device
quit             Exit from the Admin session
reconfirm        Reconfirm VMPS
reload           Force software reload to linecard
reset             Reset system or module
session           Tunnel to ATM or Router module
set               Set, use 'set help' for more info
-More-
-More-表示还有更多的输出,可以按回车键一次显示一行,也可以按其他键1次显示1页,或者按下q键退出查看输出
当你输出一个不正确的命令的时候,将收到提示信息,如下:  net130整理
Cat5000> (enable) hlp
Unknown command "hlp". Use 'help' for more info.
Cat5000> (enable)
一些快捷键如下:
Ctrl-A:跳转到命令行的第一个字母
Ctrl-B或左方向键:把光标向左移动1个字母
Ctrl-C:退出
Ctrl-D:删除光标处的文字
Ctrl-E:跳转到命令行末端
Ctrl-F或右方向键:把光标向右移动1个字母
Ctrl-K:删除光标到该行末尾的内容
Ctrl-L;Ctrl-R:另起1行,重复当前命令
Ctrl-N或下方向键:输入历史缓存里的下一条命令
Ctrl-P或上方向键:输入历史缓存里的上一条命令
Ctrl-U;Ctrl-X:删除光标到该行开头的内容
Ctrl-W:删除最后输入的一个单词
Esc-B:把光标向后移动一个单词
Esc-F:把光标向前移动一个单词
设置终端命令为24行,如下:
Cat5000> (enable) set length 24
Screen length for this session set to 24.
Cat5000> (enable)

#p#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的帧的命令如下:   net130整理
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)

#p#Controlling Broadcasts   net130整理

可以在交换机的端口进行广播的控制.广播的控制可能因模块的不同而不同.有的模块不能限制单独的某个端口的广播,必须限制全部端口;有的就可以限制单独某个端口.限制广播的命令(百分比),如下:
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
(略)

#p#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参数
例子,把多播映射到某些端口上,如下:   net130整理
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).如下图:

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间通信,只需按如下配置即可:   net130整理
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两次。

#p#VTP Modes

VTP的3种模式:
1.服务器模式(server mode):该模式下,可以创建,修改和删除VLAN信息,并且向外发送和转发VTP信息,对VLAN配置信息进行同步,保存配置信息到NVRAM中

2.客户模式(client mode):该模式下,不能够创建,修改和删除VLAN信息,不向外发送VTP信息,但是可以转发VTP信息,同步VLAN配置信息,不把配置信息保存在NVRAM中

3.透明模式(transparent mode):只可以本地的创建,修改和删除VLAN信息,不向外发送VTP信息,但是可以转发VTP信息,不对VLAN配置信息进行同步,把配置信息保存在NVRAM中 net130整理

VTP Pruning

VTP pruning技术:用来节约带宽,减少不必要的流量.如下图:


可以看出,Switch 3不属于Red VLAN,VTP信息不会经过Switch 2到达Switch 3上去  net130整理
要注意的是,VTP pruning只能工作在VTP server mode

#p#Management Domains

管理域(或VTP domain)是一组在处于相同管理之下的交换机的集合,在VTP domain里,VTP在trunk line上发送VTP更新(update).处于同一个VTP domain里的交换机才能交换VTP更新.所以在同一个VTP domain里的交换机的VTP域名要设置成一样的
VTP域名是大小写敏感的,使用set domain name命令进行设置,如下:
console> (enable) set vtp domain [name]
例子如下图:

Switch_A> (enable) set vtp domain ACC
VTP domain ACC modified
Switch_A> (enable)
在A上设置VTP域名为ACC,在B上无须设置,因为B是通过trunk line直连到A,会自动加到AAC的管理范围(但是这个方法不推荐,推荐在B上进行手动设置VTP域名)
设置VTP的工作模式,使用set vtp mode命令,默认是server模式.如下:
Switch_A> (enable) set vtp mode [mode]
例子:
Switch_A> (enable) set vtp mode client
VTP domain ACC modified
Switch_A> (enable) set vlan 30
Cannot add/modify VLANs on a VTP client.
Switch_A> (enable)
由于把VLAN 30设置为了client模式,添加新的VLAN将收到错误提示  net130整理

Configuring Secure Management Domains

如果你不想把直连的新的交换机自动加到某个VTP域的管理范围内,就可以设置VTP域的密码(password).把VTP域设置一个密码,上述情况就不会发生,设置密码的时候要注意,所有在同一个VTP域里的交换机上的密码要设置成一样的.设置命令,只需要在set vtp domain [name]后加上passwd [password]就可以了,刚才的例子,如下:
Switch_A> (enable) set vtp domain ACC passwd TobaccoRoad
Generating MD5 secret for the password ....
VTP domain ACC modified
Switch_A> (enable)
Switch_B> (enable) set vtp domain ACC passwd TobaccoRoad
Generating MD5 secret for the password ....
VTP domain ACC modified
Switch_B> (enable)

Configuring VTP Version 2

默认Catalyst上是没有启用版本2的.在启用之前要先看下你的交换机是否全部支持VTP版本2.设置VTP版本2,使用set vtp v2 enable命令,如下:
Switch_A> (enable) set vtp v2 enable
This command will enable the version 2 function in the entire management domain.
All devices in the management domain should be version2-capable before enabling.
Do you want to continue (y/n) [n]? y
VTP domain ACC modified
Switch_A> (enable)

Configuring VTP Pruning

VTP pruning默认是没有启用的,如果在一个VTP域里启用了VTP pruning,整个VTP域里的交换机都自动进行VTP pruning,即无须在第二台交换机上进行设置VTP pruning.命令如下:  net130整理
console> (enable) set vtp pruning enable
例子:
Switch_A> (enable) set vtp pruning enable
This command will enable the pruning function in the entire
management domain.
All devices in the management domain should be pruning-capable before enabling.
Do you want to continue (y/n) [n]? y
VTP domain ACC modified
Switch_A> (enable)
要注意的是VTP版本1不支持VTP pruning

#p#Verifying the VTP Settings

要查看VTP信息统计,可以使用show vtp domain或show vtp statistics命令

Configuring VLANs

创建VLAN的命令如下:
Switch_A> (enable) set vlan [vlan_number] name [VLAN_name]
可以使用show vlan验证VLAN的设置.一旦在一个交换机上创建了VLAN以后,这个VLAN信息将通过VTP被宣告给整个VTP域
接下来把端口分配给VLAN,如下:
Switch_A> (enable) set vlan [vlan_num] [module/ports]
如果端口连续,可以使用连字号(hyphen)或逗号如下:
Switch_A> (enable) set vlan 10 3/1-12
VLAN 10 modified.
VLAN 1 modified.
VLAN Mod/Ports
–––– ––––––––––
10 3/1-12
Switch_A> (enable) set vlan 20 3/13-23,24
VLAN 20 modified.
VLAN 1 modified.
VLAN Mod/Ports
–––  ––––––––––
20 3/13-24
Switch_A> (enable)

Configuring Dynamic VLANs

可以通过采用VMPS(VLAN membership policy server),根据每个端口所连的计算机,随时改变端口所属的VLAN,最常见的就是基于MAC地址的划分.VMPS实际上也是Catalyst交换机,只不过是从TFTP服务器上下载了一个VLAN到MAC地址映射的文本文件
当交换机收到一个帧以后,交换机检查VMPS(有可能是它自己)的数据库,并比较帧的源MAC地址,如果数据库里有相应条目,收到这个帧的端口就把它转发到指定的VLAN上去;如果数据库中没有相应条目,那么端口有可能:
1.如果VMPS没有处于安全模式(secure mode),就返回access-denied信息
2.如果VMPS处于安全模式,端口将shut down
3.将把帧分配给特定的fallback VLAN
基于MAC地址动态划分VLAN的第一步是要搜集MAC地址,再来做MAC地址到VLAN的映射,然后保存为文本文件(数据库),存放到TFTP服务器上.一般VMPS数据库格式如下:
!VMPS Database for ACC
!
!
vmps domain ACC                                指定VTP域名
vmps mode open                                  指定VMPS模式
vmps fallback  -NONE-                           定义fallback VLAN
!
!MAC Addresses
!
vmps-mac-addrs
!
!address vlan-name
!
address 0001.1111.1111 vlan-name hardware           定义MAC地址到LAN的映射
address 0001.2222.2222 vlan-name hardware
address 0001.3333.3333 vlan-name Green
VMPS数据库完成以后,接下来就把Catalyst配置为VMPS服务器,命令如下:
Switch_A> (enable) set vmps tftpserver [ip_address] [filename_VMPS_Database]
这个命令告诉交换机从哪下载数据库文件,并且在交换机启动以后加载到RAM中,交换机每次启动的时候,都会重新从TFTP服务器加载一次数据库文件,所以,要时时刻刻保持TFTP服务器可以访问.数据库的文件名可以任意设置,如果不设置,默认名为vmps-config-database.1
第三步要做的是,使用命令激活VMPS,如下:  net130整理
Switch_A> (enable) set vmps state enable
设置端口为动态分配,如下:
Switch_A> (enable) set port membership [mod_num/port_num] dynamic
最后,配置其他交换机为VMPS的客户机,如下:
Switch_A> (enable) set vmps server [ip_address_of_VMPS] [primary]
可以使用show vmps mac显示整个VMPS数据库的信息,如下:
Switch_A> (enable) show vmps mac
MAC Address     VLAN Name  Last Requestor    Port ID  Last Accessed  Last Response
––––––
12-23-56-78-9a-bc  DUKE       0.0.0.0                   0,00:00:00      Success
aa-bb-cc-dd-ee-ff    FSU        0.0.0.0                   0,00:00:00      Success
fe-dc-ba-98-76-54    -NONE-    0.0.0.0                   0,00:00:00      Success

#p#

Configuring Trunking

在配置trunk之前,要看下端口是否具备trunk的能力,使用show port capabilities命令查看,如下:
Switch_A> (enable) show port capabilities 1/1
Model                  WS-X5530
Port                    1/1
Type                   1000BaseSX
Speed                  1000
Duplex                 full
Trunk encap type         802.1Q,ISL
Trunk mode              on,off,desirable,auto,nonegotiate
Channel                 no
Broadcast suppression     percentage(0-100)
Flow control             receive-(off,on,desired),send-(off,on,desired)
Security                 no
Membership             static
Fast start                yes
Rewrite                  no
5种trunk模式如下:
1.on:启用trunk
2.off:不启用trunk
3.disirable:只要对方能够trunk,它就trunk
4.aut默认的模式,不关心是否能够trunk
5.nonnnegotiate:进行trunk但是不会和对方进行协商   net130整理
设置trunk port的命令如下:
Switch_A> (enable) set trunk [module_number/port_number] [on|off|desirable|auto|nonegotiate] [trunk_encapsulation_method]
例子:
Switch_A> (enable) set trunk 1/1 on isl
Port(s) 1/1 trunk mode set to on.
Port(s) 1/1 trunk type set to isl.
Switch_A> (enable)
2004 Jul 12 20:31:18 %DTP-5-TRUNKPORTON:Port 1/1 has become isl
trunk
Switch_A> (enable)
使用show trunk命令进行验证trunk信息

#p#

Catalyst Modes

当交换机初次启动,或者配置文件被擦除以后,交换机会出现登陆密码提示,如下:
Cisco Systems Console

Enter password:
默认口令为回车键,输入后进到用户模式,提示符为console>,输入enable命令进如特权模式,提示符变为console>(enable).在特权模式下,可以通过set等命令对交换机的配置进行修改.set命令相当于IOS里的配置模式

the Banner

当登陆到交换机的时候,会有banner信息提示,最常用的banner信息就是MOTD(message of the day),命令如下:
Cat5000> (enable) set banner motd [beginning delimiter]
motd banner
[end delimiter]
delimiter前后必须一样

Automatic Session Logout

交换机有个令人烦恼的功能,自动注销功能:当你在一定时间内无任何动作,即所谓的空闲(idle),用户将自动注销登陆,默认这个空闲时间为5分钟,修改这一默认时间的命令为set logout [min],例子如下:
Cat5000> (enable) set logout 20
Sessions will be automatically logged out after 20 minutes of idle time.
Cat5000> (enable)

Supervisor Engine's Console Baud Rate

默认的波特率(baud rate)为9600,可以通过如下命令进行修改:
Cat5000> (enable) set system baud [baud rate]
可选baud rate为600,1200,2400,4800,9600,19200和38400

Terminal Message Logging

当有一点令人觉得讨厌的是,当你在console工作的时候,终端信息将时不时的显示出来,打断你的命令输入(即,输入到一半,命令被终端信息给分离打断了).可以使用set logging命令用来配置该信息的格式和位置,默认是发送终端信息到console,如下:
Cat5000> (enable) set logging console enable
System logging messages will be sent to the console.
Cat5000> (enable)
再次输入set logging console enable的时候,终端信息将发送到当前终端会话,如下:
Cat5000> (enable) set logging console enable
System logging messages will be sent to the current login session.
Cat5000> (enable)
把logging文件存放在TFTP服务器上,并且服务器的IP地址为172.16.1.10,如下:
Cat5000> (enable) set logging server enable
System logging messages will be sent to the configured syslog
servers.
Cat5000> (enable) set logging server 172.16.1.10
172.16.1.10 added to System logging server table.
Cat5000> (enable)
参观当前logging设置,如下:
Cat5000> (enable) show logging
Logging console: enabled
Logging server: enabled
{172.16.1.10}
Current Logging Session: enabled

Setting Passwords

设置初始的用户模式的密码,使用set password命令,然后将提示输入旧密码,接着输入2次新密码,如下:
Cat5000> (enable) set password
Enter old password: [old user mode password]
Enter new password: [new user mode password]
Retype new password: [new user mode password]
Password changed.
Cat5000> (enable)
设置特权模式的密码,使用set enablepass命令,如下:
Cat5000> (enable) set enablepass
Enter old password: [old enable password]
Enter new password: [new enable password]
Retype new password: [new enable password]
Password changed.
Cat5000> (enable)
给交换机设置主机名,使用set system name命令,如下:
console> (enable) set system name yUmi520
System name set.
yUmi520> (enable)

the Interface sc0

set interface sc0命令设置sc0接口的VLAN信息,IP地址,子网掩码和广播地址,如下:  net130整理
console> (enable) set interface sc0 [VLAN] [ip_address [subnet-mask] [broadcast]]
子网掩码可以选,如果不设置的话就采用默认的掩码,比如:
console> (enable) set interface sc0 172.16.100.5
默认sc0接口的VLAN是VLAN 1,并且默认的IP地址,子网掩码和广播地址都为0.0.0.0.当IP地址设置为0.0.0.0以后,交换机将自动启用BOOTP和RARP来获取IP地址.使用show module命令查看sc0接口的MAC地址,如下:

注意上面输出中的斜线部分那行的MAC地址范围是supervisor engine(slot1)的MAC地址范围,将用于sc0的BOOTP和ARP请求
配置sc0接口的路由使用set ip route命令,如下:
Cat5000> (enable) set ip route [destination-network] [gateway-address]
例子,创建到网络172.16.2.0的路由,并指定172.16.1.1作为网关.如下图:

Console> (enable) set ip route 172.16.2.0 172.16.1.1
Route added.
但是这个命令有个问题是,它只指定了到达网络172.16.2.0的路由,假如该网络包含其他内网或Internet的话,手动一个个的指定是比较麻烦的.于是,多数情况下,为了方便,都会使用如下命令:
Cat5000> (enable) set ip route default [default-gateway-address] [primary]
其中可选参数primary为当存在多个网关的时候,指定其中1个为主网关.如果指定了多个网关,但是没有使用primary参数的话,最后输入的那个网关作为主网关.当主网关出问题以后,交换机会自动查找备用网关.最多可以配置3个默认网关,除了Catalyst 4000和Catalyst 2926G只能配置1个.例子如下图:  net130整理

Cat5000> (enable) set ip route default 172.16.1.1 primary
Route added.
Cat5000> (enable) set ip route default 172.16.1.2
Route added.
验证配置的路由信息使用show ip route命令,如下:
Cat5000> (enable) show ip route
Fragmentation    Redirect     Unreachable
––––––   ––––     ––––
enabled         enabled        enabled
The primary gateway: 172.16.1.1
Destination      Gateway        Flags       Use      Interface
––––––   ––––      ––––   –––     ––––
default         172.16.1.1        G          0          sc0
default         172.16.1.2        G          0          sc0
172.16.1.0      172.16.1.5         U         0          sc0
default          default          U H        0          sl0
Cat5000> (enable)
如果你要从sc0的路由表中清除一条路由或网关的话,使用如下命令:
Cat5000> (enable) clear ip route default 172.16.1.2
Route deleted.
Cat5000> (enable) show ip route
Fragmentation    Redirect     Unreachable
––––––   ––––     ––––
enabled         enabled        enabled
The primary gateway: 172.16.1.1
Destination      Gateway        Flags       Use      Interface
––––––   ––––      ––––   –––     ––––
default         172.16.1.1        G          0          sc0
default         172.16.1.2        G          0          sc0
default          default          U H        0          sl0

#p#

IP Permit Lists

IP permit list是包含了允许访问sc0口的IP地址,这样增加了安全性,默认这一特性是关闭的,设置IP permit list的步骤如下:
1.启用或关闭IP permit list:
Cat5000> (enable) set ip permit [enable | disable]
2.设置允许访问sc0的IP地址:
Cat5000> (enable) set ip permit [ip_address subnet-mask]
3.验证IP permit list:
Cat5000> (enable) show ip permit
例子,允许节点172.16.3.10和网络172.16.2.0内的所有节点访问sc0,如下图:

Cat5000> (enable) set ip permit enable
IP permit list enabled.
WARNING!! IP permit list has no entries.
Cat5000> (enable) set ip permit 172.16.3.10
172.16.3.10 added to IP permit list.
Cat5000> (enable) set ip permit 172.16.2.0 255.255.255.0
172.16.2.0 with mask 255.255.255.0 added to IP permit list.
Cat5000> (enable)
接下来验证IP permit list,如下:
Cat5000> show ip permit
IP permit list feature enabled.
Permit List          Mask
––––––    –––––
172.16.3.10
172.16.2.0        255.255.255.0
Denied IP Address   Last Accessed Time         Type
––––––    –––––––––      –––––
172.16.3.1          03/20/99,12:45:20          Telnet
Cat5000>
要清除IP permit list中的某条条目或者所有条目,使用如下命令:
Cat5000> (enable) clear ip permit [ip_address or all] [subnet-mask(if necessary)]
例子:
Cat5000> (enable) clear ip permit all
IP permit list cleared.
WARNING!! IP permit list is still enabled.
Cat5000> (enable)

DNS and an IP Host Table

配置交换机使用DNS服务器,使用set ip dns命令,首先要启用DNS,如下:
Cat5000> (enable) set ip dns enable
DNS is enabled.
Cat5000> (enable)
默认是disable的,接下来设置DNS服务器的IP地址,如下:
Cat5000> (enable) set ip dns server 172.16.1.6
198.92.30.32 added to DNS server table as primary server.
Cat5000> (enable) set ip dns server 172.16.1.7
171.69.2.132 added to DNS server table as primary server.
Cat5000> (enable) set ip dns server 172.16.1.8 primary
171.69.2.143 added to DNS server table as primary server.
DNS服务器表里的条目最多可以有3条,参数primary指定该地址为主要的DNS服务器地址
可以使用show ip dns查看当前DNS设置,如下:
Cat5000> show ip dns
DNS is currently enabled.
The default DNS domain name is: ar-inc.com
DNS name server        status
–––––––       –––
172.16.1.6
172.16.1.7             primary
172.16.1.8
Cat5000>
还可以设置主机表,使用set ip alias命令,如下:
Cat5000> (enable) set ip alias [name] [ip_address]
该命令添加一条条目到主机表中
验证主机表使用show ip alias [name]命令.例子如下:
Cat5000> (enable) set ip alias Cat-1 172.16.1.1.
IP alias added.
Cat5000> (enable) set ip alias Cat-2 172.16.1.2
IP alias added.
Cat5000> (enable) set ip alias Cat-3 172.16.1.3
IP alias added.
Cat5000> (enable) set ip alias Cat-4 172.16.1.4
IP alias added.
Cat5000> (enable) show ip alias
default       0.0.0.0
cat-1        172.16.1.1
cat-2        172.16.1.2
cat-3        172.16.1.3
cat-4        172.16.1.4
Cat5000> (enable)
上面输出里的default 0.0.0.0通常代表默认路由

the Interface sl0

为了能够远程拨号访问交换机,sl0接口允许在sonsole口上建立SLIP(Serial Line Internet Protocol)连接.使用set interface sl0来配置sl0口运行SLIP,如下:
Cat5000> (enable) set interface sl0 [slip_address] [destination_address]
如果要使得console口接受SLIP呼叫的话,还要使用slip attach命令.例子如下:
Cat5000> (enable) set interface sl0 172.16.1.1 172.16.1.2
Interface sl0 slip and destination address set.
Cat5000> (enable) slip attach
Console Port now running SLIP.
可以使用show interface命令,查看sl0和sc0口的汇总信息,如下:
sl0: flags = 51
slip 172.16.1.1 dest 172.16.1.2
sc0: flags = 63
vlan 1 inet 172.16.100.1 netmask 255.255.255.0 broadcast
172.16.100.255
Cat5000> (enable)

the Reset Command

如果要重启交换机,使用reset system命令,当然也可以简写为reset.当然也可以单独的重启某个模.比如重启slot3上的line card,如下:
Cat5000> (enable) reset 3
This command will reset module 3 and may disconnect your telnet session.

Do you want to continue (y/n) [n]? y
Resetting module 3 . . .
Cat5000> (enable) 04/06/1999,18:53:35:SYS-5:Module 3 reset from telnet/172.16.1.5/
Cat5000> (enable) 04/06/1999,18:53:57:SYS-5:Module 3 is online

the Configuration File

Catalyst 5000不像路由器,配置文件不存在running-config和startup-config之分,当RAM中的配置文件变动以后,自动同步到NVRAM中去.配置文件是以文本文件的形式保存的,可以使用show config命令查看配置文件  net130整理

Backing Up and Restoring a Configuration File

对于supervisor engine I和II,把配置文件备份到TFTP服务器上,使用write network命令,如下:
Cat5000> (enable) write network
IP address or name of remote host? 172.16.1.10
Name of configuration file?tch.txt
Upload configuration to config-file-name on address (y/n) [n]? y
. . . . .
. . . . . . . . . .
. . . . . . . . . .
. .
/
Finished network upload. (124356 bytes)
Cat5000> (enable)
对于supervisor engine III或者Catalyst 4000,使用copy config tftp命令,如下:
Cat5000> (enable) copy config tftp
IP address or name of remote host? 172.16.1.10
Name of configuration file?tch.txt
Upload configuration to config-file-name on address (y/n) [n]? y
. . . . .
. . . . . . . . . .
. . . . . . . . . .
. .
/
Finished network upload. (124356 bytes)
Cat5000> (enable)
要从TFTP服务器上恢复备份配置文件的话,对于supervisor engine I和II,使用configure network命令,如下:
Cat5000> (enable) configure network
IP address or name of remote host []? 172.16.1.10
Name of file to copy from []?tch.txt
Configure using tftptch.txt (y/n) [n]? y
/
Finished network download. (124356 bytes)
对于supervisor engine III或Catalyst 4000,使用copy tftp config命令,如下:
Cat5000> (enable) copy tftp config
IP address or name of remote host []? 172.16.1.10
Name of file to copy from []?tch.txt
Configure using tftptch.txt (y/n) [n]? y
/
Finished network download. (124356 bytes)
要注意的是这些是supervisor engine的配置文件而不是RSM或ATM LANE card的配置文件.这些模块运行的是IOS并且有着自己的配置文件

#p#

Managing the Catalyst IOS Files

对CatOS的版本进行升级,推荐根据以下几个步骤进行升级:
1.先决定你要进行升级的版本号
2.建立一个TFTP服务器,把新的CatOS放在特定目录
3.备份当前旧的CatOS.可以使用show version命令查看版本号.如下:
Cat5000> (enable) sh ver
WS-C5000 Software, Version McpSW: 4.3(1a) NmpSW: 4.3(1a)
Copyright (c) 1995-1998 by Cisco Systems
NMP S/W compiled on Nov 23 1998, 15:22:34
MCP S/W compiled on Nov 23 1998, 15:19:30
System Bootstrap Version: 3.1.2
Hardware Version: 2.0 Model: WS-C5000 Serial #: 010847706
(略)
备份到TFTP服务器上,对于supervisor engine I和II,使用upload命令,对于supervisor engine III,使用copy flash tftp命令.如下:
Cat5000> (enable) upload 172.16.10.1 sup-412a.img
Upload Module 1 image to sup-412.img on 172.16.10.1 (y/n) [n]?
y -
Finished network upload. (2718432 bytes)
Cat5000> (enable)
4.从TFTP服务器上下载新的CatOS镜象文件,对于supervisor engine I和II,使用download命令,对于supervisor engine III,使用copy tftp flash命令.如下:
Cat5000> (enable) copy tftp flash
Upload Module 1 image to sup-412.img on 172.16.10.1 (y/n) [n]?
y -
Finished network upload. (2718432 bytes)
Cat5000> (enable)
5.至此新的CatOS已经下载到Flash中去了,使用reset命令重启交换机,升级过程完毕
要注意的是supervisor engine I和II只有1个区域用来存放闪存,但是对于supervisor engine III,有3个区域,如下图:

复制文件的语法如下:
Cat5000> (enable) copy [source-memory-area]:[file-name] [destination-memory-area]
复制的过程中还可以定义新的文件名,如下:
Cat5000> (enable) copy [source-memory-area]:[file-name] [destination-memory-area]:[new-name]
例子如下图:

Cat5000> (enable) copy bootflash:sup-412a.img slot0:
Supervisor engine III还有个特性是闪存区域还可以存放配置文件,如下:
Cat5000> (enable) copy config flash
Flash device [bootflash]? bootflash:
Name of file to copy to [test_image]?tch.txt
Upload configuration to bootflashtch.txt
678324 bytes available on device slot1, proceed (y/n) [n]? y
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . .
.
/
Configuration has been copied successfully. (175664 bytes).
Cat5000> (enable)

the Boot System Command

可以使用set boot system命令来定义启动时加载的文件,如下:
Cat5000> (enable) set boot system flash [memory area]:[filename]
比如,要让交换机下次启动的时候,从slot0的PCMCIA卡加载sup3-441.img到操作系统中去,如下:
Cat5000> (enable) set boot system flash slot0:sup3-441.img

Configure the Ethernet, FastEthernet, and Gigabit Ethernet Ports

可以给Ethernet,FastEthernet和Gigabit Ethernet端口分配一个名字,使用set port name命令,如下:  net130整理
Cat5000> (enable) set port name [module_number/port_number] [name_string]
例子如下:
Cat5000> (enable) set port name 1/1 Connection to Backbone Catalyst 5500
Port 1/1 name set.
端口到背板的访问由port priority或port level决定,3种级别为high,normal和critical.critical是不可设置的,默认级别为normal.设置命令如下:
Cat5000> (enable) set port level [module_number/port_number] [normal | high]
例子如下:
Cat5000> (enable) set port level 1/1 high
Port 1/1 level set to high.
Cat5000> (enable)
有的line card同时支持10Mbps和100Mbps,可以使用set port speed来指定速率,或者让它自动与对方协商,决定自身速率.,命令如下:
Cat5000> (enable) set port speed module_number/port_number [10/100/auto]
例子如下:
Cat5000> (enable) set port speed 1/1 100
Port 1/1 speed set to 100 Mbps.
Cat5000> (enable)
对于只支持10Mbps或100Mbps的Ethernet和FastEthernet的双工模式的设置(Gigabit Ethernet不支持半双工),使用set pot duplex命令,如下:
Cat5000> (enable) set port duplex module_number/port_number [full | half]
例子如下:
Cat5000> (enable) set port duplex 1/1 full
Port 1/1 set to full-duplex.
Cat5000> (enable)
对于同时支持10Mbps或100Mbps的端口,默认双工模式为auto,并且这个是和端口速率的关系是绑定了的,如果端口速率设置为auto,双工模式即为auto;如果端口速率设置为10Mbps或100Mbps,双工模式默认为半双工,但是可设置成全双工
使用show port命令对设置进行验证,如下:

#p#Working with STP

修改桥的优先级,使用set spantree priority命令,默认是32765.优先级值低的选作根桥.如下:
Cat5000> (enable) set spantree priority [bridge_priority] [vlan]
如果没有定义VLAN,默认是VLAN 1
如下,设置VLAN 10的根桥:
Cat5000> (enable) set spantree priority 1 10
端口作为转发端口的几个因素:port cost和port priority.设置特定某个VLAN的port cost,命令如下:
Cat5000> (enable) set spantree portvlancost [module_number/port_number] cost [cost] [VLAN]
设置所有VLAN,如下:
Cat5000> (enable) set spantree portcost [module_number/port_number] [cost]
例子,设置所有的VLAN的port cost为10,如下:
Cat5000> (enable) set spantree portcost 1/1 10
Spantree port 1/2 path cost set to 10.
设置VLAN 1中的port cost为10,如下:
Cat5000> (enable) set spantree portvlancost 1/2 cost 10 1
Port 1/1 VLANs 2-1005 have path cost 19.
Port 1/1 VLANs 1 have path cost 10.
Cat5000> (enable)
默认所有端口的port priority的值为32,范围是1到63,值越低,就越容易被选为转发端口
设置优先级的命令,对于所有的VLAN,命令如下:
Cat5000> (enable) set spantree portpri mod_num/port_num priority [vlans]
对于特定VLAN,如下:
Cat5000> (enable) set spantree portvlanpri mod_num/port_num priority [vlans]
例子,设置对于所有VLAN,端口2/1的优先级为1:
Cat5000> (enable) set spantree portpri 2/1 1
Bridge port 2/1 port priority set to 1.
Cat5000> (enable)
设置对于VLAN 1,端口2/1的优先级为1,如下:
Cat5000> (enable) set spantree portvlanpri 2/1 1 10
Port 2/1 vlans 1-9,11-1005 using portpri 32.
Port 2/1 vlans 10 using portpri 1
Cat5000> (enable)
在端口处于学习和监听的时候启用转发,如下:
Cat5000> (enable) set spantree portfast [module_number/port_number] [enable | disable]
例子,比如端口2/1和服务器直接相连,这就没必要在端口学习和监听的时候对端口进行block,如下:
Cat5000> (enable) set spantree portfast 2/1 enable
Warning: Spantree port fast start should only be enabled on ports connected to a single host. Connecting hubs, concentrators,tches, bridges, etc. to a fast start port can cause temporary spanning tree loops. Use with caution.
Spantree port 2/1 fast start enabled.
这些参数可以通过show spantree命令来查看,如下:
Cat5000> (enable) show spantree [module/number] [vlan_number]
例子:
Cat5000> (enable) show spantree 2/1
Port    Vlan    Port-State    Cost     Priority    Fast-Start    Group-method
–– ––––  ––––   –––   ––––  –––––   ––––––
2/1      1     forwarding     10       32       enabled
2/1      10    forwarding     19       1        enabled
2/1      20    forwarding     19       1        enabled
2/1      30    forwarding     19       1        enabled
2/1      40    forwarding     19       1        enabled
2/1     1003   not-connected   19       1        enabled
2/1     1005   not-connected   19       1        enabled
Cat5000> (enable)
查看VLAN 1的所有端口的Spanning Tree信息统计,如下:  net130整理
Cat5000> show spantree 1
VLAN 1
Spanning tree enabled

Designated Root                     00-40-0b-73-64-c2
Designated Root Priority               1
Designated Root Cost                 0
Designated Root Port                  1/0
Root Max Age   6 sec       Hello Time   2 sec      Forward Delay    4 sec
Bridge ID MAC ADDR               00-40-0b-73-64-c2
Bridge ID Priority                     1
(略)

收藏本页

共 0 人推荐文章 交换技术之七-Configuring the Catalyst 5000 Series Switch

Copyright © 2006 cisco.ccxx.net 版权所有.提供Cisco技术,Cisco培训,CCNA,CCNP,CCIE培训,Cisco论坛CCIE实验室
上海地区Cisco培训、CCNA培训、CCNP培训、CCIE培训