思科交换机基础指令集

一。基本检索命令

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
image.png
switch#show interfaces status
image.png
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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容