路由交换知识(思科)————思科命令总结

举报
刘磊 发表于 2019/07/08 09:27:40 2019/07/08
【摘要】 实验口令详解

思科交换机常用命令总结

a、更改远程TELNNET密码

  1. Switch#configure terminal  

  2.  

  3. Switch(config)#line vty 0 4  

  4.  

  5. Switch(config-line)#password qycx123  

  6.  

  7. Switch(config-line)#login  

  8.  

  9. Switch(config-line)#exit 

b、更改进入全局配置模式时的密码

  1. Switch#configure terminal  

  2.  

  3. Switch(config)#enable secret qycx123 

思科交换机常用命令——创建并划分VLAN

a、创建VLAN

  1. Switch#vlan database  

  2.  

  3. Switch(vlan)#vlan 99 name office 

(创建vlan 99 并命名为office)

b、将端口划分至vlan

  1. Switch(config)#interface fastEthernet 0/8  

  2.  

  3. Switch(config-if)#switchport mode access  

  4.  

  5. Switch(config-if)#switchport access vlan 99 

(将8号快速以太口划分至vlan 99)

思科交换机常用命令——调试命令

a、显示所有配置命令:Switch#show run

b、显示所有接口状态:Switch#show ip int brief

c、显示所有VLAN的信息:Switch#show vlan brief

switch>enable 进入特权模式

  switch#config terminal 进入全局配置模式

  switchconfig#hostname 设置交换机的主机名

  switchconfig#enable secret xxx 设置特权加密口令

  switchconfig#enable password xxa 设置特权非密口令

  使用Telnet远程式管理

  switchconfig#interface vlan 1 进入vlan 1

  switchconfig-if#ip address 设置IP地址

  switchconfig-if#ip default-gateway 设置默认网关

  switchconfig#line vty 0 4 进入虚拟终端

  switchconfig-line#login 允许登录

  switchconfig-line#password xx 设置登录口令

  switch#exit 返回命令

  控制台口令

  switchconfig#line console 0 进入控制台口

  switchconfig-line#login 允许登录

  switchconfig-line#password xx 设置登录口令

  switch#exit 返回命令

  基本接口配置

  switchconfig#interface f0/1 进入f0/1接口

  switchconfig-if#duplex full 配置全双工模式

  switchconfig-if#speed 100 配置速率

  switchconfig-if#description to ***** 接口描述

  switchconfig#ip domain-name ***.com 设置或名服务器

  switchconfig#mac-address-table aging-time 设置mac表超时时间

  switch#write 保存配置信息

  switch#copy running-config startup-config 保存当前配置nvram

  switch#erase startup-config 清除配置文件

  交换机VLAN设置:

  switch#vlan database 进入VLAN设置

  switchvlan#vlan 2 VLAN 2

  switchvlan#name 名字 建VLAN 2的名称

  switchvlan#no vlan 2 vlan 2

  注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止

  switchconfig#int f0/1 进入端口1

  switchconfig-if#switchport mode access 当前端口工作莫试

  switchconfig-if#switchport access vlan 2 当前端口加入vlan 2

  switchconfig-if#switchport mode trunk 设置为干线

  switchconfig-if#switchport trunk encapsulation dot1q 设置vlan 中继协议

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

  switchconfig-if#switchport trunk allowed vlan add 1;从Trunk中添加vlans

  switchconfig-if#switchport trunk allowed vlan remove 1;从Trunk中删除vlans

  switchconfig-if#switchport trunk pruning vlan remove 1;从Trunk中关闭局部修剪

  以太网通道配置

  switchconfig#interface range fasternet0/1 - 2 fasternet0/10/2 口*** (成双不成单)

  switchconfig-if#channel-group 1 mode on 配置以太通道模式

  switchconfig-if#port-channel load-balance {dst-mac | src-mac}在链路间实现负载均衡

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

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

  vtp配置

  switchconfig#vtp domain 设置vtp域名

  switchconfig#vtp password 设置vtp密码

  switchconfig#vtp mode server 设置vtp服务器模式

  switchconfig#vtp mode client 设置vtp客户机模式

  switchconfig#vtp mode transparent 设置vtp 透明模式

  switchconfig#vtp version 设置vtp版本

  switchconfig#vtp pruning 启用vtp修解

  switchconfig#no vtp pruning 关闭vtp修解

  注:要想从vtp中减少一台交换机只需将该交换机vtp 名更改

  生成树stp

  switchconfig#spanning-tree vlan 启用stp生成树(基于vlan

  switchconfig#spanning-tree vlan root primary 指定根交换机(基于vlan

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

  switchconfig#spanning-tree vlan priority 指定交换机优先级(基于vlan

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

  switchconfig-if#spanning-tree vlan cost 指定端口成本(起用trunk的端口模式下)

  switchconfig-if#spanning-tree vlan port-prioty 指定交换机端口优先级(基于vlan

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

  switchconfig#spanning-tree uplinkfast 配置上行速端口

  注:在配置上行速端口前要先将基于vlan上的网桥优先级,网桥成本恢复默认值。起用了该命令后在进行优先级更改,

  switchconfig#spanning-tree vlan hello-time 配置交换机hello时间(基于vlan

  switchconfig#spanning-tree vlan forward-time 修改转发延迟计时器(基于vlan

  switchconfig#spanning-tree vlan max-time 修改最大老化时间(基于vlan

  注:vlan为可选参数,当没有该参数时将修改所有vlan网桥的优先级及所有的vlan端口成本

  switch#show spanning-tree summery 检测vlan生成树配置

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

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

  交换机显示命令:

  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 mac-address-table aging-time 查看mac超时时间

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

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

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

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

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

高度总结:

 一切配置看show----

所有端口故障看端口和协议

记得要注意顺序,配置的时候都要有一个逻辑顺序




【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。