思科2960交换机配置命令

上传人:daj****de2 文档编号:183545087 上传时间:2023-01-30 格式:DOCX 页数:8 大小:25.88KB
收藏 版权申诉 举报 下载
思科2960交换机配置命令_第1页
第1页 / 共8页
思科2960交换机配置命令_第2页
第2页 / 共8页
思科2960交换机配置命令_第3页
第3页 / 共8页
资源描述:

《思科2960交换机配置命令》由会员分享,可在线阅读,更多相关《思科2960交换机配置命令(8页珍藏版)》请在装配图网上搜索。

1、父换机基本状态:switch: ; ROM状态,路由 器是 romm onhost name;用户模式host name# ;特权模式host name(c on fig)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switchenable ;进入特权模式switch#c on fig termi nal ;进入全局配置模式switch(config)#hostname xxx;设置交换机的主机名 switch(config)#enable secret xxx ;设置特权加密口令设置进入en特权模式的口令 switch(config)#enable

2、password xxa;设置特权非密口令enable secret 舌L码显示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-timeou

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

4、线路指的是我们进行telnet的时候使用的线路。这里的0 4指的是对从第一个telnet的到第五个telnet线 路进行设置,因此同时进入虚拟终端的人数 0 4代表5个人 0 3 代表4个人以此类推。line vty 0 0 是只启用一个 telnet 会话的意思,也就是说只能有一个人进行 telnet。telnet密码虽然配置成功了,可是一想,IP还没配置啊,telnet登陆谁呢? ! 所以这个时候需 要开启交换机的管理vlan,给管理vlan配置Ip,一般交换机都有初始的默认vlanl,用他来做管理 vlan吧【说说管理vlan的作用:管理VLAN是指设备的IP地址所在的VLAN,主要用来

5、远程连接这个 设备进行管理使用 如果不配置这个,你将无法通过网络管理这台设备,业务VLAN就是普通的接台式 机的VLAN,接业务使用 】,下面配置二层交换机的管理vlan的Ip:switch#conf t特权模式进入配置模式Enter configuration commands, one per line. End with CNTL/Z.switch(config)#int vlan 1进入 vlanl 虚拟口switch(config-if)#ip add 192.168. 99.1 255.255.255.0 给 vlan1 设置 IP 地址switch(config)#ip defa

6、ult-gateway 192.168. 99.254设置switch的网关(为了提供从交换机连接到其它设备的 路由)switch(config-if)#no shutdownvlan1%LINK-5-CHANGED: Interface Vlan1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Int erface Vlan1, changed state to upswi tch(config-if)#Z由配置模式推出到特权模式;%SYS-5-CONFIG_I: Configured from console by co

7、nsole switch#cop r s保存配置文件;交换机VLAN设置:switch#vlan database ;进入 VLAN 设置switch(vlan)#vlan 2 ;建 VLAN 2switch(vlan)#no vlan 2 ;删 vlan 2switch(co nfig)#i nt f0/1 ;进入端口 1switch(config-if)#switchport access vlan 2 ; 当前端口加入 vlan 2 switch(config-if)#switchport mode trunk ; 设置为干线switch(config-if)#switchport tr

8、unk allowed vlan 1, 2 ; 设置允许的 vlanswitch(config-if)#switchport trunk encap dot1q ; 设置 vlan 中继 switch(config)#vtp domain ; 设置发 vtp 域名 switch(config)#vtp password ; 设置发 vtp 密码 switch(config)#vtp mode server ; 设置发 vtp 模式 switch(config)#vtp mode client ; 设置发 vtp 模式交换机设置IP地址:switch(c on fig)# in terface

9、vla n 1 ; 进入 vla n 1switch(config-if)#ip address ; 设置 IP 地址switch(config)#ip default-gateway ;设置默认网关 switch#dir flash:;查看闪存交换机显示命令:switch#write;保存配置信息 switch#showvtp;查看vtp配置信息 switch#show run ;查看当前配置信息 switch#showvlan;查看 vian 配置信息 switch#showint (interface );査看端口信息(详细) switch#showint fO/1 详细;show in

10、ter faO/1 status 简明査看指定端口信息交换机命令总结基本配置命令Switch enable 进入特权模式Switch #config terminal 进入全局配置模式Switch (config)#hostname设置交换机的主机名Switch(config)#enable passwordSwitch(config)#enable secret Switch(config)#ip default-gateway进入特权模式的密码(明文形式保存)加密密码(加密形式保存)(优先)配置交换机网关查看 MAC 地址阻止控制台信息覆盖命令行上的输入关闭DNS查找功能阻止会话退出Swi

11、tch(config)#show mac-address-table Switch(config)logging synchronous Switch(config)no ip domain-lookup Switch(config)exec-timeout 0 0使用Telnet远程式管理Switch (config)#line vty 0 4 进入虚拟终端Switch (config-line)# password 设置登录口令Switch (config-line)# login 要求口令验证 控制台口令switch(config)#line console 0 进入控制台口 switc

12、h(config-line)# password xx switch(config-line)# 设置登录口令 login 允许登录显示Cisco设备全局配置信息 查看 CDP 配置下端口信息显示直连 Cisco 设备信息 查看邻居详细信息Cisco发现协议(CDP)Switch(config)#show cdpSwitch(config)#show cdp interface 端口Switch(config)#show cdp neighborsSwitch(config)#show cdp neighbors detail 恢复出厂配置Switch(config)#erase startu

13、p-configSwitch(config)delete vlan.dat配置接口标识 接口标识用于区分路由器的各个接口。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!Vtp 配置switch(config)#vtp d

14、omain设置 vtp 域名switch(config)#vtp password设置 vtp 密码switch(config)#vtp mode server /client/transparent 设置 vtp 服务器模式 switch(config)#vtp version设置 vtp 版本switch(config)#vtp pruning启用 vtp 修解注:要想从vtp中减少一台交换机只需将该交换机vtp域名更改Vlan 基本配置Switch#vlan database进去 vlan 配置模式Switch(vlan)#vlan 号码 name 名称创建 vlan 及 vlan 名S

15、witch(vlan)#vlan号码mtu数值修改MTU大小Switch(vlan)#exit更新 vlan 数据并推出Switch#showvla n查看 验证Switch#copy running-config startup-config保存配置到交换机里Switch#copy running-configtftp 保存配置到电脑里叫NO删除VLANVLAN 中添加删除端口Switch#config terminal进入全局配置Switch(config)#interface fO/1gO/1进入要分配的端口Switch(c on fig-if)#Switchportmode acces

16、s定义二层端口Switch(config-if)#Switchportaccesvlan 号把端口分给一个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-if)#switchport trunk allowed vlan add 1,2 从 Trun

17、k 中添加 vlansSwitch(config-if)#switchport trunk allowed vlan remove 1,2 从 Trunk 中删除 vlanSwitch(config-if)#switchport trunk pruning vlan remove 1,2 ;从 Trunk 中关闭局部修剪查看 vlan 信息 Switch#showvlan brief所有 vlan 信息查看 vlan 信息 Switch#showvlan id 某个 vlan 信息还原接口到默认配置状态注:Switch#showint trunk 查看 trunk 协议 注:可以使用 defa

18、ult interface interface-idTrunk开启(no)将端口设置为永久中继模式关闭( off)将端口设置为永久非中继模式, 并且将链路转变为非中继链路企望(desirable) 一让端口主动试图将链路转换成中继链路自动(auto)使该端口愿意将链路变成中继链路配置接口为动态协商模式Switch(config)#interface 接口号Switch(config)#switchport mode dynamic desirable/auto生成树 stp:Switch(config)#spanning-tree vlanSwitch(config)#spanning-tre

19、e vlanSwitch(config)#spanning-tree vlanSwitch(config)#spanning-tree vlan启用stp生成树(基于vlan)root primary 指定根交换机(基于 vlan)root secondary 指定备用根交换机(基于 vlan) priority 指定交换机优先级(基于 vlan)Switch(config)#no spanning-tree vlan priority 将交换机的优先级恢复默认值(基于 vlan) Switch(config-if)#spanning-tree vlan cost 指定端口成本(起用 trun

20、k 的端口模 式下)Switch(config-if)#spanning-tree vlanvvlan-list port-priotyv0-255指定交换机端口优先级(基于 vlan) Switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机Switch(config)#spanning-tree uplinkfast 配置上行速端口 注:在配置上行速端口前要先将基于 vlan 上的网桥优先级,网桥成本恢复默认值。起用了该命令后在进行优先级更改 注:vlan为可选参数,当没有该参数时将修改所有vlan网桥的优先级及所有的v

21、lan端口成本Switch#show spanning-tree summery 检测 vlan 生成树配置Switch#show spanning-tree vlanvvlan-id detail 浏览详细生成树配置信息Switch#show spanning-tree interface vint-id detail 浏览详细生成树端口配置信息 以太网通道配置switch(config)#interface range fasternetO/1 - 2将 fasternetO/1 和 0/2 口捆绑switch(config-if)#channel-group 1 mode on 配置以太

22、通道模式switch(config-if)#port-channel load-balanee dst-mac | src-mac在链路间实现负载均衡 switch#showetherchannel 1 summary 查看通道信息 switch#showetherchannel load-balance 查看通道信息 交换机显示命令:switch#showvtp status查看 vtp 配置信息switch#show running-config查看当前配置信息一-包括本机IP、登录密码、vlan所属switch#showvlan查看 vlan 配置信息switch#show interf

23、ace 查看端口信息switch#showint f0/0 查看指定端口信息 switch#dir flash: 查看闪存switch#show version 查看当前版本信息 switch#showcdp cisco 设备发现协议 (可以查看聆接设备) switch#showcdp traffic 杳看接收和发送的 cdp 包统计信息 switch#showcdp neighbors 查看与该设备相邻的 cisco 设备 switch#show interface f0/1 switchport 查看有关 switchport 的配置 switch#showcdp neighbors 查看

24、与该设备相邻的 cisco 设备怎么一次打开交换机全部端口进入配置模式(config) ,interface range FO/1 - 24 (range表示命令用来绑定一组端口,并进入端口批量配 置视图)no shutdown 即可!如何更改交换机的双工模式:NO.1进入config模式,进入端口配置状态interface f0/1N0.2 speed 10/100/1000/auto/ 设置端口速率N0.3 设置全双工或半双工 duplex full/half/autoN0.4 end 退出SW1(config)#interface fa0/1SW1(config-if)#speed 10

25、 | 100 | auto/10M/100M/ 自适应SW1(config-if)#duplex auto | full | half /自适应/全双工/半双工show ipintbri可以很快査看到端口的启用状态,很简洁的命令 査看交换机哪个端口故障及原因:switch#showint status err-disable7427.ea28.e51csh mac- dyint f0/6 (二层交换机)-dy 显示第6个口的mac address与所属vlan接口产生err -disable的原因可以由以下的命令来査看,系统缺省的配置是所有列出的原因都能导致接口被置为 err-disable(

26、下图所示)命令:sw1#show errdisable detect|sw3-iH02#shciw errdisable detect1E!? isaJs le Re asonDetectian statusudldEmafeiedJjExduguardEnaJj ledec ur itio latioEnabledchannel-niscorif isrEnnhLcdpsecuiB-y ial-atioriiEmahledvmpsEnohLcd口 pbaclEmahledunicast-f lucidEnnhLcdpagjp-FlapEnableddtpf LapEn-aHcdlixiik-

27、Flajp!Emaibledifp-canf isf-nianijatEmahlcd(jblc-iJnuaLldEmabledidltcpr-at c lin itEn-aHcdtopn-co n tro 1Emaibledc o mmun it -lin i七Emahlcdinyalld-pollcyEnabledn i.Q 彳 一HO fl1关闭 LINK-FLAPSwvconfig#no errdisable detect cause link-flap具体由什么原因导致当前接口 err-disable可以由show interface status err-disable来査看:(下图

28、所示)s l -1 02int statueis ah lePortNanieStatusFa0/1ervdisahledlinkflapSW3-1-02U在缺省配置下,若接口被置为err-disable,IOS将不会试图恢复接口。可以由show errdisable recovery来查看,timer status下面所有的值都是disable。下面的示例中,由于手工配置了 link-flap恢复(命令为:SW#errdisable recovery cause Link-flap),所以 timer status 的值变为 Enable。|ew3l-02 Is how1T呼 t-atndl

29、ddisabledsecorit if-vio Lett iou k 鈕nifiiE: l-iniisctfsiLifPisahliEdVi&abledpaffp-flapj<aSjledd.t p-fdlink-flail.Enabledp&ecuwy Id lat iondisabledgfp-CDnf ig-iri innat因 Jb icjjni validn. heprate- Limit:loodVi&abledstcwi-eointiiDl.j<aSjledkdTip inteiwals 3OsecondsInterfaces Jiat uillJhei e nhlied

30、 at: tfiensxt t ijFiiaPUit;:InterFacTim15ft-f lsi.p1523W3-1-02I调整err-disable的超时时间,可以使用以下命令: sw1(config)#errdisable recovery interval 30(set time 30sec) timer-interval(sec)su3-l-02Cconfigiteppdisable pecouepy intepual ?O08&400 t inerintei?ualsec5要填的时间30 secssw3-i-02tterrdisable recovery interval 30链路

31、振荡错误:链路振荡(flap)是指短时间内端口不停的处于up/down状态,如果端口在10秒内连续振荡5次,端口将被设置为 err-disabled 状态,如:%PM-4-ERR_DISABLE: link-flap error detected on Gi2/1, putting Gi2/1 in err-disable state可以使用如下命令查看不同的振荡的值:SW#showerrdisable flap-values5w3-1 -02#s:hou eppdisahle flap-valuesErr*Ii昏盘bl匸 ReasonFlapsIine paffp-flap330dtp-f Lap336link-flap510SW3-1-02#引起链路震荡的常见因素,可能是物理层的问题,比如 GBIC 的硬件故障等等.因此解决这种问题通常先从物理层 入手。以下几行命令可以给VLAN内的主机自动分配IP地址。Switch(config)#ipdhcp pool vlan16Switch(dhcp-config)#network 172.21.38.254 255.255.255.0Switch(dhcp-config)#default-router 172.21.38.254Switch(dhcp-config)#exit

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!