1、51CTO下载Cisco+交换机命令全集思科路由器命令大全1.在基于IOS的交换机上设置主机名/系统名:switch(config)#hostnamehostname在基于CLI的交换机上设置主机名/系统名:switch(enable)setsystemnamename-string 2.在基于IOS的交换机上设置登录口令:switch(config)#enablepasswordlevel1password在基于CLI的交换机上设置登录口令:switch(enable)setpasswordswitch(enable)setenalbepass3.在基于IOS的交换机上设置远程访问:swit
2、ch(config)#interfacevlan1switch(config-if)#ipaddressip-addressnetmaskswitch(config-if)#ipdefault-gatewayip-address在基于CLI的交换机上设置远程访问:switch(enable)setinterfacesc0ip-addressnetmaskbroadcast-addressswitch(enable)setinterfacesc0vlanswitch(enable)setiproutedefaultgateway4.在基于IOS的交换机上启用和浏览CDP信息:switch(con
3、fig-if)#cdpenableswitch(config-if)#nocdpenable为了查看Cisco邻接设备的CDP通告信息:switch#showcdpinterfacetypemodle/portswitch#showcdpneighborstypemodule/portdetail在基于CLI的交换机上启用和浏览CDP信息:switch(enable)setcdpenable|disablemodule/port为了查看Cisco邻接设备的CDP通告信息:switch(enable)showcdpneighborsmodule/portvlan|duplex|capabilit
4、ies|detail5.基于IOS的交换机的端口描述:switch(config-if)#descriptiondescription-string基于CLI的交换机的端口描述:switch(enable)setportnamemodule/numberdescription-string6.在基于IOS的交换机上设置端口速度:switch(config-if)#speed10|100|auto在基于CLI的交换机上设置端口速度:switch(enable)setportspeedmoudle/number10|100|autoswitch(enable)setportspeedmoudle/
5、number4|16|auto7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)#duplexauto|full|half在基于CLI的交换机上设置以太网的链路模式:switch(enable)setportduplexmodule/numberfull|half8.在基于IOS的交换机上配置静态VLAN:switch#vlandatabaseswitch(vlan)#vlanvlan-numnamevlaswitch(vlan)#exitswitch#configureteriminalswitch(config)#interfaceinterfacemodu
6、le/numberswitch(config-if)#switchportmodeaccessswitch(config-if)#switchportaccessvlanvlan-numswitch(config-if)#end在基于CLI的交换机上配置静态VLAN:switch(enable)setvlanvlan-numnamenameswitch(enable)setvlanvlan-nummod-num/port-list9.在基于IOS的交换机上配置VLAN中继线:switch(config)#interfaceinterfacemod/portswitch(config-if)#s
7、witchportmodetrunkswitch(config-if)#switchporttrunkencapsulationisl|dotlqswitch(config-if)#switchporttrunkallowedvlanremovevlan-listswitch(config-if)#switchporttrunkallowedvlanaddvlan-list在基于CLI的交换机上配置VLAN中继线:switch(enable)settrunkmodule/porton|off|desirable|auto|nonegotiateVlan-rangeisl|dotlq|dotl0
8、|lane|negotiate10.在基于IOS的交换机上配置VTP管理域:switch#vlandatabaseswitch(vlan)#vtpdomaindomain-name在基于CLI的交换机上配置VTP管理域:switch(enable)setvtpdomaindomain-name11.在基于IOS的交换机上配置VTP模式:switch#vlandatabaseswitch(vlan)#vtpdomaindomain-nameswitch(vlan)#vtpsever|cilent|transparentswitch(vlan)#vtppasswordpassword在基于CLI的
9、交换机上配置VTP模式:switch(enable)setvtpdomaindomain-namemodesever|cilent|transparentpasswordpassword12.在基于IOS的交换机上配置VTP版本:switch#vlandatabaseswitch(vlan)#vtpv2-mode在基于CLI的交换机上配置VTP版本:switch(enable)setvtpv2enable13.在基于IOS的交换机上启动VTP剪裁:switch#vlandatabaseswitch(vlan)#vtppruning在基于CLI的交换机上启动VTP剪裁:switch(enable
10、)setvtppruningenable14.在基于IOS的交换机上配置以太信道:switch(config-if)#portgroupgroup-numberdistributionsource|destination在基于CLI的交换机上配置以太信道:switch(enable)setportchannelmoudle/port-rangemodeon|off|desirable|auto15.在基于IOS的交换机上调整根路径成本:switch(config-if)#spanning-treevlanvlan-listcostcost在基于CLI的交换机上调整根路径成本:switch(en
11、able)setspantreeportcostmoudle/portcostswitch(enable)setspantreeportvlancostmoudle/portcostcostvlan-list16.在基于IOS的交换机上调整端口ID:switch(config-if)#spanning-treevlanvlan-listport-priorityport-priority在基于CLI的交换机上调整端口ID:switch(enable)setspantreeportprimldule/portpriorityswitch(enable)setspantreeportvlanpri
12、module/portpriorityvlans17.在基于IOS的交换机上修改STP时钟:switch(config)#spanning-treevlanvlan-listhello-timesecondsswitch(config)#spanning-treevlanvlan-listforward-timesecondsswitch(config)#spanning-treevlanvlan-listmax-ageseconds在基于CLI的交换机上修改STP时钟:switch(enable)setspantreehellointervalvlanswitch(enable)setspa
13、ntreefwddelaydelayvlanswitch(enable)setspantreemaxageagingtiamevlan18.在基于IOS的交换机端口上启用或禁用PortFast特征:switch(config-if)#spanning-treeportfast在基于CLI的交换机端口上启用或禁用PortFast特征:switch(enable)setspantreeportfastmodule/portenable|disable19.在基于IOS的交换机端口上启用或禁用UplinkFast特征:switch(config)#spanning-treeuplinkfastmax
14、-update-ratepkts-per-second在基于CLI的交换机端口上启用或禁用UplinkFast特征:switch(enable)setspantreeuplinkfastenable|disablerateupdate-rateall-protocolsoff|on20.为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令:switch(config)#clusterenablecluster-name21.为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable)cleartrunkmodule/portvlan-ra
15、nge22.用showvtpdomain显示管理域的VTP参数.23.用showvtpstatistics显示管理域的VTP参数.24.在Catalyst交换机上定义TrBRF的命令如下:switch(enable)setvlanvlan-namenamenametypetrbrfbridgebridge-numstpieee|ibm25.在Catalyst交换机上定义TrCRF的命令如下:switch(enable)setvlanvlan-numnamenametypetrcrfringhex-ring-num|decringdecimal-ring-numparentvlan-num26.
16、在创建好TrBRFVLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:switch(enable)setvlanvlan-nummod-num/port-num27.命令showspantree显示一个交换机端口的STP状态.28.配置一个ELAN的LES和BUS,可以使用下列命令:ATM(config)#interfaceatmnumber.subintmultiointATM(config-subif)#laneserber-busethernetelan-name29.配置LECS:ATM(config)#lanedatabasedatabase-
17、nameATM(lane-config-databade)#nameelan1-nameserver-atm-addressles1-nsap-addressATM(lane-config-databade)#nameelan2-nameserver-atm-addressles2-nsap-addressATM(lane-config-databade)#name30.创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)#interfaceatmnumberATM(config-if)#laneconfigdatabasedatabase-nameATM(config
18、-if)#laneconfigauto-config-atm-address31.将每个LEC配置到一个不同的ATM子接口上.命令如下:ATM(config)#interfaceatmnumber.subintmultipointATM(config)#laneclientethernetvlan-numelan-num32.用showlaneserver显示LES的状态.33.用showlanebus显示bus的状态.34.用showlanedatabase显示LECS数据库可内容.35.用showlaneclient显示LEC的状态.36.用showmodule显示已安装的模块列表.37.
19、用物理接口建立与VLAN的连接:router#configureterminalrouter(config)#interfacemediamodule/portrouter(config-if)#descriptiondescription-stringrouter(config-if)#ipaddressip-addrsubnet-maskrouter(config-if)#noshutdown38.用中继链路来建立与VLAN的连接:router(config)#interfacemodule/port.subinterfacerouter(config-ig)#encapsulationi
20、sl|dotlqvlan-numberrouter(config-if)#ipaddressip-addresssubnet-mask39.用LANE来建立与VLAN的连接:router(config)#interfaceatmmodule/portrouter(config-if)#noipaddressrouter(config-if)#atmpvc105qsaalrouter(config-if)#atmpvc2016ilnirouter(config-if)#interfaceatmmodule/port.subinterfacemultipointrouter(config-if)#
21、ipaddressip-addresssubnet-maskrouter(config-if)#laneclientethernetelan-numrouter(config-if)#interfaceatmmodule/port.subinterfacemultipointrouter(config-if)#ipaddressip-addresssubnet-namerouter(config-if)#laneclientethernetelan-namerouter(config-if)#40.为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行:router(config)#i
22、proutingrouter(config)#routerip-routing-protocolrouter(config-router)#networkip-network-numberrouter(config-router)#networkip-network-number41.配置默认路由:switch(enable)setiproutedefaultgateway42.为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)#interfaceinterfacenumberrouter(config-if)#mlsrpvlan-idvlan-id-n
23、um43.在路由处理器启用MLSP:router(config)#mlsrpip44.为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)#interfaceinterfacenumberrouter(config-if)#mlsrpvtp-domaindomain-name45.查看指定的VTP域的信息:router#showmlsrpvtp-domainvtpdomainname46.要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mlsrpmanagement-interface47.要检验MLS-
24、RP的配置情况:router#showmlsrp48.检验特定接口上的MLS配置:router#showmlsrpinterfaceinterfacenumber49.为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:setmlsflowdestination|destination-source|full50.为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)#mlsrpipinput-acl51.当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable)setmlsenable52.若
25、想改变老化时间的值,可在特权模式下输入以下命令:switch(enable)setmlsagingtimeagingtime53.设置快速老化:switch(enable)setmlsagingtimefastfastagingtimepkt_threshold54.确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable)showmlsinclude55.显示MLS高速缓存记录:switch(enable)showmlsentry56.用命令showinarp显示ARP高速缓存区的内容。57.要把路由器配置为HSRP备份组的成员,可以在
26、接口配置模式下使用下面的命令:router(config-if)#standbygroup-numberipip-address58.为了使一个路由器重新恢复转发路由器的角色,在接口配置模式下:router(config-if)#standygroup-numberpreempt59.访问时间和保持时间参数是可配置的:router(config-if)#standygroup-numbertimershellotimeholdtime60.配置HSRP跟踪:router(config-if)#standygroup-numbertracktype-numberinterface-priorit
27、y61.要显示HSRP路由器的状态:router#showstandbytype-numbergroupbrief62.用命令showipigmp确定当选的查询器。63.启动IP组播路由选择:router(config)#ipmuticast-routing64.启动接口上的PIM:dalllasr1(config-if)#ippimdense-mode|sparse-mode|sparse-dense-mode65.启动稀疏-稠密模式下的PIM:router#ipmulticast-routingrouter#interfacetypenumberrouter#ippimsparse-den
28、se-mode66.核实PIM的配置:dallasr1#showippiminterfacetypenumbercount67.显示PIM邻居:dallasr1#showipneighbortypenumber68.为了配置RP的地址,命令如下:dallasr1#ippimrp-addressip-addressgroup-access-list-numberoverride69.选择一个默认的RP:dallasr1#ippimrp-address通告RP和它所服务的组范围:dallasr1#ippimsend-rp-announcetypenumberscopettlgroup-listaccess-list-number为管理范围组通告RP的地址:dallasr1#ippimsend-rp-announceethernet0scope16group-list1dallasr1#access-list1permit266.0.0.