一。基本检索命令
1.进入/退出特权模式
User Access Verification
password:cisco
switch>enable
password:**********
switch#
【进系统先使用cisco密码登陆,然后进入enable模式,再输入enable密码,进入特权模式。】
switch#disable
switch>
【disable命令退出特权模式。】
2.查看ARP表
switch#show arp
switch#show arp | include *
【*为所需检索的关键字(IP或mac地址等)】
3.查看交换机版本/运行/端口等信息
switch>show version
switch#show version
switch#show running-config
switch#show interfaces f0/1
4.查看所有端口运行情况
switch#show ip interface brief
switch#show interfaces status
5.查看MAC地址
switch#show mac-address-table
switch#show mac-address-table *
【*为所检索的mac地址】
6.查看路由表
switch#show ip router
【三层运行,二层没有】
7.查看日志
switch#show logging
8.查看系统时间
switch#show clock
二。基本配置命令
【交换机配置都要在全局模式下】
1.进入/退出全局配置模式
switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#
switch(config)#end
switch#
2.修改主机名
switch(config)#hostname ecnup-1
ecnup-1(config)#
3.配置设备管理地址
switch(config)#interface vlan1
switch(config-if)#ip address 10.10.10.45 255.255.255.0
switch(config-if)#
【VLAN1为默认设备管理VLAN】
4.配置默认网关
switch(config)#ip default-gateway 192.168.1.254
5.创建/命名/删除VLAN
switch(config)#vlan 100
switch(config-vlan)#name vlan100
switch(config)#no vlan 100
6.进入/退出接口
switch(config)#interface f0/1
switch(config-if)#exit
switch(config)#
7.进入一组接口
switch(config)#interface range f0/1 - 4
switch(config-if-range)#
8.设置接口为ACCESS
switch(config)#interface f0/3
switch(config-if)#switchport mode access
9.设置ACCESS口的VLAN
switch(config-if)#switchport access vlan 100
10.设置接口为TRUNK
switch(config)#interface f0/2
switch(config-if)#switchport mode trunk
11.设置接口为TRUNK NATIVE VLAN99 (PVID99)
switch(config)#interface f0/2
switch(config-if)#switchport mode trunk
#老版本还需先操作,新版本省略
switch(config-if)#switchport trunk encapsulation dot1q
#然后
switch(config-if)#switchport trunk native vlan 99
12.使得TRUNK口对VLAN放行
switch(config-if)#switchport trunk allowed vlan 99,100
【*vlan all 就是对所有vlan放行,trunk 上行下行都要注意是否放开】
13.POE开启/关闭
switch(config-if)#power inline consumption
switch(config-if)#no power inline consumption
14.关闭/开启接口
switch(config-if)#shutdown
switch(config-if)#no shutdown