1、配置主機名
在全局模式下輸入hostname 名字 然後回車即可立馬生效(在生産環境交換機必須有自己唯一的名字)
Switch(config)#hostname jsh-sw1
jsh-sw1(config)#
2、顯示系統OS名稱及版本資訊
特權模式下,輸入指令 show version
Switch#show version
Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Wed 12-Oct-05 22:05 by pt_team
ROM: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4)
System returned to ROM by power-on
Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.
24 FastEthernet/IEEE 802.3 interface(s) ——說明有24個百兆接口
2 Gigabit Ethernet/IEEE 802.3 interface(s) ——說明有 2個千兆接口
63488K bytes of flash-simulated non-volatile configuration memory.
<u>Base ethernet MAC Address : 0040.0BE5.7EEE</u> (MAC位址)
Motherboard assembly number : 73-9832-06
Power supply part number : 341-0097-02
<u>Motherboard serial number : FOC103248MJ</u> (主機闆S/N序列号,用于辨識交換機)
Power supply serial number : DCA102133JA
Model revision number : B0
Motherboard revision number : C0
Model number : WS-C2960-24TT
System serial number : FOC1033Z1EY
--More--
3、檢視交換機的MAC位址表
特權模式下輸入指令 show mac-address-table 顯示靜态MAC位址(手工方式添加,無老化時間,會一直存在)
特權模式下輸入指令 show mac-address-table dynamic 顯示動态MAC位址(通過arp學習到的,有老化時間)

Switch3#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0000.0c0c.7a5a DYNAMIC Fa0/24 (其中0000.0c0c.7a5a是MAC位址;類型DYNAMIC表示是動态學習到的;Fa0/24表示該MAC位址對應交換機的端口号)
1 0001.9734.c756 DYNAMIC Fa0/24
1 0001.c981.6818 DYNAMIC Fa0/24
1 0004.9a65.ed19 DYNAMIC Fa0/1
1 00e0.f99e.4637 DYNAMIC Fa0/2
4、指定接口的雙工模式
在接口模式下,輸入指令duplex full 則設定為:全雙工
在接口模式下,輸入指令duplex half 則設定為:辦雙工
在接口模式下,輸入指令duplex auto 則設定為:自動(預設為此模式)
5、指定接口的速率
在接口模式下,輸入指令 speed 10 則設定為10M
在接口模式下,輸入指令 speed 100 則設定為100M
在接口模式下,輸入指令 speed 1000 則設定為1000M
在接口模式下,輸入指令 speed auto 則設定為自動(預設為此速度)
Switch(config-if)#speed ?
10 Force 10 Mbps operation
100 Force 100 Mbps operation
auto Enable AUTO speed configuration
Switch(config-if)#speed auto
Switch(config-if)#
6、檢視接口的雙工模式和速率
在特權模式,使用指令 show interface 端口
Switch#show interfaces fa 0/24
FastEthernet 0/24 is up, line protocol is up (connected)
Hardware is Lance, address is 0005.5eb1.7918 (bia 0005.5eb1.7918)
BW 100000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s ——雙工模式及速率
7、裝置配置的輔助指令
7.1 指令行界面空閑一段時間,重回初始界面的問題
在全局模式下,輸入指令 line con 0 然後回車換行,輸入指令exec-timeout 0 0 即可設定為永不逾時
jingshihai-01>
jingshihai-01>en
jingshihai-01#config ter
jingshihai-01#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
jingshihai-01(config)#line con 0
jingshihai-01(config-line)#exec-t
jingshihai-01(config-line)#exec-timeout 0 0
jingshihai-01(config-line)#
7.2 控制台消息打算輸入的處理
當執行完一個指令,需要輸入另一個指令時,為了保持光标不被傳回的消息打擾,可以配置如下指令:在全局模式下,輸入指令 line con 0 然後回車換行,輸入指令logging synchronous(簡寫 logg syn)
jingshihai-01(config)#line con 0
jingshihai-01(config-line)#logging synchronous
7.3 禁用DNS查詢
jingshihai-01#asdadffffffffffffffffffff
Translating "asdadffffffffffffffffffff"...domain server (255.255.255.255)
當遇到如上提示時,一般需要等待很久,此時就要要禁用DNS查詢。
在全局模式下,輸入指令 no ip domain-lookup(簡寫no ip domain-lo)
jingshihai-01#asdadffffffffffffffffffff
Translating "asdadffffffffffffffffffff"...domain server (255.255.255.255)
% Unknown command or computer name, or unable to find computer address (等待很久才會顯示該資訊)
jingshihai-01#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
jingshihai-01(config)#no ip domain-lookup
jingshihai-01(config)#asdadffffffffffffffffffff
% Invalid input detected at '^' marker. (直接顯示該資訊)
jingshihai-01(config)#
8、檢視交換機的配置
在特權模式下輸入指令 show running-config(可以用來檢查配置)
jingshihai-01#
jingshihai-01#show running-config
Building configuration...
Current configuration : 1157 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname jingshihai-01 (曆史輸入的指令,可以用來檢查輸入的是否正确)
!
!
!
jingshihai-01#
9、設定進入特權模式的密碼(明文)
在全局模式下輸入指令 enable password 密碼
jingshihai-01#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
jingshihai-01(config)#enable password 123456
jingshihai-01(config)#end
jingshihai-01#
jingshihai-01#show running-config
Building configuration...
Current configuration : 1157 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname jingshihai-01
!
enable password 123456
!
!
jingshihai-01#exit
jingshihai-01>enable
Password:
jingshihai-01#