华为 交换机简要配置手册(中文) 目 录 1. 连接设备 3 1.1. 从CONSOLE连接 3 1.2. 远程TELNET连接 6 2. 基本信息配置 6 2.1. 配置机器名、TELNET、密码 6 2.2. 配置SNMP网管串 6 3. 冗余及系统高可用性配置 7 3.1. 同步SUPERVISOR ENGINE配置 7 3.2. 查看SUPERVISOR ENGINE冗余 9 3.3. 向冗余SUPERVISOR ENGINE拷贝IOS文件 11 4. 端口设置 11 4.1. 基本设置 11 4.2. 配置三层端口 12 5. 配置二层端口 13 5.1. 配置TRUNK: 13 6. 配置HSRP 15 6.1. 配置二层普通交换接口 15 6.2. 清除二层接口配置 16 7. 配置VLAN 16 8. 动态路由协议--OSPF配置 18 8.1. 启用OSPF动态路由协议 18 8.2. 定义参与OSPF的子网 18 8.3. OSPF区域间的路由信息汇总 19 8.4. 配置密码验证 19 8.5. 设置产生缺省路由 19 9. 交换机维护 20 9.1. 交换机IOS保存和升级 20 9.2. 交换机密码恢复 21 1. 连接设备 1.1. 从console连接 第一次对6000交换机进行配置,必须从console进入。  首先先将机器上架,按要求接好电源,然后用随机附带的Console线和转接头将交换机的console口与PC的串口相联,如下: Com口设置如下: • 9600 baud • 8 data bits • No parity • 2 stop bits 检查电源无误后,开电,可能会出现类似下面的显示,按黑粗体字回答: System Bootstrap, Version 6.1(2) Copyright (c) 1994-2000 by cisco Systems, Inc. c6k_sup2 processor with 131072 Kbytes of main memory rommon 1 > boot slot0:c6sup22-jsv-mz.121-5c.EX.bin Self decompressing the p_w_picpath : ################################################# ############################################################################### ############################################################################### ############################################################################### ############################################################################### [OK] Restricted Rights Legend Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013. cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134-1706 Cisco Internetwork Operating System Software IOS (tm) MSFC2 Software (C6MSFC2-BOOT-M), Version 12.1(3a)E4, EARLY DEPLOYMENT R ELEASE SOFTWARE (fc1) Copyright (c) 1986-2000 by cisco Systems, Inc. Compiled Sat 14-Oct-00 05:33 by eaarmas Image text-base: 0x30008980, data-base: 0x303B6000 cisco Cat6k-MSFC2 (R7000) processor with 114688K/16384K bytes of memory. Processor board ID SAD04430J9K R7000 CPU at 300Mhz, Implementation 39, Rev 2.1, 256KB L2, 1024KB L3 Cache Last reset from power-on X.25 software, Version 3.0.0. 509K bytes of non-volatile configuration memory. 16384K bytes of Flash internal SIMM (Sector size 512K). Press RETURN to get started! --- System Configuration Dialog --- Would you like to enter the initial dialog? [yes]: no 回答:NO,进入手工配置,在router>下,输入enable 回车,进入全局模式 1.2. 远程telnet连接 当完成交换机配置,并起给交换机配置了管理地址,就可以直接采用远程telnet登陆进入交换机了,但是必须先配置line vty的密码和enable密码才能允许远程登陆。 2. 基本信息配置 2.1. 配置机器名、telnet、密码 1. 在全局模式下,用conf t,进入配置模式,进行以下的配置: 管理方面的配置: service timestamps debug datetime localtime service timestamps log datetime localtime service password-encryption hostname xxxx enable secret 0 xxxxx line vty 0 4 exec-timeout 30 0 password 0 xxxx login 2.2. 配置snmp网管串 conf t snmp-server community xxxxxx ro(只读) 或 snmp-server community xxxxxx rw(读写) 3. 冗余及系统高可用性配置 6000系列支持双supervisor engines或加强的高可用系统(EHSA),允许第二块supervisor engines处于standby模式或EHSA状态,在主用supervisor engines有问题时进行切换(切换过程中会照成网络的暂时中断), 当交换机加电后,EHSA会缺省地在二supervisor engine上运行(slot 1 or 2), 其中之一会成为活动的。 注意:二块supervisor engine必须有一致的IOS,内存等。 3.1. 同步Supervisor Engine配置 在正常的*作过程中,初始配置(startup-config)及config-registers配置缺省会在二supervisor engines之间同步. 发生切换后,新的活动supervisor engine会运行当前的配置。 可按以下的步骤手工同步二块supervisor engines: 命令 目的 Step 1 Router(config)# redundancy 进入冗余配置模式 Step 2 Router(config-r)# main-cpu 进入main-cpu配置模式 Step 3 Router(config-r-mc)# auto-sync {startup-config | config-register | bootvar | standard} 同步配置参数,有startup-config, config-register,bootvar,standard Step 4 Router(config-r-mc)# end 退回全局模式 Step 5 Router# copy running-config startup-config 保存配置 注意 auto-sync standard命令不同步boot variables. 配置如下: Router(config)# redundancy Router(config-r)# main-cpu Router(config-r-mc)# auto-sync standard Router(config-r-mc)# auto-sync bootvar Router(config-r-mc)# end Router# copy running-config startup-config 注意 手工同步某参数后,会使原缺省的同步特征 3.2. 查看Supervisor Engine冗余 Command Purpose Router# show module all Display the redundancy configuration. 如下 Router# show module all Mod Ports Card Type Model Serial No. --- ----- -------------------------------------- ------------------ ----------- 1 2 Catalyst 6000 supervisor 2 (Standby) WS-X6K-SUP2-2GE SAD04450LEU 2 2 Catalyst 6000 supervisor 2 (Active) WS-X6K-SUP2-2GE SAD04160FSR 3 48 SFM-capable 48-port 10/100 Mbps RJ45 WS-X6548-RJ-45 SAD050105Y0 4 48 SFM-capable 48-port 10/100 Mbps RJ45 WS-X6548-RJ-45 SAD0440799G 5 16 SFM-capable 16 port 10/100/1000mb RJ45 WS-X6516-GE-TX SAD05030P0W 7 0 Switching Fabric Module-136 (Active) WS-X6500-SFM2 SAD04440663 8 0 Switching Fabric Module-136 (Standby) WS-X6500-SFM2 SAD04510at4 9 16 Pure SFM-mode 16 port 1000mb GBIC WS-X6816-GBIC SAD044904N7 11 16 Pure SFM-mode 16 port 1000mb GBIC WS-X6816-GBIC SAD04390CCJ 12 16 Pure SFM-mode 16 port 1000mb GBIC WS-X6816-GBIC SAD04260E24 13 16 Pure SFM-mode 16 port 1000mb GBIC WS-X6816-GBIC SAD04260E1J Mod MAC addresses Hw Fw Sw Status --- ---------------------------------- ------ ------------ ------------ ------- 1 0001.6461.38a8 to 0001.6461.38a9 1.1 Unknown 6.2(0.106) Ok 2 0040.0b14.03e2 to 0040.0b14.03e3 0.220 6.1(2) 6.2(0.106) Ok 3 0001.6441.47f0 to 0001.6441.481f 0.303 6.1(3) 6.2(0.106) Ok 4 0002.b9ff.e8d0 to 0002.b9ff.e8ff 0.204 6.1(3) 6.2(0.106) Ok 5 0001.64f8.3330 to 0001.64f8.333f 0.201 6.1(2) 6.2(0.106) Ok 7 0040.0bff.0000 to 0040.0bff.0000 0.107 6.1(3) 6.2(0.106) Ok 8 0040.0bff.0000 to 0040.0bff.0000 0.203 6.1(3) 6.2(0.106) Ok 9 0002.fc90.0888 to 0002.fc90.0897 0.302 12.1(4r) 12.1(nightly Ok 11 0001.64f8.37f0 to 0001.64f8.37ff 0.204 12.1(5r) 12.1(nightly Ok 12 0001.64f8.3180 to 0001.64f8.318f 0.105 12.1(5r) 12.1(nightly Ok 13 0001.64f8.3190 to 0001.64f8.319f 0.105 12.1(5r) 12.1(nightly Ok Mod Sub-Module Model Serial Hw Status --- --------------------------- --------------- --------------- ------- ------- 1 Cat6k MSFC 2 daughterboard WS-F6K-MSFC2 SAD044509Y3 1.1 Ok 2 Policy Feature Card 2 WS-F6K-PFC2 SAD04130A17 0.305 Ok 2 Cat6k MSFC 2 daughterboard WS-F6K-MSFC2 SAD04160DBN 0.306 Ok 4 Distributed Forwarding Card WS-F6K-DFC SAD04460KEJ 0.205 Ok 5 Distributed Forwarding Card WS-F6K-DFC SAD04460KEL 0.205 Ok 9 Distributed Forwarding Card WS-F6K-DFC SAD04440952 0.215 Ok 11 Distributed Forwarding Card WS-F6K-DFC SAD04390CCJ 0.215 Ok 12 Distributed Forwarding Card WS-F6K-DFC SAD04340BK2 0.118 Ok 13 Distributed Forwarding Card WS-F6K-DFC SAD04340BK0 0.118 Ok Router# 3.3. 向冗余Supervisor Engine拷贝IOS文件 如果二块supervisor Engine与第一块的IOS相同,就不需要做此步 使用以下命令将文件拷贝到冗余supervisor engine的slot0: Router# copy source_device:source_filename slaveslot0:target_filename 使用以下命令将文件拷贝到冗余supervisor engine的bootflash: Router# copy source_device:source_filename slavesup-bootflash:target_filename 使用以下命令将文件拷贝到冗余MSFC的bootflash: Router# copy source_device:source_filename slavebootflash:target_filename 4. 端口设置 4.1. 基本设置 进入端口配置模式: 对于单一端口,在配置模式下输入:interface Ethernet,Fast Ethernet,Gigabit Ethernet x/y, x为槽位号,y为端口号。 对于一组端口,可以使用以下的命令进入,例如: Router(config)# interface range fastethernet 5/1-5 或: Router(config-if)# interface range fastethernet 5/1-5, gigabitethernet 1/1-2 进行端口配置模式后,可以shutdown,或no shutdown端口,并可以对端口进行配置,快速以太端口有全双工、半双工和自动协商模式,如果知道对端连接的设备是采用何种方式,最好采用手工设置方 式固定端口的模式和速率。缺省是自动协商模式。 快速以太端口的速率可以设置为100M,也可以设置为10M和自动协商。缺省是自动协商方式。 如: Router(config-if)#speed [10 | 100 | auto](速度) Router(config-if)# duplex [auto | full | half](双工) 或添加注释,如:Router(config-if)# description Channel-group to "Marketing" 4.2. 配置三层端口 6506的端口可以配置成三层端口,用来跟其他设备的连接,当将一个端口配置成三层端口之后,就可以在此端口上分配IP地址了。 Router(config)# interface fastethernet x/y Router(config)# ip add x.x.x.x x.x.x.x 5. 配置二层端口 5.1. 配置Trunk: Router(config)# interface fastethernet x/y (以fastethernet为例,gigabitethernet一样) Router(config-if)# shutdown Router(config-if)# switchport Router(config-if)# switchport mode dynamic desirable Router(config-if)# switchport trunk encapsulation dot1q Router(config-if)# no shutdown Router(config-if)# end Router# exit 如果要配置二台6509之间的Trunk联接,首先将二6509用千兆光纤相联好,然后分别配置二相联端口的trunk,可以是只用一双光纤,或用二对光 纤做port channel,配置如下: 一双光纤相联时,分别在二台65上进行以下的配置: interface GigabitEthernet1/1 no ip address switchport switchport trunk encapsulation dot1q switchport trunk native vlan 1 二对光纤做port channel,分别在二台65上进行以下的配置:: interface port-channe1 no ip address switchport switchport trunk encapsulation dot1q switchport trunk native vlan 1 ! interface GigabitEthernet1/1 no ip address switchport switchport trunk encapsulation dot1q switchport trunk native vlan 1 channel-group 1 mode on ! interface GigabitEthernet1/2 no ip address switchport switchport trunk encapsulation dot1q switchport trunk native vlan 1 channel-group 1 mode on 6. 配置HSRP 在其中一台65上按下面模版进行配置 interface Vlan x ip address x.x.x.x x.x.x.x no ip redirects no ip directed-broadcast standby 1 priority 100 preempt standby 1 ip y.y.y.y ! 在另一台65上按下面模版进行配置 interface Vlan x ip address x.x.x.x x.x.x.x no ip redirects no ip directed-broadcast standby 1 priority 110 preempt standby 1 ip y.y.y.y ! 6.1. 配置二层普通交换接口 (以fastethernet为例,gigabitethernet一样) Router(config)# interface fastethernet x/y Router(config-if)# shutdown Router(config-if)# switchport Router(config-if)# switchport mode access Router(config-if)# switchport access vlan x Router(config-if)# no shutdown Router(config-if)# end 6.2. 清除二层接口配置 (以fastethernet为例,gigabitethernet一样) Router(config)# interface fastethernet x/y Router(config-if)# no switchport Router(config-if)# end 使用default interface {ethernet | fastethernet | gigabitethernet} slot/port,使端口回到原来的缺省配置。 7. 配置Vlan 缺省状态下,所有的二层端口均属于vlan1,vlan的配置方法如下: 命令 目的 Step 1 Router# vlan database 进入vlan配置方式. Step 2 Router(vlan)# vlan vlan_ID 加入一个VLAN. Step 3 Router(vlan)# vtp domain name 设置vtp域名 Step 3 Router(vlan)# exit 更新VLAN数据库,并在管理域内广播,退到全局模式 Step 4 Router# show vlan name vlan_name 验证VLAN配置 l 删除配置好的vlan Router# vlan database Router(vlan)# no vlan x Deleting VLAN 3... Router(vlan)# exit l 将端口分配给vlan: Router(config)# interface fastethernet x/y Router(config-if)# shutdown Router(config-if)# switchport Router(config-if)# switchport mode access Router(config-if)# switchport access vlan x Router(config-if)# no shutdown Router(config-if)# end Router# exit l 配置interface vlan Router(config)# interface vlan x Router(config)# ip add x.x.x.x x.x.x.x Router(config)# udld enable 8. 动态路由协议--OSPF配置 OSPF(Open Shortest Path First)协议即最短路径优先协议。OSPF是一个内部网关协议,与RIP相对,OSPF是链路状态路由协议,RIP是距离向量路由协议。OSPF与其 他路由器交换信息,所交换的信息不是路由,而是链路状态。 OSPF协议配置步骤大致如下: 8.1. 启用OSPF动态路由协议 router ospf 进程号 进程号可以随意设置,只标识ospf为本路由器内的一个进程,各路由器上的OSPF进程号也可以不一样。 8.2. 定义参与ospf的子网 network IP子网号 反掩码 area 区域号 IP子网号可以用一段网络的网络号表示,此时反掩码为该网络掩码的反(即1与0互换),这种表示方法下,所有IP地址落在该网段范围的路由器接口都将参与 OSPF信息交换; IP子网号也可以用路由器上某个接口的IP地址来表示,此时反掩码为0.0.0.0 ,这种表示方法下,只有该接口将参与OSPF信息交换。如果有多个接口要参与路由信息交换的话,就要使用多个network命令。 路由器将限制只能在相同区域内交换子网信息,不同区域间不交换路由信息。另外,区域0为主干OSPF区域。不同区域交换路由信息必须经过区域0。一般地, 某一区域要接入OSPF路由区域,该区域必须至少有一台路由器为区域边缘路由器,即它既参与本区域路由又参与区域0路由。 8.3. OSPF区域间的路由信息汇总 如果区域中的子网是连续的,采用路由汇总功能后,区域边缘路由器(ABR)或者自治域边缘路由器(ASBR)在向外传播路由信息时,会将所有这些连续的子 网总结为一条路由传播给其它区域,在其它区域内的路由器看到这个区域的路由就只有一条。这样可以节省路由时所需网络带宽,也可以减少路由表的大小。 设置对某一特定范围的子网进行总结: 在ABR上使用: area 区域号 range 汇总子网号 子网范围掩码 在ASBR上使用: summary-address 汇总子网号 子网范围掩码 8.4. 配置密码验证 出于安全的考虑,常常要在OSPF接口上配置密码验证,只有两端的接口使用相同的密码时,才能正确交流路由信息。 area area_id authentication message-digest 通过以上配置,路由器之间就可以完成路由信息交换了。 8.5. 设置产生缺省路由 OSPF可以产生一条缺省路由,在全OSPF范围内使用。 配置命令:default-information originate always metric 10 metric-type 1 该命令在ASBR上使用。用此命令产生缺省路由时,有两种情况,第一种是在当前的路由器上必须存在一条缺省路由,此时命令中可以不带参数always;第 二种情况是在任何情况下都强制产生一条指向自己的缺省路由,此时要带上always参数,但这种情况下要注意,如果该路由器中没有到目的地的路由的话,将 造成包的丢失。 metric和metric-type分别设置该缺省路由的cost以及类型。 具体示例如下: router ospf 100 area 0 authentication message-digest area 1 authentication message-digest network 192.168.3.0 0.0.0.255 area 1 network 202.103.224.23 0.0.0.0 area 0 area 1 range 192.168.0.0 255.255.0.0 default-information always metric10 metric-type 1 ! ip route 0.0.0.0 0.0.0.0 202.103.224.24 9. 交换机维护 9.1. 交换机IOS保存和升级 交换机的IOS保存和升级是采用TFTP协议完成,所以首先你必须要下载一个TFTP软件,然后按照下面的步骤来进行: 1、 在你的机器上启动TFTP 。 2、 登陆到3500交换机,然后在enable状态下输入如下命令来完成IOS的保存: switch#copy flash tftp Source IP address or hostname [171.68.206.171]? Source filename []? cat6000-sup2k8.7-1-1.bin Destination filename [cat6000-sup2k8.7-1-1.binn]? Loading cat6000-sup2k8.7-1-1.bin to 171.68.206.171 (via VLAN1): !!!! !!!!!!!!!!! [OK - 1125001 bytes] 3、 如果你要升级IOS文件,那么你首先要检查flash空间是否够,如果空间不够的花,则需要先删除原来的IOS然后在升级。 4、 按照如下命令来完成IOS的升级: switch#copy tftp flash Source IP address or hostname []? 171.68.206.171 Source filename []? cat6000-sup2k8.7-1-1.bin Destination filename [cat6000-sup2k8.7-1-1.bin]? y Loading cat6000-sup2k8.7-1-1.bin from 171.68.206.171 (via VLAN1): !!!! !!!!!!!!!!! [OK - 1125001 bytes] 9.2. 交换机密码恢复 运行Native IOS的Catalyst6000系列交换机的启动顺序跟其它交换机不一样,因为它们的硬件结构不一样。当你打开交换机开关之后,交换机处理器 SP(Switch Processor)首先启动,然后在很短的时间之内(大概25秒钟)SP会将控制口(console)交给路由处理器RP/MSFC(Route Processor),路由处理器继续引导系统文件。要进行密码恢复应该在SP将console交给RP之后按 Ctrl-brk,如果你太早中断启动过程,则会进入SP的 ROMMON状态,这不是你要的状态。要确定什么时候中断启动过程,可以在看见下面的信息时候按Ctrl-brk 中断启动过程: 00:00:03: %OIR-6-CONSOLE: Changing console ownership to route processor 1. 首先通过console线从console端口进入交换机。 2. 关闭交换机的电源,然后再打开交换机电源。 3. 当SP将控制权交给RP之后,在终端上输入Break。注意,在没有看见下面的信息之前不要中断系统启动: 00:00:03: %OIR-6-CONSOLE: Changing console ownership to route processor 4. 在 rommon 1>提示符下输入confreg 0x2142 5. 在 rommon 2> 提示符下输入 reset 6. 在setup中输入 no或者按Ctrl-C 跳过setup过程。 7. 在Router>提示符下输入enable。 8. 运行copy start running将旧的配置文件拷贝的内存中。 9. 运行 enable secret 修改密码。 10. 、运行config-register 0x2102 修改寄存器的值。 11. 你还可以修改vty的密码: Router(config)#line vty 0 4 Router(config-line)#password cisco Router(config-line)#^Z Router#