交换机命令

模式切换指令

enable   进入特权模式(一般简写为en)

config t    进入全局配置模式

interface fa 0/1    进入交换机某个端口视图模式

exit    返回到上级模式

end    从全局以下模式返回到特权模式

快捷指令

帮助信息(如? 、co?、copy?)

命令简写(如 en 的完整命令为 enable)

命令自动补全(Tab)

快捷键(ctrl+c中断测试,ctrl+z退回到特权视图)

扫描二维码关注公众号,回复: 1158243 查看本文章

reload   重启(在特权模式下)

hostname    X修改交换机名称(在全局配置模式下)

端口配置指令

Switch(config-if)#speed [10/100/auto]    设置端口通信速度

 Switch(config-if)#duplex [half/full/auto]    设置端口单双工模式

 

show version    查看交换机版本信息

show running-config   查看当前生效的配置信息

show startup-config    查看保存在NVRAM中的启动配置信息

show interface   查看端口信息

show mac-address-table   //显示交换机mac地址

switchport mode access   //把接口配置为接入模式

switchport port-security maximum 1 //该端口只能有一个连接

switchport port-security violation shutdown  //如果违反交换机端口安全设置条件此端口不可用

spanning-tree vlan 1 priority 4096  //指定优先级

int range f0/1 - 12 //批量范围修改接口

spanning-tree portfast //不进行50秒stp会聚

show port-security interface  //查看设置了端口安全的接口

spanning-tree bpduguard enable //在启用portfast的接口启用bpduguard

spanning-tree bpdufilter enable //在启用portfast的接口启用bpdufilter

注意,对于bpduguard 和bpdufilter 命令,典型的做法是只使用其中的一个,尽管IOS 也允许在同一个接口同时使用两个命令,但这两个命令本质上会产生一定的对抗。bpdufilter 接收BPDU后会将端口转换到非p。此Fast 状态,而bpduguard 接收BPDU 后会将端口置为出错禁用状态

spanning-tree uplinkfast  //设置unlinkfast

show spanning-tree uplinkfast //显示设置unlinkfast的接口

spanning-tr曾backbonefast //设置backbonefast

show spanning-tree backbonefast //显示设置backbonefast的接口

int port-channel 1 //配置负载

show int fa0/l etherchannel

mac-address-table static aaaa.bbbb.cccc vlan 1 int fa0/5 //静态指定mac地址列表

spanning-tree vlan 1 root primary //设置为根桥

猜你喜欢

转载自liuna718-163-com.iteye.com/blog/2109452