思科交换机命令大全
Cisco 交换机命令全集

1.在基于IOS的交换机上设置主机名/系统名:switch(config)# hostname hostname在基于CLI的交换机上设置主机名/系统名:switch(enable) set system name name-string2.在基于IOS的交换机上设置登录口令:switch(config)# enable password level 1 password在基于CLI的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass3.在基于IOS的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmaskswitch(config-if)# ip default-gateway ip-address在基于CLI的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-addressswitch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.在基于IOS的交换机上启用和浏览CDP信息:switch(config-if)# cdp enableswitch(config-if)# no cdp enable为了查看Cisco邻接设备的CDP通告信息:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]在基于CLI的交换机上启用和浏览CDP信息:switch(enable) set cdp {enable|disable} module/port为了查看Cisco邻接设备的CDP通告信息:switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilit ies|detail]5.基于IOS的交换机的端口描述:switch(config-if)# description description-string基于CLI的交换机的端口描述:switch(enable)set port name module/number description-string6.在基于IOS的交换机上设置端口速度:switch(config-if)# speed{10|100|auto}在基于CLI的交换机上设置端口速度:switch(enable) set port speed moudle/number {10|100|auto}switch(enable) set port speed moudle/number {4|16|auto}7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)# duplex {auto|full|half}在基于CLI的交换机上设置以太网的链路模式:switch(enable) set port duplex module/number {full|half}8.在基于IOS的交换机上配置静态VLAN:switch# vlan databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitswitch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于CLI的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS的交换机上配置VLAN中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation {isl|dotlq} switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list在基于CLI的交换机上配置VLAN中继线:switch(enable) set trunk module/port [on|off|desirable|auto|nonegotia te]Vlan-range [isl|dotlq|dotl0|lane|negotiate]10.在基于IOS的交换机上配置VTP管理域:switch# vlan databaseswitch(vlan)# vtp domain domain-name在基于CLI的交换机上配置VTP管理域:switch(enable) set vtp [domain domain-name]11.在基于IOS的交换机上配置VTP 模式:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password password在基于CLI的交换机上配置VTP 模式:switch(enable) set vtp [domain domain-name] [mode{ sever|cilent|trans parent }][password password]12. 在基于IOS的交换机上配置VTP版本:switch# vlan databaseswitch(vlan)# vtp v2-mode在基于CLI的交换机上配置VTP版本:switch(enable) set vtp v2 enable13. 在基于IOS的交换机上启动VTP剪裁:switch# vlan databaseswitch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP剪裁:switch(enable) set vtp pruning enable14.在基于IOS的交换机上配置以太信道:switch(config-if)# port group group-number [distribution {source|dest ination}]在基于CLI的交换机上配置以太信道:switch(enable) set port channel moudle/port-range mode{on|off|desirab le|auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)# spanning-tree [vlan vlan-list] cost cost在基于CLI的交换机上调整根路径成本:switch(enable) set spantree portcost moudle/port costswitch(enable) set spantree portvlancost moudle/port [cost cost][vlan -list]16.在基于IOS的交换机上调整端口ID:switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-pr iority在基于CLI的交换机上调整端口ID:switch(enable) set spantree portpri {mldule/port}priorityswitch(enable) set spantree portvlanpri {module/port}priority [vlans]17. 在基于IOS的交换机上修改STP时钟:switch(config)# spanning-tree [vlan vlan-list] hello-time seconds switch(config)# spanning-tree [vlan vlan-list] forward-time seconds switch(config)# spanning-tree [vlan vlan-list] max-age seconds在基于CLI的交换机上修改STP时钟:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]18. 在基于IOS的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast在基于CLI的交换机端口上启用或禁用Port Fast 特征:switch(enable) set spantree portfast {module/port}{enable|disable}19. 在基于IOS的交换机端口上启用或禁用UplinkFast 特征:switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-se cond]在基于CLI的交换机端口上启用或禁用UplinkFast 特征:switch(enable) set spantree uplinkfast {enable|disable}[rate update-r ate] [all-protocols off|on]20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name21. 为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable) clear trunk module/port vlan-range22. 用show vtp domain 显示管理域的VTP参数.23. 用show vtp statistics显示管理域的VTP参数.24. 在Catalyst交换机上定义TrBRF的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridge bridg e-num[stp {ieee|ibm}]25. 在Catalyst交换机上定义TrCRF的命令如下:switch (enable) set vlan vlan-num [name name] type trcrf{ring hex-ring-num|decring decimal-ring-num} parent vlan-num26. 在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:switch(enable) set vlan vlan-num mod-num/port-num27. 命令show spantree显示一个交换机端口的STP状态.28. 配置一个ELAN的LES和BUS,可以使用下列命令:ATM (config)# interface atm number.subint multiointATM(config-subif)# lane serber-bus ethernet elan-name29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-address les1-ns ap-addressATM(lane-config-databade)# name elan2-name server-atm-address les2-ns ap-addressATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)# interface atm numberATM(config-if)# lane config database database-nameATM(config-if)# lane config auto-config-atm-address31. 将每个LEC配置到一个不同的ATM子接口上.命令如下:ATM(config)# interface atm number.subint multipointATM(config)# lane client ethernet vlan-num elan-num32. 用show lane server 显示LES的状态.33. 用show lane bus显示bus的状态.34. 用show lane database显示LECS数据库可内容.35. 用show lane client显示LEC的状态.36. 用show module显示已安装的模块列表.37. 用物理接口建立与VLAN的连接:router# configure terminalrouter(config)# interface media module/portrouter(config-if)# description description-stringrouter(config-if)# ip address ip-addr subnet-maskrouter(config-if)# no shutdown38. 用中继链路来建立与VLAN的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl|dotlq] vlan-numberrouter(config-if)# ip address ip-address subnet-mask39. 用LANE 来建立与VLAN的连接:router(config)# interface atm module/portrouter(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaalrouter(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-namerouter(config-if)# lane client ethernet elan-namerouter(config-if)# …40. 为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行: router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-numberrouter(config-router)# network ip-network-number41. 配置默认路由:switch(enable) set ip route default gateway42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)# interface interface numberrouter(config-if)# mls rp vlan-id vlan-id-num43. 在路由处理器启用MLSP:router(config)# mls rp ip44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中: router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name45. 查看指定的VTP域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令: router(config-if)#mls rp management-interface47. 要检验MLS-RP的配置情况:router# show mls rp48. 检验特定接口上的MLS配置:router# show mls rp interface interface number49. 为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:set mls flow [destination|destination-source|full]50. 为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)# mls rp ip input-acl51. 当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable) set mls enable52. 若想改变老化时间的值,可在特权模式下输入以下命令:switch(enable) set mls agingtime agingtime53. 设置快速老化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable) show mls include55. 显示MLS高速缓存记录:switch(enable) show mls entry56. 用命令show in arp显示ARP高速缓存区的内容。
(完整word版)思科交换机配置命令大全

(完整word版)思科交换机配置命令大全思科交换机配置命令大全switch> 用户模式1:进入特权模式enableswitch> enableswitch#2:进入全局配置模式configure terminalswitch> enableswitch#configure terminalswitch(conf)#3:交换机命名hostname aptech2950 以aptech2950为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch-2950aptech2950(conf)#4:配置使能口令enable password cisco 以cisco为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable password cisco5:配置使能密码enable secret ciscolab 以cicsolab为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolab6:设置虚拟局域网vlan 1 interface vlan 1switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface vlan 1aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip和子网掩码aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exitaptech2950(conf)#ip default-gateway 192.168.254 设置网关地址7:进入交换机某一端口interface fastehernet 0/17 以17端口为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface fastehernet 0/17aptech2950(conf-if)#8:查看命令showswitch> enableswitch# show version 察看系统中的所有版本信息show interface vlan 1 查看交换机有关ip 协议的配置信息show running-configure 查看交换机当前起作用的配置信息show interface fastethernet 0/1 察看交换机1接口具体配置和统计信息show mac-address-table 查看mac地址表show mac-address-table aging-time 查看mac地址表自动老化时间9:交换机恢复出厂默认恢复命令switch> enableswitch# erase startup-configureswitch# reload10:双工模式设置switch> enableswitch#c onfigure terminalswitch2950(conf)#hostname aptch-2950aptech2950(conf)# interface fastehernet 0/17 以17端口为例aptech2950(conf-if)#duplex full/half/auto 有full , half, auto 三个可选项11:cdp相关命令switch> enableswitch# show cdp 查看设备的cdp全局配置信息show cdp interface fastethernet 0/17 查看17端口的cdp配置信息show cdp traffic 查看有关cdp包的统计信息show cdp nerghbors 列出与设备相连的cisco设备12:csico2950的密码恢复拔下交换机电源线。
思科交换机路由器命令大全

思科交换机路由器命令大全交换机命令:1:用户模式switch>进入特权模式switch> enableswitch#2:进入全局配置模式switch> enableswitch#configure terminalswitch(config)#3:交换机命名 hostname aptech2950 以aptech2950为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch-2950aptech2950(conf)#4:配置使能口令 enable password cisco 以cisco为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable password cisco5:配置使能密码 enable secret ciscolab以cicsolab为例--设置禁用IP地址解析特性,设置启用消息同步特性switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolabaptech2950(conf)#no ip domain-lookup -----设置禁用IP地址解析特性aptech2950(conf)#logging synchronous -----设置启用消息同步特性aptech2950(conf)#interface range fastethernet0/1-20aptech2950(conf-if-range)#spanning-tree portfast -----设置快速端口aptech2950(conf)#interface range fastethernet 0/23-24aptech2950(conf-if-range)#swichport mode trunk -----设置主干道端口aptech2950(conf)#spanning-tree uplingkfast ---设置阻塞启用迅速(只可以在访问层启用)6:设置虚拟局域网vlan 1 interface vlan 1switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface vlan 1aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip和子网掩码aptech2950(conf-if)#noshut 是配置处于运行中aptech2950(conf-if)#exitaptech2950(conf)#ip default-gateway 192.168.254 设置网关地址7:进入交换机某一端口 interface fastehernet 0/17 以17端口为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface fastehernet 0/17aptech2950(conf-if)#8:查看命令 showswitch> enableswitch# show version 察看系统中的所有版本信息show interface vlan 1 查看交换机有关ip 协议的配置信息show running-configure 查看交换机当前起作用的配置信息show interface fastethernet 0/1 察看交换机1接口具体配置和统计信息show mac-address-table 查看mac地址表show mac-address-table aging-time 查看mac地址表自动老化时间9:交换机恢复出厂默认恢复命令switch> enableswitch# erase startup-configureswitch# reload10:双工模式设置switch> enableswitch#c onfigure terminalswitch2950(conf)#hostname aptch-2950aptech2950(conf)# interface fastehernet 0/17 以17端口为例aptech2950(conf-if)#duplex full/half/auto 有full , half, auto 三个可选项11:cdp相关命令switch> enableswitch# show cdp 查看设备的cdp全局配置信息show cdp interface fastethernet 0/17 查看17端口的cdp配置信息show cdp traffic 查看有关cdp包的统计信息show cdp nerghbors 列出与设备相连的cisco设备12:csico2950的密码恢复拔下交换机电源线。
Cisco交换机命令大全

Cisco交换机命令大全Cisco:交换机配置命令Switch命令:一、模式命令:1. 用户模式:Switch>2. 特权模式:Switch>enableSwitch#3. 全局配置模式:Switch#config terminalSwitch(config)#4. 接口配置模式:Switch(config)#interface fastethernet0/1Switch(config-if)#5. Line模式:Switch(config)#line console 0Switch(config-line)#二、特权模式下的命令:1. 查看交换机MAC地址:Switch#show mac-address-table2. Cisco发现协议(CDP):Switch#show cdpSwitch#show cdp interface fastethernet0/1Switch#show cdp neighborsSwitch#show cdp neighbors detailSwitch#show cdp entry3. 保存交换机配置:Switch#copy running-config startup-config或者Switch#write4. 恢复交换机出厂值:Switch#erase startup-configSwitch#reload三、全局配置模式下的命令:1. 配置主机名:Switch(config)#hostname Sw1Sw1(config)#2、设置登陆台密码:Switch(config)#line console 0Switch(config-line)#password 密码Switch(config-line)#login3. 使能口令:Switch(config)#enable Password 密码4. 加密保存的使能口令:Switch(config)#enable secret 密码5. 配置IP地址:Switch(config)#interface vlan 1Switch(config-if)#ip address IP地址网关Switch(config-if)#no shutdown6. 配置交换机网关:Switch(config)#ip default-gateway 网关四、VLAN配置命令:1. 创建vlan命令:a) 全局配置模式下:Switch(config)#vlan 2Switch(config)#name v2Switch(config)#mtu 数值Switch(config)#endb) Vlan数据库下:Switch#vlan databaseSwitch#vlan 2 name v2Switch#vlan 2 mut 数值Switch#exit2. 删除vlan命令:a) 全局配置模式下:Switch(config)#no vlan 2Switch(config)#endb) Vlan数据库下:Switch#no vlan 2 name v2Switch#exit3. 在vlan中添加端口:Switch#config terminalSwitch(config)#interface f0/1(端口)Switch(config-if)#Switchport mode accessSwitch(config-if)#switchport access vlan 2Switch(config-if)#end一次将多个端口添加到vlan中:Switch#config terminalSwitch(config)#interface range f0/1 - 5(端口)Switch(config-if)#switchport access vlan 2Switch(config-if)#end注:switch#show vlan biref(查看vlan信息)4. 配置vlan trunk:1. 配置接口为trunk命令:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport mode trunk2. 配置接口为动态协商模式的命令:Switch(config)# interface f0/1(端口)Switch(config-if)#switchport mode dynamic desirable/auto 3. 从trunk中删除vlan:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport trunk allowed vlan remove 2 4. 在trunk中添加vlan:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport trunk allowed vlan add 2-----------------------------------------------------------Catalyst 2950交换机密码恢复(1)拔下交换机的电源。
cisco思科命令大全

思科命令大全思科常用命令大权1用户模式2:特权模式enableshow vlanshow versionshow interfaceshow mac-address-tableshow running-configcopy running-config startup-config3:全局配置模式config terminalhostnameenable passwordip default-gateway4:接口配置模式interface 端口switchport mode trunk5:line模式line console 0第2章交换机的基本配置1.配置主机hostname2.查看交换机的配置show running-config使能口令enable password加密保存的使能口令enable secret配置IP地址interface vlan1ip addressno shutdown配置交换机的网关ip default-gateway ipaddress查看交换机的MAC地址表show mac-address-table使用CDP协议show cdpshow cdp interfaceshow cdp neighborsshow cdp neighbors detailshow cdp traffic保存与删除交换机配置copy running-config startup-config第三章:虚拟局域网(VLAN)VLAN的概述VLAN是对连接在第2层交换机端口的网络用户的逻辑分段。
VLAN的作用:1。
广播控制2。
安全(副产品)3。
带宽利用4。
延迟VLAN的种类静态:基于端口的VLAN动态:基于MAC地址的VLAN在交换机上配置静态VLAN创建VLAN1。
CONFIG TERMINALVLAN 2NAME 22。
特权模式下VLAN DATABASEVLAN 2 NAME 2查看VLANSHOW VLAN删除VLANNO VLAN 2验证:SHOW VLAN BRIEF在VLAN中添加端口INTERFACE F0/2INTERFACE RANGE F0/2 - 5SWITCHPORT MODE ACCESSSWITCHPORT ACCESS VLAN 2VLAN配置实例在交换机上添加VLAN2,VLAN3,VLAN3,端口范围分别为1-4,5-8,9-12这个实例的作用就是让不同的VLAN的计算机之间的通信隔开。
思科交换路由常用命令

交换路由常用命令一、基础配置1、修改主机名配置:S(config)#hostname SWITCHA2、enable口令:Switch(config)#enable password1233、TELNET:只需密码的telnet需用户名和密码的telnetS(config)#line vty04S(config)#username S2password123S(config-line)#password123S(config)#line vty04S(config-line)#login//启用登陆时口令检查S(config-line)#login local//启用登陆本地验证只允许pc所在的网段对交换路由进行远程登陆:S(config)#access-list99permit192.168.1.00.0.0.255S(config)#line vty04S(config-line)#access-class99inS(config-line)#password123S(config-line)#login4、console配置:S(config)#line console0S(config-line)#password123S(config-line)#login5、显示当前配置:switch#show run6、保存当前配置:switch#write7、进入全局配置模式:switch#conf t8、进入接口配置模式:S(config)#interface f0/1二、二层接入交换机常见配置1、创建vlan10及命名:S(config)#vlan10S(config-vlan)#name caiwubu2、多个端口划分入vlan:vlan:S(config)#int range fa0/1-5S(config-if)#sw access vlan103、接口trunk模式配置:S(config)#inter f0/0S(config-if)#sw mode trunk4、二层交换机管理ip配置:S2(config)#interface vlan100//进入vlan100接口S2(config-if)#ip address192.168.10.1255.255.255.0//为vlan100接口上设置管理ip S2(config)#ip default-gateway192.168.10.2545、生成树配置:S(config)#spanning-tree mode rapid-pvst//配置快速生成树S(config)#spanning-tree vlan10,20priority0//配置根网桥S(config)#spanning-tree vlan10,20,30priority4096//配置备份根网桥6、端口双工、带宽设置:S(config)#int F0/2S(config-if)#duplex fullS(config-if)#speed100三、三层交换机常见配置1、三层交换机开启路由功能:S(config)#ip routing//开启后可实现vlan间相互通信2、三层交换机接口配置成路由口:S(config-if)#no swtichport//在接口模式下配置,可配置ip地址3、三层交换机创建SVI接口(SVI接口常作为vlan的网关):S(config)#interface vlan104、三层交换机接口改trunk模式:Switch(config-if)#switchport trunk encapsulation dot1q//先封装Switch(config-if)#switchport mode trunk//再设置trunk模式5、trunk允许vlan通过:S(config)#inter fa0/23S(config-if)#switchport trunk allowed vlan2,3//trunk口只让vlan2,3通过S(config-if)#switchport trunk allowed vlan all//trunk口允许所有的vlan通过四、路由器常见配置1、ip地址设置:router(config-if)#ip address192.168.1.1255.255.255.0//接口模式下配置2、静态路由配置:router(config)#ip route192.168.1.0255.255.255.010.1.1.1{f0/0}//下一跳地址可替换为出接口3、默认路由配置:router(config)#ip route0.0.0.00.0.0.010.1.1.14、浮动静态路由作为备份路由:R(config)#ip route172.16.20.0255.255.255.010.10.10.4R(config)#ip route172.16.20.0255.255.255.010.10.10.6100//路由开销值100比默认值1大,作为备份路由5、路由可达,有去有回。
思科交换机配置命令大全

思科交换机配置命令大全前几天我们了解了华为交换机的配置命令,有朋友问到思科,那么今天我们来了解思科交换机的配置方式。
一、基本配置命令switch> 用户模式1:进入特权模式 enableswitch> enableswitch#2:进入全局配置模式 configure terminalswitch> enableswitch#c onfigure terminalswitch(conf)#3:交换机命名 hostname aptech2950 以 aptech2950 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch-2950aptech2950(conf)#4:配置使能口令 enable password cisco 以 cisco 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable password cisco5:配置使能密码 enable secret ciscolab 以 cicsolab 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolab6:设置虚拟局域网 vlan 1 interface vlan 1switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface vlan 1aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口 ip 和子网掩码aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exitaptech2950(conf)#ip default-gateway 192.168.254 设置网关地址7:进入交换机某一端口 interface fastehernet 0/17 以 17 端口为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface fastehernet 0/17aptech2950(conf-if)#8:查看命令 showswitch> enableswitch# show version 察看系统中的所有版本信息show interface vlan 1 查看交换机有关 ip 协议的配置信息show running-configure 查看交换机当前起作用的配置信息show interface fastethernet 0/1 察看交换机 1 接口具体配置和统计信息show mac-address-table 查看 mac 地址表show mac-address-table aging-time 查看 mac 地址表自动老化时间9:交换机恢复出厂默认恢复命令switch> enableswitch# erase startup-configureswitch# reload10:双工模式设置switch> enableswitch#c onfigure terminalswitch2950(conf)#hostname aptch-2950aptech2950(conf)# interface fastehernet 0/17 以 17 端口为例aptech2950(conf-if)#duplex full/half/auto 有 full , half, auto 三个可选项11:cdp 相关命令switch> enableswitch# show cdp 查看设备的 cdp 全局配置信息show cdp interface fastethernet 0/17 查看 17 端口的 cdp 配置信息show cdp traffic 查看有关 cdp 包的统计信息show cdp nerghbors 列出与设备相连的 cisco 设备12:csico2950 的密码恢复拔下交换机电源线。
思科交换机配置命令大全

交换机配置1、基本配置:Switch >enable /进入特权模式Switch#conf t /进入全局配置模式Switch (conf-if)#duplex full/half/auto /有full , half, auto 三个可选switch# erase startup-configure / 恢复出场配置switch# reload / 重启交换机远程登录和con口还有接口配置和路由器配置命令一样,不再下面总结。
2配置VLAN和TRUNKSwitch(config)# vlan xxx /创建一个VLANSwitch(config-vlan)# name xxx /给VLAN命名或Switch# vlan database /进入保存VLAN配置的配置文件Switch(vlan)# vlan 20 name test20 /创建VLAN并给它命名Switch(config-if)# switchport mode access /配置端口模式是accessSwitch(config-if)# switchport access vlan xxx / 把接口划入一个VLAN Switch(config-if)#switchport trunk encapsulation {isl | dot1q | negotiate} /配置trunk封装ISL 或 802.1Q 或自动协商Switch(config-if)#switchport mode {dynamic {auto | desirable} | trunk} /配置二层trunk模式。
Switch(config-if)#switchport trunk allowed vlan {add | all | except | remove} vlan-list可选) / 配置trunk允许的VLAN3查看命令switch#show version /察看系统中的所有版本信息switch#show interface vlan xxx /查看交换机有关ip 协议的配置信息switch#show running-configure /查看交换机当前起作用的配置信息switch#show interface fastethernet xxx /察看交换机xxx接口具体配置和统计信息switch#show mac-address-table /查看mac 地址表switch#show mac-address-table aging-time / 查看mac 地址表自动老化时间4 cdp 相关命令switch#show cdp / 查看设备的cdp 全局配置信息switch#show cdp interface fastethernet xxx /查看xxx 端口的cdp 配置信息switch#show cdp traffic / 查看有关cdp 包的统计信息switch#show cdp nerghbors / 列出与设备相连的cisco 设备VTP配置switch# vlan databaseswitch(vlan)# vtp domain xxx / 配置VTP名字Switch(vlan)#vtp server / 配置VTP模式为serverSwitch(vlan)#vtp client / 配置VTP模式为clientSwitch(vlan)#vtp password xxx / 配置VTP密码switch(vlan)# vtp pruning / 开启VTP剪裁switch#show vtp domain /显示管理域的VTP 参数还有没总结的,我会抓紧时间完善。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
思科交换机命令大全
思科交换机常用命令大全
1.1用户模式与特权模式
用户模式:可以使用一些基本的查询命令
特权模式:可以对交换机进行相关的配置
进入特权模式命令:Switch>e nable
退出特权模式命令:Switch#exit
启用命令查询:?
时间设置:Switch#clock set 时间(自选参数,参数必须符合交换机要求)
显示信息命令:Switch#show可选参数
注意:可以用TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数
查看交换机配置:Switch#show running-config
保存交换机配置:Switch#copy runnin g-c onfig
startup-c onfig
Switch#wr
查看端口信息:Switch#show in terface
查看MAC地址表:Switch#show mac-address-table
查看交换机CPU的状态信息:Switch#show processes
1.2全局配置模式
进入全局配置模式:Switch#c on figure termi nal
主机名修改:Switch(c on fig)#host name 主机名(自选参数)
特权模式进入密码:Switch(co nfig)#e nable secret 密码(自选参数)
取消特权模式密码:Switch(co nfig)# no en able secret
取消主机名设置:Switch(co nfig)# no host name
退出配置模式:Switch(co nfig)#exit
需要特别注意的是在配置模式中无法使用show命令,如果要使用
的话show前必须加do和空格,例如:do show *
指定根交换机命令:Switch(c on fig)#spa nnin g-tree vla n
自
选参数(VLAN号)root primary
思科交换机命令大全例如:Switch(c on fig)#spa nnin g-tree via n 1 root primary
需要注意的是:设置根交换机是基于VLAN的
关闭生成树协议命令:Switch(c on fig)# no spa nnin g-tree via n 自选参数(VLAN号)
例如:Switch(c on fig)# no spa nnin g-tree via n 1
1.3接口配置模式
进入接口配置模式:Switch(co nfig)#i nterface 端口名称(可
选参数)
启用端口:Switch(c on fig-if)# no shutdow n
停用端口:Switch(c on fig-if)#shutdow n
进入同种类型多端口配置:Switch(c on fig)# in terface range fastethernet 0/1-5
进入不同类型多端口配置:Switch(co nfig)# in terface range fastethernet 0/1-5 ,gigabitethernet 0/1-2
退出接口配置模式:Switch(c on fig-if)#exit
思科交换机命令大全
删除 VLAN: Switch#vlan database
1.4 二层端口的配置
端口速率: Switch(co nfig-if)#speed 可选参数 双工模
式:
Switch(c on fig-if)#duplex 可选参数
禁用链路协商:Switch(co nfig-if)# no negotiation auto 启用链路协商:Switch(co nfig-if)# negotiation auto
1.5 VLAN 的配置
xxVLAN Switch(config)#vlan
自选参数(VLAN 号) Switch(config-vlan)#name
自选参数(VLAN 名)
例如:Switch(config)#vlan 1 Switch(co nfig-vla n)# name lab1 Switch(c on fig-vla n) #exit Switch(vlan)#no vian
自选参数(vian 号)
例如:Switch#vlan database Switch(vla n)#no vlan 2
将一个接口加入VLAN
Switch(c on fig)#i nterface 可选参数(接口号)
Switch(c on fig-if)#switchport mode access
Switch(c on fig-if)#switchport access vla n
自选参数(VLAN号)
Switch(co nfig-if)# no shutdow n
Switch(c on fig-if)#exit
例如:Switch(config)#interface fO/1
Switch(c on fig-if)#switchport mode access
Switch(c on fig-if)#switchport access vla n 1
Switch(co nfig-if)# no shutdow n
Switch(c on fig-if)#exit
将一个接口退出VLAN
Switch(co nfig)#i nterface 可选参数(接口号)
Switch(c on fig-if)# no switchport access via n 自选参数(VLAN号)
例如:Switch(config)#interface fO/1
Switch(c on fig-if)# no switchport access via n 2
修改一个接口为端口汇聚模式
Switch(co nfig)#i nterface 可选参数(接口号)
Switch(c on fig-if)#switchport mode trunk
VLAN的验证命令:
Switch#show vian 显示VLAN列表
Switch#show in terface switchport 查看具体接口的VLAN 成员资格信息
1.6 VTP的配置
VTP Domai n Name(VTP 域名)
Switch#con figure termi nal
Switch(c on fig)#vtp domai n 自选参数
例如:Switch(config)#vtp domain Lab_Network
VTP mode( VTP模式)
Switch(config)#vtp mode 可选参数(ServerQient|
Tra nspare nt)
例如:Switch(c on fig)#vtp mode Server
VTP Pruning (VTP修剪)
Switch(c on fig)#vtp pruning
注意:有的交换机不支持VTP修剪命令
查看VTP的配置命令:
Switch#show vtp status
显示交换机运行的VTP模式,配置修订号和交换机所属的VTP域Switch#show vtp coun ters
显示VTP消息相关的统计数据
1.7远程登录交换机设置
配置管理VLAN
Switch(c on f)#i nterface via n 1
Switch(c on fig-if)#ip address x.x.x.x 255.255.255.0
Switch(co nfig-if)# no shutdow n
注意:IP地址必须与远程连接交换机的PC机地址在同一网段在交换机上指定默认网关:
Switch(c on fig)#ip default-gateway x.x.x.x
注意:指定的默认网关仅当前交换机有效。
将交换机连接PC机的端口加入VLAN 1
Switch(co nfig)#i nterface 端口号(可选参数)
Switch(c on fig-if)#switchport mode access
Switch(c on fig-if)#switchport access vla n 1
Switch(co nfig-if)# no shutdow n
配置交换机的远程登录
思科交换机命令大全Switch(co nfig)#l ine vty 0 4
Switch(co nfig-li ne)#password Switch(co nfig-li ne)#logi n Switch(config)#enable secret 自选参数自选参数。