1、思科4500系列交换机简明配置维护手册 1、 配置机器名、telnet、密码 在全局模式下,用conf t,进入配置模式,进行以下配置: #conf t #clock timezone GMT 8 ;配置时区 #clock set 13:30:21 31 JAN 2004 ;配置交换机时间 #clock calendar-valid ;使能硬件时钟同步 #service timestamps debug datetime localtime ;配置系统debug记录时间格式 #service timestamps log datetime localtime ;配置系统日志记录时间格式 #se
2、rvice password-encryption ;配置使用加密服务,主要针对口令加密 #hostname xxxx ;配置交换机名称 #enable secret 0 xxxxx ;配置enable口令 #copy run start ;将配置信息保存到NVRAM中,重启动不会丢失 #line vty 0 4 ;配置telnet #exec-timeout 30 0 #password 0 xxxx #login 2、配置snmp #conf t #snmp-server community cisco ro(只读) ;配置只读通信字符串 #snmp-server community se
3、cret rw(读写) ;配置读写通信字符串 #snmp-server enable traps ;配置网关SNMP TRAP #snmp-server host 10.254.190.1 rw ;配置网关工作站地址 3、 启动三层功能 #ip routing ;启动路由功能 4、 端口设置 4.1. 端口基本设置 Cisco 65xx系列交换机的端口缺省都是路由模式,一般都会配置为交换端口使用,进入端口配置模式: 对于单一端口,在配置模式下输入:interface Ethernet,Fast Ethernet,Gigabit Ethernet x/y, x为槽位号,y为端口号。 对于一组端口
4、,可以使用以下的命令进入,例如: Switch(config)# interface range fastethernet 5/1 - 5 或: Switch(config-if)# interface range gigabitethernet 2/1 - 2, gigabitethernet 3/1 - 2 进行端口配置模式后,可以shutdown,或no shutdown端口,并可以对端口进行配置,快速以太端口有全双工、半双工和自动协商模式,如果知道对端连接的设备是采用何种方式,最好采用手工设置方式固定端口的模式和速率。缺省是自动协商模式。 快速以太端口的速率可以设置为100M,也可以设
5、置为10M和自动协商。缺省是自动协商方式。如: Switch(config-if)#speed 10 | 100 | auto(速度) Switch(config-if)# duplex auto | full | half(双工) 或添加注释,如: Switch(config-if)# description Channel-group to Marketing 4.2. 配置二层交换接口 (以fastethernet为例,gigabitethernet一样) Switch(config)# interface fastethernet x/y Switch(config-if)# shut
6、down Switch(config-if)# switchport ;6500上缺省端口为路由端口,需要写switchport将端口设置为交换端口 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan x Switch(config-if)# no shutdown Switch(config-if)# end 清除二层接口配置 (以fastethernet为例,gigabitethernet一样) Switch(config)# interface fastethernet x
7、/y Switch(config-if)# no switchport Switch(config-if)# end 注:使用default interface ethernet | fastethernet | gigabitethernet slot/port,使端口回到原来的缺省配置。 4.3. 配置三层路由端口 6500的端口缺省就是具有三层交换的端口,用来跟其他设备的连接,当将一个端口配置成三层端口之后,就可以在此端口上分配IP地址了。 Switch(config)# interface fastethernet x/y Switch(config)# ip add x.x.x.x
8、x.x.x.x Switch(config)# no shutdown 4.4. 配置端口Trunk 将一个二层端口配置为Trunk模式: Switch(config)# interface fastethernet x/y (以fastethernet为例,gigabitethernet一样) Switch(config-if)# shutdown Switch(config-if)# switchport Switch(config-if)# switchport trunk encapsulation dot1q Switch(config-if)# switchport mode tr
9、unk Switch(config-if)# no shutdown Switch(config-if)# end Switch# exit 4.5. Ethernaet Channel Switch(config)# interface range gigabitethernet1/1 - 2 Switch(config-if)#no ip address Switch(config-if)#switchport Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport mode t
10、runk Switch(config-if)#switchport trunk native vlan 1 Switch(config-if)#channel-group 1 mode on 产生配置结果如下: interface Port-channel1 ;自动产生,并且一定要如下所示,否则可能会有问题。 switchport switchport trunk encapsulation dot1q switchport mode trunk ! interface GigabitEthernet1/1 no ip address switchport switchport trunk e
11、ncapsulation 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 如果有问题,使用命令#no int port-channel 1 ,#int g2/1 -2 ,#no switchport 4.6. 查看端口配置 Swi
12、tch# show running-config interface fastethernet 5/8 Switch# show interfaces fastethernet 5/8 switchport Switch# show running-config interface port-channel 1 Switch# show spanning-tree interface fastethernet 4/45、配置VLAN 5.1. 配置VTP VTP是一个2层信息协议,包括版本1和2。一个网络设备只能属于一个VTP domain。缺省, Catalyst 6500交换机配置为VTP
13、 server mode,在没有管理域的状态。直到在一个trunk链路上收到其他域的宣告或手工配置管理域。VTP并不是一定要配置,但是配置可以简化配置复杂度和易于管理。 VTP pruning(VTP裁剪)增强了网络带宽利用率。结合VTP,使得没有必要接收某个vlan的广播信息的交换机被裁剪,免于接收包括broadcast, multicast, unknown, and flooded unicast的包。 Switch(config)# vtp domain domain_name Switch(config)# vtp mode client | server | transparent
14、 Switch(config)# vtp version 1 | 2 Switch(config)# vtp password password_string Switch(config)# vtp pruning Switch# show vtp status 5.2. 配置VLAN端口 5.3. 创建VLAN 缺省状态下,所有的二层端口均属于vlan1,vlan的配置方法如下: 命令 目的 Step 1 Switch# vlan database 进入vlan配置方式. Step 2 Switch(vlan)# vlan vlan_ID 加入一个VLAN. Step 3 Switch(vl
15、an)# vtp domain name 设置vtp域名 Step 3 Switch(vlan)# exit 更新VLAN数据库,并在管理域内广播,退到全局模式 Step 4 Switch# show vlan name vlan_name 验证VLAN配置 删除配置好的vlan Switch# vlan database Switch(vlan)# no vlan x Deleting VLAN 3. Switch(vlan)# exit 5.4. 给vlan分配端口 Switch(config)# interface fastethernet x/y Switch(config-if)#
16、shutdown Switch(config-if)# switchport Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan x Switch(config-if)# no shutdown Switch(config-if)# end Switch# exit 5.5. 配置vlan地址 Switch(config)# interface vlan x Switch(config)# ip add x.x.x.x x.x.x.x6、配置镜像端口 在交换机上配置镜像端口(Mi
17、rroring Port)用于建立内部网络的监控端口,以便收集相关被监测端口的数据流量,进行数据流监控及分析。我们这里配置镜像端口用于配置入侵检测设备(镜像端口)的检测口检测一级防火墙和二级防火墙的内网接口,以探测是否有入侵行为发生。 #monitor session 1 source interface Fa7/14 - 19 rx #monitor session 1 destination interface Fa7/22 #monitor session 2 source interface Fa7/24 #monitor session 2 destination interface Fa7/25