普通交换机常用配置命令?

交换机

  a、更改远程TELNNET密码
  Switch#configure terminal
  Switch(config)#line vty 0 4
  Switch(config-line)#password qycx123
  Switch(config-line)#login
  Switch(config-line)#exit
  b、更改进入全局配置模式时的密码
  Switch#configure terminal
  Switch(config)#enable secret qycx123
  思科交换机常用命令——创建并划分VLAN
  a、创建VLAN
  Switch#vlan database
  Switch(vlan)#vlan 99 name office (创建vlan 99 并命名为office)
  b、将端口划分至vlan
  Switch(config)#interface fastEthernet 0/8
  Switch(config-if)#switchport mode access
  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
  cisco交换机还是比较常用的,于是我研究了一下Cisco交换机命令的大总结,在这里拿出来和大家分享一下,希望对大家有用。我所针对的都是Cisco的设备而言的,华为的可以跟据手册来查,配置都是差不多的,这里华子就不多写华为的设备了,了解的也不是很多。
  Cisco交换机命令之使用Telnet远程式管理
  switch(config)#interface vlan 1 进入vlan 1
  switch(config-if)#ip address 设置IP地址
  switch(config-if)#ip default-gateway 设置默认网关
  switch(config)#line vty 0 4 进入虚拟终端
  switch(config-line)#login 允许登录
  switch(config-line)#password xx 设置登录口令
  switch#exit 返回命令
  Cisco交换机命令之控制台口令
  switch(config)#line console 0 进入控制台口
  switch(config-line)#login 允许登录
  switch(config-line)#password xx 设置登录口令
  switch#exit 返回命令
  Cisco交换机命令之基本接口配置
  switch(config)#interface f0/1 进入f0/1接口
  switch(config-if)#duplex full 配置全双工模式
  switch(config-if)#speed 100 配置速率
  switch(config-if)#description to ***** 接口描述
  switch(config)#ip domain-name ***.com 设置或名服务器
  switch(config)#mac-address-table aging-time 设置mac表超时时间
  switch#write 保存配置信息
  switch#copy running-config startup-config 保存当前配置nvram
  switch#erase startup-config 清除配置文件
  Cisco交换机命令之交换机VLAN设置:
  switch#vlan database 进入VLAN设置
  switch(vlan)#vlan 2 建VLAN 2
  switch(vlan)#name 名字 建VLAN 2的名称
  switch(vlan)#no vlan 2 删vlan 2
  注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止。
  switch(config)#int f0/1 进入端口1
  switch(config-if)#switchport mode access 当前端口工作莫试
  switch(config-if)#switchport access vlan 2 当前端口加入vlan 2
  switch(config-if)#switchport mode trunk 设置为干线
  switch(config-if)#switchport trunk encapsulation dot1q 设置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 remove 1,2 ;从Trunk中删除vlans
  switch(config-if)#switchport trunk pruning vlan remove 1,2 ;从Trunk中关闭局部修剪
  Cisco交换机命令之以太网通道配置
  switch(config)#interface range fasternet0/1 - 2 将fasternet0/1和0/2 口捆绑
  switch(config-if)#channel-group 1 mode on 配置以太通道模式
  switch(config-if)#port-channel load-balance {dst-mac | src-mac}在链路间实现负载均衡
  switch#show etherchannel 1 summary 查看通道信息
  switch#show etherchannel load-balance 查看通道信息
  Cisco交换机命令之vtp配置
  switch(config)#vtp domain 设置vtp域名
  switch(config)#vtp password 设置vtp密码
  switch(config)#vtp mode server 设置vtp服务器模式
  switch(config)#vtp mode client 设置vtp客户机模式
  switch(config)#vtp mode transparent 设置vtp 透明模式
  switch(config)#vtp version 设置vtp版本
  switch(config)#vtp pruning 启用vtp修解
  switch(config)#no vtp pruning 关闭vtp修解
  注:要想从vtp中减少一台交换机只需将该交换机vtp 名更改
  Cisco交换机命令之生成树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 指定交换机优先级(基于vlan)
  switch(config)#no spanning-tree vlan priority 将交换机的优先级恢复默认值(基于vlan)
  switch(config-if)#spanning-tree vlan cost 指定端口成本(起用trunk的端口模式下)
  switch(config-if)#spanning-tree vlan port-prioty 指定交换机端口优先级(基于vlan)
  switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机
  switch(config)#spanning-tree uplinkfast 配置上行速端口
  switch(config)#spanning-tree vlan hello-time 配置交换机hello时间(基于vlan)
  switch(config)#spanning-tree vlan forward-time 修改转发延迟计时器(基于vlan)
  switch(config)#spanning-tree vlan max-time 修改最大老化时间(基于vlan)
  switch#show spanning-tree summery 检测vlan生成树配置
  switch#show spanning-tree vlan detail 浏览详细生成树配置信息
  switch#show spanning-tree interface detail 浏览详细生成树端口配置信息
  Cisco交换机命令之交换机显示命令:
  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设备
温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2018-09-28
CISCO交换机基本配置:Console端口连接
用户模式hostname# ;
特权模式hostname(config)# ;
全局配置模式hostname(config-if)# ;

交换机口令设置:
switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname csico ;设置交换机的主机名
switch(config)#enable secret csico1 ;设置特权加密口令
switch(config)#enable password csico8 ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
switch(config-line)#login ;虚拟终端允许登录
switch(config-line)#password csico6 ;设置虚拟终端登录口令csico6
switch#exit ;返回命令
交换机VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:
switch#vlan database ;进入VLAN设置
switch(vlan)#vlan 2 ;建VLAN 2
switch(vlan)#vlan 3 name vlan3 ;建VLAN 3并命名为vlan3
switch(vlan)#no vlan 2 ;删vlan 2
switch(config)#int f0/1 ;进入端口1
switch(config)#speed ? 查看speed命令的子命令
switch(config)#speed 100 设置该端口速率为100mb/s (10/auto)
switch(config)#duplex ? 查看duplex的子命令
switch(config)#duplex full 设置该端口为全双工(auto/half)
switch(config)#description TO_PC1 这是该端口描述为TO_PC1
switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2
switch(config-if)#switchport mode trunk ;设置为trunk模式(access模式)
switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan
switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继
switch(config)#vtp domain vtpserver ;设置vtp域名相同
switch(config)#vtp password ;设置发vtp密码
switch(config)#vtp server ;设置vtp服务器模式
switch(config)#vtp client ;设置vtp客户机模式

交换机设置IP地址,默认网关,域名,域名服务器,配置和查看MAC地址表:
switch(config)#interface vlan 1 ;进入vlan 1
switch(config-if)#ip address 192.168.1.1 255.255.255.0 ;设置IP地址
switch(config)#ip default-gateway 192.168.1.6 ;设置默认网关
switch(config)#ip domain-name cisco.com 设置域名
switch(config)#ip name-server 192.168.1.18 设置域名服务器
switch(config)#mac-address-table? 查看mac-address-table的子命令
switch(config)#mac-address-table aging-time 100 设置超时时间为100ms
switch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3 加入永久地址在f0/3端口
switch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址目标端口f0/6源端口f0/7
switch(config)#end
switch#show mac-address-table 查看整个MAC地址表
switch#clear mac-address-table restricted static 清除限制性静态地址
交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch#show int f0/0 ;查看指定端口信息
switch#show int f0/0 status;查看指定端口状态
switch#dir flash: ;查看闪存本回答被网友采纳
第2个回答  2013-08-04
您好
七夜、家の云袭为您解答,望您采纳五星满意答案,勾上原创+能解决,谢谢
特权模式:enable
全局配置模式:config
以下配置都是在全局配置模式下进行:
创建Vlan:Vlan X
进入接口配置模式:int F0/1
配置VlanIP:Vlan X
ip address X.X.X.X X.X.X.X
第3个回答  2013-08-04
第一个回答的那个就挺详细的,算是普通操作吧。基本上包括第一次进机的配置,密码配置,创建vlan,对特定端口设定访问vlan,基本的就这些了,其他的比如show命令,这个有很多选项的,show running-config之类的查看工作状态和排错的也很多也重要。
第4个回答  2013-08-04
普通的交换机是不用配置的,只有支持VLAN的交换机才能配置啊!
相似回答