设为首页收藏本站language 语言切换
查看: 3288|回复: 8
收起左侧

[分享] 扫盲贴-cisco(思科)交换机配置篇【二】

[复制链接]
发表于 2017-12-8 20:10:08 | 显示全部楼层 |阅读模式
本帖最后由 goodluck 于 2017-12-8 20:11 编辑

上一篇给大家讲到了cisco交换机的基本操作命令,趁端午节放假前,把cisco交换机的简单配置分享一下并预祝一下各位“端午节快乐”!Ok,要进行交换机的配置,首先就得进入交换机的全局配置模式,在成功连接交换机并且登陆成功进入特权模式下
1、输入进入全局配置模式:
[plain] view plain copy


  • switch#configure terminal   
  • Enter configuration commands, one per line.  End with CNTL/Z.  
  • switch(config)#  
  • switch(config)#  
  • switch(config)#  

这么简单的一条命令,俺们就进入到全局配置模式了,还记得上一篇中查看端口所查询到的信息中name字段下的值吗?这字段其实代表的是交换机端口的描述信息
2、修改端口描述
[plain] view plain copy


  • switch#  
  • switch#  
  • switch#conf ter  
  • Enter configuration commands, one per line.  End with CNTL/Z.  
  • switch(config)#  
  • switch(config)#int fa0/3  
  • switch(config-if)#  
  • switch(config-if)#desc  
  • switch(config-if)#description updateDesc  
  • switch(config-if)#  
  • switch(config-if)#exit  
  • switch(config)#exit  
  • switch#  
  • switch#show inter  
  • switch#show interfaces statu  
  • switch#show interfaces status   
  •   
  • Port      Name               Status       Vlan       Duplex  Speed Type  
  • Fa0/1                        connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/2     h3c2.250           connected    trunk      a-full  a-100 10/100BaseTX  
  • Fa0/3     updateDesc         notconnect   1            auto   auto 10/100BaseTX  
  • Fa0/4                        connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/5     h3c-2.200          connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/6                        notconnect   1            auto   auto 10/100BaseTX  


修改描述的关键命令在于,在配置模式下,进入到要修改的端口下,然后使用description + “内容”!效果应该很直观了吧,接下来就是修改端口的所在Vlan了
3、修改端口Vlan
[plain] view plain copy


  • switch#  
  • switch#  
  • switch#conf t  
  • Enter configuration commands, one per line.  End with CNTL/Z.  
  • switch(config)#  
  • switch(config)#int fa0/3  
  • switch(config-if)#  
  • switch(config-if)#sw acc vl 2  
  • switch(config-if)#  
  • switch(config-if)#exit  
  • switch(config)#  
  • switch(config)#exit  
  • switch#  
  • switch#show inter statu  
  •   
  • Port      Name               Status       Vlan       Duplex  Speed Type  
  • Fa0/1                        connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/2     h3c2.250           connected    trunk      a-full  a-100 10/100BaseTX  
  • Fa0/3     updateDesc         notconnect   2            auto   auto 10/100BaseTX  
  • Fa0/4                        connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/5     h3c-2.200          connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/6                        notconnect   1            auto   auto 10/100BaseTX  


逻辑和修改端口描述是一样的,对于配置来说,肯定是到了能有配置权限的地方和要配置的对象,这里修改端口Vlan的关键命令为:sw acc vl + vlantag,命令很明显被简写了,但是不影响执行,命令的全写为:switchport access vlan + vlantag
还有一些对端口的简单操作,譬如修改端口的模式,
4、修改端口模式
[plain] view plain copy


  • switch(config-if)#switchport trunk encap dot1q ----------------设置vlan 中继的封装协议  
  • 注:dot1q就是 IEEE 802.1Q协议,是vlan的一种封装方式,是公有协议。还有一种trunk协议,是ISL,也是vlan的一种封装方式,不过这是Cisco思科私有协议,其他厂商不能用。  
  • switch(config-if)#switchport mode trunk ------------------------设置端口类型为trunk  
  • switch(config-if)#switchport trunk allowed vlan 1,2 ---------设置允许的vlan,默认不用配置,为所有vlan  
  • switch(config-if)#switchport trun native vlan 999 ---------------设置trunk口的native vlan  


5、端口状态[plain] view plain copy


  • switch(config)#  
  • switch(config)#int fa0/3  
  • switch(config-if)#  
  • switch(config-if)#  
  • switch(config-if)#sw acc vl 1  
  • switch(config-if)#  
  • switch(config-if)#  
  • switch(config-if)#shutd     
  • switch(config-if)#shutdown   
  • switch(config-if)#      
  • switch(config-if)#exit  
  • switch(config)#  
  • switch(config)#exit  
  • switch#  
  • switch#show inter statu  
  •   
  • Port      Name               Status       Vlan       Duplex  Speed Type  
  • Fa0/1                        connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/2     h3c2.250           connected    trunk      a-full  a-100 10/100BaseTX  
  • Fa0/3     updateDesc         disabled     1            auto   auto 10/100BaseTX  
  • Fa0/4                        connected    1          a-full  a-100 10/100BaseTX  


上面的一系列为切换Vlan,并且shutdown端口,这时候大家可能看到了交换机3号端口的状态已变成disable了,如果我们要启用端口只需[plain] view plain copy


  • switch#conf t  
  • Enter configuration commands, one per line.  End with CNTL/Z.  
  • switch(config)#  
  • switch(config)#int fa0/3  
  • switch(config-if)#  
  • switch(config-if)#no shut  
  • switch(config-if)#no shutdown   
  • switch(config-if)#  
  • switch(config-if)#exit  
  • switch(config)#  
  • switch(config)#exit  
  • switch#  
  • switch#show inter statu  
  •   
  • Port      Name               Status       Vlan       Duplex  Speed Type  
  • Fa0/1                        connected    1          a-full  a-100 10/100BaseTX  
  • Fa0/2     h3c2.250           connected    trunk      a-full  a-100 10/100BaseTX  
  • Fa0/3     updateDesc         notconnect   1            auto   auto 10/100BaseTX  
  • Fa0/4                        connected    1          a-full  a-100 10/100BaseTX  


今天就到这里了,有时间再来和大家分享一下在工作上需要的并且对自己很有用的东西和知识!敬请期待下一篇——对交换机登录的一些设置
发表于 2017-12-8 21:53:35 | 显示全部楼层
感谢楼主分享
沙发 2017-12-8 21:53:35 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2017-12-8 22:04:42 | 显示全部楼层
感谢楼主分享
板凳 2017-12-8 22:04:42 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2017-12-8 22:33:12 | 显示全部楼层
好好理会、好好体验,大伙共同进步哈
地板 2017-12-8 22:33:12 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2017-12-9 10:43:44 | 显示全部楼层
感谢楼主分享!
5# 2017-12-9 10:43:44 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2020-1-16 13:55:49 | 显示全部楼层
顶顶顶顶顶顶顶顶顶的
7# 2020-1-16 13:55:49 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2020-7-15 13:10:25 | 显示全部楼层
感谢楼主的分享
8# 2020-7-15 13:10:25 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-5-8 18:55 , Processed in 0.095424 second(s), 22 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表