思科交换机基本配置命令

switch>enable    进入特权模式

switch#config terminal               进入全局模式

switch(config)#hostname+xxx          设置主机名

switch(config)#enable password       明文密码
 
switch(config)#enable secret         密文密码

switch(config)#ip default-gateway    设置网关

switch#show mac-address-table        查看MAC地址

switch(config)#logging synchronous   阻止控制台信息覆盖命令行上的输入

switch(config)#no ip domain-lookup   关闭DNS查看功能

switch(config)#exec-timeout 0 0      阻止会话退出

使用telnet远程式管理

switch(config)#line vty 0 4        进入虚拟终端

switch(config-line)#password xx    设置登录口令

switch(config-line)#login          要求口令验证

控制台口令

switch(config)#line console 0          进入控制台口

switch(config-line)#password xx  

switch(config-line)# 设置登录口令login   允许登录

cisco发现协议(cdp)

switch(config)#show cdp                   显示cisco设备全局配置信息

switch(config)#show cdp interface端口     查看cdp配置下端口信息

switch(config)#show cdp neighbors         显示直连cisco设备信息

switch(config)#show cdp neighbors detail  查看邻居详细信息 

思科交换机恢复出厂配置

switch#erase startup-config

switch#delete flash: vlan.dat

配置接口标识(区分路由器的各个接口)

switch(config)#interface fastethernet0/1

switch(config)#description this is a fast ethernet port used to connecting the company's intranet!

vtp配置

switch(config)#vtp domain       设置VTP域名

switch(config)#vtp password xx  设置VTP密码

switch(config)#vtp mode server/client/transparent  设置VTP服务模式

switch(config)#vtp version     设置VTP版本

switch(config)#vtp pruning     设置VTP修解  

vlan基本配置

switch#vlan database                       进入vlan配置模式

switch(vlan)#vlan 号码 name 名称            创建vlan及vlan名

switch(vlan)#vlan 号码 mtu 数值             修改MTU大小 

switch(vlan)#exit                          更新vlan数据并退出

switch#show vlan                           查看vlan

switch#copy running-config startup-config       保存配置

vlan中添加删除端口

switch#conf t

switch(config)#interface fastethernet0/1        进入要分配的端口

switch(config-if)#switchport mode access        定义二层端口

switch(config-if)#switchport access vlan号码    把端口发给一个vlan

switch(config-if)#switchport mode trunk         设置为干线

switch(config-if)#switchport trunk encapsulation dotlq     设置vlan中继协议

switch(config-if)#no switchport mode 或 (switchport mode access)  禁用干线

switch(config-if)#switchport trunk allowed vlan add 1,2         从trunk中添加vlans

switch(config-if)#switchport trunk allowed vlan remove1,2       从trunk中删除vlan

switch(config-if)#switchport trunk pruning vlan remove1,2          

配置接口为动态协商模式

switch(config)#interface 接口号

switch(config)#switchport mode dynamic desirable/auto

生成树stp

switch(config)#spanning-tree vlan    启用stp生成树(基于vlan)

switch(config)#spanning-tree vlan root primary   指定交换机(基于vlan)

switch(config)#spanning-tree vlan root secondary   指定备用根交换机(基于vlan)

switch(config)#spanning-tree vlan priority<0-65535>  指定交换机优先继(基于vlan)

switch(config)#no spanning-tree vlan priority      将交换机的优先级恢复默认值(基于vlan)

switch(config-if)#spanning-tree vlan cost<0-200000000>   指定端口成本(起用trunk的端口模式下)

switch(config-if)#spanning-tree vlan port-prioty<0-255>    指定交换机端口优先级(基于vlan)

switch(config-if)#spanning-tree portfast    配置速端口(连接终端设备的端口状态)如pc机

switch(config)#spanning-tree uplinkfast   配置上行速端口
  • 注:在配置上行速端口前要先将基于vlan上的网桥优先级,网桥成本恢复默认值。起用了该命令后在进行优先级更改。
  • 注:vlan为可选参数,当没有该参数时将修改所有vlan网桥的优先级\及所有的vlan端口成本
switch#show spanning-tree summery        检测vlan生成树配置

switch#show spanning-tree vlan detail    浏览详细生成树配置信息

switch#show spanning-tree interface detail    浏览详细生成树端口配置信息

以太网通道配置

switch(config)#interface range fastemet0/1-2  将fastemet0/1和0/2口捆绑

switch(config-if)#change-group 1 mode on     配置以太通道模式

switch(config-if)#port-channel load-batance{dst-mac|src-mac}在链路间实现负载均衡

switch#show etherchannel 1 summary      查看通道信息

switch#show etherchannel load-balance    查看通道信息

交换机显示命令

switch#show vtp status  查看vtp配置信息 

switch#show running-config  查看当前配置信息

switch#show vlan     查看vlan配置信息

switch#show interface  查看端口信息

switch#show int f0/0  查看指定端口信息 

switch#dir flash:  查看闪存

switch#show version  查看当前版本信息

switch#show cdp cisco  设备发现协议(可以查看聆接设备)

switch#show cdp traffic  查看接收和发送的cdp包统计信息

switch#show interface f0/1 switchport  查看有关switchport的配置

switch#show cdp neighbors  查看与该设备相邻的cisco设备

CISCO交换机巡检命令

1、​​show interface stats​​ ;查看交换机所有接口当前接口流量

2、​​show running-config​​ ;查看当前设备配置

3、​​show version​​ ;查看IOS版本信息及设备正常运行时间

4、​​show clock​​ ;查看设备时钟信息

5、​​show vtp status​​ ;查看交换机vtp配置模式

6、​​show vtp password​​ ;查看交换机vtp配置口令

7、​​show env all​​ ;查看设备温度,电源和风扇运转参数及是否报警

8、​​show inventory​​ ;调取设备内部板卡出厂模块型号及序列号

9、​​show spanning-tree root​​ ;查看交换机生成树根位置

10、​​show cdp neighbors​​ ;查看邻接cisco设备基本信息

11、​​show cdp neighbors detail​​ ;查看邻接cisco设备详细信息

12、​​show interface status​​ ;查看交换机接口状态是否存在errordisable接口disable接口

13、show interface summary ;查看交换机所有接口当前接口流量

14、​​show interface | i errors|FastEthernet|GigabitEthernet​​ ;查看接口是否存在大量input或output errors包错误

15、​​show processes cpu​​ ;查看设备cpu负载

16、​​show processes mem​​ ;查看设备mem负载

17、​​show access-list​​ ;查看访问控制列表配置及匹配数据包数量

18、​​show logging​​ ;查看本机内部日志记录情况

19、​​show ip route​​ ;查看路由表

20、​​show firewall​​ ;检查防火墙的工作模式

21、​​show conn count​​ ;检查防火墙并发数

22、​​show xlate count​​ ;检查防火墙nat工作状态


 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐