思科2960交换机配置命令_第1页
思科2960交换机配置命令_第2页
思科2960交换机配置命令_第3页
思科2960交换机配置命令_第4页
思科2960交换机配置命令_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、交换机基本状态:switch: ;ROM状态,路由器是rommon>hostname>;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname xxx;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令-设置进入en特权模式的口令switch(config)#enable p

2、assword xxa ;设置特权非密口令enable secret 乱码显示enable password 明文显示设置完后用show run可以看出当特权非加密口令和特权加密口令同时设置时,enable secret的级别 高于 enable password ,也即此时 enable password自动失去效用,只有enable secret 起作用,在没有设置secret口令时,非加密口令才有效。switch(config)#line console 0 ;进入控制台口line console 0 可以设置控制台的一些状态,比如在line console 0可以设置exec-time

3、out和logging synchronous,前者可以设置不输入命令多长时间系统弹出,而后一个命令则可以设置在输入命令时不会被系统日志消息打断。Switch(config-line)#password 123456      设置telnet时的登陆密码Switch(config-line)#login                  

4、0;  使登陆密码生效Switch(config-line)#Ctrl+Z          退出到特权模式switch(config-line)#line vty 0 4 ;进入虚拟终端 0和4为VTP接口的编号,0代表0号,4代表4号vty 0 4表示下面是对VTY的0到4号端口(即0号、1号、2号、3号、4号)进行配置 vty线路指的是我们进行telnet的时候使用的线路。这里的0 4 指的是对从第一个telnet的到第五个telnet线路进行设置,因此同时进入虚拟终端

5、的人数 0 4代表5个人 0 3 代表4个人 以此类推。line vty 0 0是只启用一个telnet会话的意思,也就是说只能有一个人进行telnet。telnet密码虽然配置成功了,可是一想,IP还没配置啊,telnet登陆谁呢?!  所以这个时候需要开启交换机的管理vlan,给管理vlan配置Ip,一般交换机都有初始的默认vlan1,用他来做管理vlan吧【说说管理vlan的作用:管理VLAN是指设备的IP地址所在的VLAN ,主要用来远程连接这个设备进行管理使用  如果不配置这个,你将无法通过网络管理这台设备,业务VLAN就是普通的接台

6、式机的VLAN, 接业务使用.】,下面配置二层交换机的管理vlan的Ip:switch#conf t            特权模式进入配置模式Enter configuration commands, one per line.  End with CNTL/Z.switch(config)#int vlan 1   

7、;      进入vlan1虚拟口switch(config-if)#ip add    给vlan1设置IP地址switch(config)#ip default-gateway 54 设置switch的网关(为了提供从交换机连接到其它设备的路由)switch(config-if)#no shutdown        &

8、#160;vlan1%LINK-5-CHANGED: Interface Vlan1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to upswitch(config-if)#Z           

9、60;由配置模式推出到特权模式;%SYS-5-CONFIG_I: Configured from console by consoleswitch#cop r s                   保存配置文件;交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建V

10、LAN 2 switch(vlan)#no vlan 2 ;删vlan 2 switch(config)#int f0/1 ;进入端口1 switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2 switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(c

11、onfig)#vtp domain ;设置发vtp域名switch(config)#vtp password ;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1 switch(config-if)#ip address ;设置IP地址switch(config)#ip default-gateway ;设置默认网关switch#dir flash: ;查看闪存交换机显

12、示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show int (interface);查看端口信息(详细)switch#show int f0/1详细;show inter fa0/1 status简明 -查看指定端口信息                 

13、;                交换机命令总结基本配置命令Switch >enable       进入特权模式Switch #config terminal         进入全局配置模式Switch (config)#hostname     &

14、#160;  设置交换机的主机名Switch(config)#enable password          进入特权模式的密码(明文形式保存)Switch(config)#enable secret             加密密码(加密形式保存)(优先)Switch(config)#ip default-gateway      配

15、置交换机网关Switch(config)#show mac-address-table            查看MAC地址Switch(config)logging synchronous                     阻止控制台信息覆盖命令行上的输入Switch(config

16、)no ip domain-lookup                                      关闭DNS查找功能Switch(config)exec-timeout 0 0   

17、                                                   

18、;   阻止会话退出 使用Telnet远程式管理Switch (config)#line vty 0 4    进入虚拟终端Switch (config-line)# password     设置登录口令Switch (config-line)# login    要求口令验证 控制台口令switch(config)#line console 0    进入控制台口switch(config-line)# password xx

19、60;   switch(config-line)# 设置登录口令login    允许登录<!-if !supportLineBreakNewLine-><!-endif->Cisco发现协议(CDP)Switch(config)#show cdp                       

20、            显示Cisco设备全局配置信息Switch(config)#show cdp interface 端口            查看CDP配置下端口信息Switch(config)#show cdp neighbors           

21、;        显示直连Cisco设备信息 Switch(config)#show cdp neighbors detail       查看邻居详细信息 <!-if !supportLineBreakNewLine-><!-endif->恢复出厂配置Switch(config)#erase startup-configSwitch(config)delete vlan.dat配置接口标识  

22、0;  接口标识用于区分路由器的各个接口。switch(config)#interface fastethernet 0/1       以0/1 接口为例switch(config-if)#shutdown -关闭端口switch(config-if)#no shutdown -开启端口switch(config)# description this is a fast Ethernet port used to connecting the companys intranet!   

23、;    Vtp配置switch(config)#vtp domain        设置vtp域名switch(config)#vtp password       设置vtp密码switch(config)#vtp mode server /client/transparent  设置vtp服务器模式switch(config)#vtp version     

24、   设置vtp版本switch(config)#vtp pruning         启用vtp修解注:要想从vtp中减少一台交换机只需将该交换机vtp 域名更改Vlan基本配置  Switch#vlan database                      

25、                          进去vlan配置模式  Switch(vlan)#vlan 号码 name 名称                 &#

26、160;       创建vlan及vlan名  Switch(vlan)#vlan号码 mtu数值                             修改MTU大小  Switch(vlan)#exit  

27、60;                                                  &#

28、160;更新vlan数据并推出  Switch#show vlan                                           

29、0;         查看验证  Switch#copy running-config startup-config             保存配置到交换机里Switch#copy running-config tftp 保存配置到电脑里  叫NO 删除VLAN VLAN 中添加删除端口  Switch#config terminal  

30、;                                          进入全局配置   Switch(config)#interface f0/1

31、0; g0/1             进入要分配的端口   Switch(config-if)#Switchport mode access             定义二层端口   Switch(config-if)#Switchport acces vlan 号    &#

32、160;       把端口分给一个vlanSwitch(config-if)#switchport mode trunk    设置为干线Switch(config-if)#switchport trunk encapsulation dot1q    设置vlan 中继协议Switch(config-if)#no switchport mode 或 ( switchport mode access)    禁用干线Switch(config-

33、if)#switchport trunk allowed vlan add 1,2  从Trunk中添加vlansSwitch(config-if)#switchport trunk allowed vlan remove 1,2 从Trunk中删除vlanSwitch(config-if)#switchport trunk pruning vlan remove 1,2 ;从Trunk中关闭局部修剪 查看vlan信息 Switch#show vlan brief         &#

34、160;    所有vlan信息 查看vlan信息 Switch#show vlan id     某个vlan信息 注:Switch#show int trunk 查看trunk协议注:可以使用default interface interface-id               还原接口到默认配置状态     &

35、#160;       Trunk  开启(no)          将端口设置为永久中继模式  关闭(off)         将端口设置为永久非中继模式, 并且将链路转变为非中继链路  企望(desirable)让端口主动试图将链路转换成中继链路  自动(auto)    &

36、#160;  使该端口愿意将链路变成中继链路     配置接口为动态协商模式       Switch(config)#interface 接口号       Switch(config)#switchport mode dynamic  desirable/auto 生成树stp:Switch(config)#spanning-tree vlan <vlan-list>  

37、  启用stp生成树(基于vlan)Switch(config)#spanning-tree vlan <vlan-list> root primary    指定根交换机(基于vlan)Switch(config)#spanning-tree vlan <vlan-list> root secondary    指定备用根交换机(基于vlan)Switch(config)#spanning-tree vlan <vlan-list> priority <0-65535>指定交

38、换机优先级(基于vlan)Switch(config)#no spanning-tree vlan <vlan-list> priority    将交换机的优先级恢复默认值(基于vlan)Switch(config-if)#spanning-tree vlan <vlan-list> cost <0-200000000>指定端口成本(起用trunk的端口模式下)Switch(config-if)#spanning-tree vlan <vlan-list> port-prioty <0-255>指定交换

39、机端口优先级(基于vlan)Switch(config-if)#spanning-tree portfast    配置速端口(连接终端设备的端口状态)如pc机Switch(config)#spanning-tree uplinkfast    配置上行速端口注:在配置上行速端口前要先将基于vlan上的网桥优先级,网桥成本恢复默认值。起用了该命令后在进行优先级更改,注:vlan为可选参数,当没有该参数时将修改所有vlan网桥的优先级及所有的vlan端口成本Switch#show spanning-tree summery &

40、#160;  检测vlan生成树配置Switch#show spanning-tree vlan <vlan-id> detail    浏览详细生成树配置信息Switch#show spanning-tree interface <int-id> detail    浏览详细生成树端口配置信息以太网通道配置switch(config)#interface range fasternet0/1 - 2    将fasternet0/1和0/2 口捆绑switch(conf

41、ig-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    查看通道信息交换机显示命令:switch#show vtp status

42、60;   查看vtp配置信息switch#show running-config    查看当前配置信息 -包括本机IP、登录密码、vlan所属switch#show vlan    查看vlan配置信息switch#show interface    查看端口信息switch#show int f0/0    查看指定端口信息switch#dir flash:    查看闪存switch#show version 

43、;   查看当前版本信息switch#show cdp    cisco设备发现协议  (可以查看聆接设备)switch#show cdp traffic    杳看接收和发送的cdp包统计信息switch#show cdp neighbors    查看与该设备相邻的cisco设备switch#show interface f0/1 switchport          &

44、#160;                         查看有关switchport的配置switch#show cdp neighbors                              查看与该设备相邻的cisco设备怎么一次打开交换机全部端口进入配置模式(config),interface range F0/1 - 24(range表示命令用来绑定一组端口,并进入端口

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论