7、配置端口工作模式
Switch(config-if)# duplex full/auto/half [全双工|自动协商|半双工]
8、配置端口速率
Switch(config-if)# speed 10/100/ auto
9、配置一个或多个VLAN网关
Switch(config)# int vlan 100
Switch(config-subif)# Description 客户名称ip=地址 带宽 操作日期 (描述) Switch(config-subif)# ip address 192.168.2.130 255.255.255.0
Switch(config-subif)#ip address 192.168.3.130 255.255.255.0 secondary Switch(config-subif)# no shutdown
10、配置交换机设备的管理地址
配置二层交换机设备的管理地址:
Switch(config)# int vlan 1 (交换机VLAN1的网关地址就是设备的管理地址) Switch(config-subif)# ip address 192.168.2.130 255.255.255.0 Switch(config-subif)# no shutdown
配置三层交换机的设备管理地址:
Switch(config)# int loopback0 ――loopback接口是一种逻辑接口,可以创建无数个 Switch(config-if)# ip address 192.168.2.130 255.255.255.0 Switch (config)# no int loopback 0
11、为某个端口配置一个或多个地址
Switch(config)# interface f0/13
Switch(config-if)# ip address 192.168.1.130 255.255.255.0
Switch(config-if)# ip address 192.168.1.130 255.255.255.0 secondary
6
12、将设备互联的端口设置为trunk,让其通过vlan信息
Switch(config)# int range f0/40,f0/48 (range的作用是同时对多个端口进行配置) Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport trunk allowed vlan 1-10,12-4094
(没有这句配置,则说明所有VLAN均能通过trunk)
Switch(config-if)# switchport mode trunk
(如果要增加vlan 100划分到truck时,必须把原有的vlan再都写上)
Switch(config-if)# switchport trunk allowed vlan 1-10,100,12-4094
13、新建port-channel,并将多个端口划分到该port-channel
Switch (config)# interface port-channel 1 Switch(config)# interface f0/1
Switch (config-if)# channel-group 1 mode on Switch(config)# interface f0/2
Switch (config-if)# channel-group 1 mode on
14、删除port-channel,并将该port-channel下的端口删除
Switch (config)# interface f0/1 Switch (config-if)# no channel-group 1 Switch (config)# no interface port-channel 1
15、在三层交换机上配置静态路由
Switch (config)# ip route 172.16.1.0 255.255.255.0 10.1.1.1
――ip route 目标地址段 下一跳地址
16、将源端口的流入或流出流量镜像到目的端口
将源端口的流入或流出流量镜像到目的端口以便于在目的端口接上笔记本电脑,利用anylazer软件抓包,并分析数据包是否正常。假设6509 G4/1作为目的端口,将G4/2作为源端口。实际应用中一般来说,源端口和目的端口速率应该一致。
7
IDC-BJ02-6509-1(config)#monitor session 2 source interface g4/1 both IDC-BJ02-6509-1(config)#monitor session 2 destination interface g4/2
17、SHOW命令的使用
# show version 显示系统硬件配置、软件版本信息及最近一次启动以来连续运行的时间等 # show running-configuration 显示设备运行配置信息 # show running-config int f0/13 显示某个端口的配置信息 #show vlan 显示所有VLAN信息
# show interface f0/13 显示设备所有或指定接口的状态信息 # show int description 显示所有端口的描述信息 # show int status 显示所有端口的状态信息 # show ip int brief 显示所有端口IP摘要 # show arp 显示所有地址解析协议信息 # show mac-address-table 显示MAC地址表内容
# show ip 显示设备上配置的IP地址、子网掩码、网关地址参数,管理VLAN
号、域名解析服务器、HTTP信息及路由协议设定等(该命令不被路由器支持,只被交换机支持)
# show ip router 显示某个或所有的路由信息 # show spanning-tree 显示STP信息
# show logging 查看系统当前日志设置和缓冲区里的日志信息 # show history 查看命令缓冲区内容
#show proc cpu | exc 0.00 显示CPU占用的情况(exc表示除值为0以外的进程) #show platform cpu packet stat
#show monitor session1 显示镜像端口的流量情况
下面列举常用命令:
6509-1# show interface f0/13 显示设备所有或指定接口的状态信息
FastEthernet0/29 is up, line protocol is up (connected)
下面列出cisco二层、三层交换机端口不同显示状态的线路连接情况:
8
二层交换机端口状态:
Status line protocol 线路连接情况 administratively down down 管理员手工关闭端口 down down (notconnect) 端口己打开,但没插线(初始态) up Up(connect) 端口己打开,并且己插线 三层交换机端口状态:
Status line protocol 线路连接情况 administratively down down (disabled) 管理员手工关闭端口 up down 端口己打开,但没插线(初始态) up up 端口己打开,并且己插线
6509-1#sh ip int brief
Interface IP-Address OK? Method Status Protocol Vlan1 unassigned YES NVRAM administratively down down Vlan75 211.100.2.113 YES NVRAM up up Vlan501 211.100.34.1 YES NVRAM administratively down down GigabitEthernet1/1 unassigned YES NVRAM up down GigabitEthernet1/2 unassigned YES NVRAM administratively down down GigabitEthernet3/1 211.100.2.45 YES NVRAM up up FastEthernet5/22 unassigned YES unset up up FastEthernet5/23 unassigned YES unset up down FastEthernet5/25 unassigned YES unset administratively down down
6509-1#sh int description
Interface Status Protocol Description Vl10 admin down down
Vl501 admin down down Share34.1
Vl583 up up DongFangWangJing1 Vl701 admin down down ChengHeWang 20041229 Gi1/2 admin down down
Gi3/1 up up To M320 G0/2/3 Gi3/5 up down
Fa5/5 up up YiFangDa Ip=***** 20060601 Fa5/11 up down TianYuanKeJi ip=**** 20060525 Fa5/25 admin down down
6509-1#sh arp
Protocol Address Age (min) Hardware Addr Type Interface
9
Internet 192.168.10.98 35 0010.db76.8f80 ARPA FastEthernet6/48 Internet Internet Internet Internet
6509-1#sh int status
Port Name Status Vlan Duplex Speed Type Gi1/1 notconnect routed full 1000 No GBIC Gi1/2 disabled routed full 1000 No GBIC Gi4/3 disabled 747 full 1000 1000BaseS Gi3/1 To M320 G0/2/3 connected routed full 1000 1000BaseSX Gi3/3 disabled 1 full 1000
Fa5/1 To 2950-4 0/1 connected trunk full 100 10/100BaseTX
cisco7507#sh version
Cisco Internetwork Operating System Software IOS (tm) RSP Software (RSP-PV-M), Version 12.0(17)S, EARLY DEPLOYMENT RELEASE ――ISO版本信息
ROM: System Bootstrap, Version 11.1(8)CA1, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1) ――ROM版本信息
cisco7507 uptime is 19 weeks, 3 days, 4 hours, 6 minutes --设备开机时间
System image file is \ ――Flash中的IOS映像文件名 cisco RSP4 (R5000) processor with 262144K/2072K bytes of memory. ――处理器信息 1 GEIP controller (1 GigabitEthernet).
3 VIP2 R5K controllers (4 FastEthernet)(2 Serial)(2 POS). 4 FastEthernet/IEEE 802.3 interface(s)
1 GigabitEthernet/IEEE 802.3 interface(s) 2 Serial network interface(s)
2 Packet over SONET network interface(s)
123K bytes of non-volatile configuration memory. ――NVRAM值 Configuration register is 0x2102 ――配置存储器值
查看及修改系统当前日志设置和缓冲区里的日志信息:
cisco7507#sh logging
Syslog logging: enabled (0 messages dropped, 0 flushes, 0 overruns)
Console logging: level debugging, 1957 messages logged ――控制台的日志信息 Monitor logging: level debugging, 73 messages logged ――Telnet客户端发送的系统日志 Buffer logging: disabled ――缓冲区日志 Logging Exception size (65536 bytes)
Trap logging: level informational, 472 message lines logg
――向SNMP管理软件发送的系统日志 cisco7507#conf t
cisco7507(config)#logging buffer
10
211.100.28.171 53 0030.4857.353c ARPA Vlan584 211.100.21.161 - 00d0.0106.5800 ARPA Vlan755 211.100.27.169 0 000f.b587.b194 ARPA Vlan705 211.100.21.165 0 Incomplete ARPA