思科交换机的基本配置(思科交换机配置命令总结)

思科交换机基本配置命令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 阻止会话退出 ,下面我们就来聊聊关于思科交换机的基本配置?接下来我们就一起去了解一下吧!

思科交换机的基本配置(思科交换机配置命令总结)

思科交换机的基本配置

思科交换机基本配置命令

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设备

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页