思科交换机常用命令.docx
《思科交换机常用命令.docx》由会员分享,可在线阅读,更多相关《思科交换机常用命令.docx(33页珍藏版)》请在三一办公上搜索。
1、Cisco交换机命令大总结cisco交换机还是比较常用的,于是我研究了一下Cisco交换机命令的大总结,在这里 拿出来和大家分享一下,希望对大家有用。我所针对的都是Cisco的设备而言的,华为的可 以跟据手册来查,配置都是差不多的,这里华子就不多写华为的设备了,了解的也不是很多。Cisco交换机命令之使用Telnet远程式管理switch(config)#interface vlan 1 进入 vlan 1switch(config-if)#ip address 设置 IP 地址switch(config-if)#ip default-gateway 设置默认网关switch(config)#
2、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 接口swit
3、ch(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 保存当前配置 nvramswitch#erase startup-conf
4、ig 清除配置文件Cisco交换机命令之交换机VLAN设置: switch#vlan database 进入 VLAN 设置switch(vlan)#vlan 2 建 VLAN 2switch(vlan)#name 名字建 VLAN 2 的名称 switch(vlan)#no vlan 2 删 vlan 2注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止。 switch(config)#int f0/1 进入端口 1switch(config-if)#switchport mode access 当前端口工作莫试 switch(config-if)#switchport
5、 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-
6、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)
7、#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 cli
8、ent 设置 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-
9、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 的端口模式下)
10、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 修改转发延
11、迟计时器(基于 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-
12、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 neighbo
13、rs查看与该设备相邻的cisco设备switch#show interface f0/1 switchport 查看有关 switchport 的配置switch#show cdp neighbors查看与该设备相邻的cisco设备交换机口令设置:(我所针对的都是cisco的设备而言的,华为的可以跟据手册来查,配置都是差不多的, 这里华子就不多写华为的设备了,了解的也不是很多)switchenable进入特权模式switch#config terminal进入全局配置模式switch(config)#hostname设置交换机的主机名switch(config)#enable secret x
14、xx 设置特权加密口令switch(config)#enable password xxa 设置特权非密口令使用Telnet远程式管理switch(config)#interface vlan 1 进入 vlan 1switch(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#exi
15、t返回命令控制台口令switch(config)#line console 0 进入控制台口switch(config-line)#login 允许登录switch(config-line)#password xx 设置登录口令switch#exit返回命令基本接口配置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
16、 domain-name *.com 设置或名服务器switch(config)#mac-address-table aging-time 设置 mac 表超时时间switch#write保存配置信息switch#copy running-config startup-config 保存当前配置 nvramswitch#erase startup-config 清除配置文件交换机VLAN设置:switch#vlan database 进入 VLAN 设置switch(vlan)#vlan 2 建 VLAN 2switch(vlan)#name 名字建 VLAN 2 的名称switch(vlan
17、)#no vlan 2 册。vlan 2注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止switch(config)#int f0/1 进入端口 1switch(config-if)#switchport mode access 当前端口工作莫试switch(config-if)#switchport access vlan 2 当前端口加入 vlan 2switch(config-if)#switchport mode trunk 设置为干线switch(config-if)#switchport trunk encapsulation dot1q 设置 vlan 中
18、继协议switch(config-if)#no switchport mode 或(switchport mode access)禁用干 线switch(config-if)#switchport trunk allowed vlan add 1, 2 ;从 Trunk 中添加 vlansswitch(config-if)#switchport trunk allowed vlan remove 1 2 ;从 Trunk 中删 除 vlansswitch(config-if)#switchport trunk pruning vlan remove 1 2 ;从 Trunk 中关 闭局部修剪以
19、太网通道配置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 查看通道信息vtp配置swi
20、tch(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 prun
21、ing 关闭 vtp 修解注:要想从vtp中减少一台交换机只需将该交换机vtp名更改生成树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(co
22、nfig)#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 配置上
23、行速端口注:在配置上行速端口前要先将基于vlan上的网桥优先级,网桥成本恢复默认值。起 用了该命令后在进行优先级更改,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)注:vlan为可选参数,当没有该参数时将修改所有vlan网桥的优先级及所有的vlan 端口成本s
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 思科 交换机 常用命令

链接地址:https://www.31ppt.com/p-5287343.html