雏鹰部落

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4350|回复: 11

[讨论/求助] [推荐]Switching命令大全

[复制链接]
发表于 2003-12-2 00:11:55 | 显示全部楼层 |阅读模式
chinamoon:<br>这几天CCNA Bootcamp班学员对交换机的配置不太清楚,找了篇文档,SET集讲得不多,仅供参考。<br>《LAN Switch》是目前为止交换机最经典的教材(CCIE学习推荐教材),如果需要的话,请和我联系。<br><br>Switching命令大全<br><br>————————————————----------------------  <br>1.在基于IOS的交换机上设置主机名/系统名:   <br>switch(config)# hostname hostname  <br>在基于CLI的交换机上设置主机名/系统名:  <br>switch(enable) set system name name-string   <br>2.在基于IOS的交换机上设置登录口令:   <br>switch(config)# enable password level 1 password  <br>在基于CLI的交换机上设置登录口令:   <br>switch(enable) set password  <br>switch(enable) set enalbepass  <br>3.在基于IOS的交换机上设置远程访问:   <br>switch(config)# interface vlan 1  <br>switch(config-if)# ip address ip-address netmask  <br>switch(config-if)# ip default-gateway ip-address  <br>在基于CLI的交换机上设置远程访问:   <br>switch(enable) set interface sc0 ip-address netmask broadcast-address  <br>switch(enable) set interface sc0 vlan  <br>switch(enable) set ip route default gateway  <br>4.在基于IOS的交换机上启用和浏览CDP信息:   <br>switch(config-if)# cdp enable  <br>switch(config-if)# no cdp enable  <br>为了查看Cisco邻接设备的CDP通告信息:  <br>switch# show cdp interface [type modle/port]  <br>switch# show cdp neighbors [type module/port] [detail]  <br>在基于CLI的交换机上启用和浏览CDP信息:   <br>switch(enable) set cdp {enable|disable} module/port  <br>为了查看Cisco邻接设备的CDP通告信息:  <br>switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilities|detail]  <br>5.基于IOS的交换机的端口描述:  <br>switch(config-if)# description description-string  <br>基于CLI的交换机的端口描述:   <br>switch(enable)set port name module/number description-string   <br>6.在基于IOS的交换机上设置端口速度:   <br>switch(config-if)# speed{10|100|auto}  <br>在基于CLI的交换机上设置端口速度:  <br>switch(enable) set port speed moudle/number {10|100|auto}  <br>switch(enable) set port speed moudle/number {4|16|auto}  <br>7.在基于IOS的交换机上设置以太网的链路模式:  <br>switch(config-if)# duplex {auto|full|half}  <br>在基于CLI的交换机上设置以太网的链路模式:  <br>switch(enable) set port duplex module/number {full|half}  <br>8.在基于IOS的交换机上配置静态VLAN:  <br>switch# vlan database  <br>switch(vlan)# vlan vlan-num name vla  <br>switch(vlan)# exit  <br>switch# configure teriminal  <br>switch(config)# interface interface module/number  <br>switch(config-if)# switchport mode access  <br>switch(config-if)# switchport access vlan vlan-num  <br>switch(config-if)# end  <br>在基于CLI的交换机上配置静态VLAN:  <br>switch(enable) set vlan vlan-num [name name]  <br>switch(enable) set vlan vlan-num mod-num/port-list   <br>9. 在基于IOS的交换机上配置VLAN中继线:  <br>switch(config)# interface interface mod/port  <br>switch(config-if)# switchport mode trunk  <br>switch(config-if)# switchport trunk encapsulation {isl|dotlq}  <br>switch(config-if)# switchport trunk allowed vlan remove vlan-list  <br>switch(config-if)# switchport trunk allowed vlan add vlan-list  <br>在基于CLI的交换机上配置VLAN中继线:  <br>switch(enable) set trunk module/port [on|off|desirable|auto|nonegotiate]  <br>Vlan-range [isl|dotlq|dotl0|lane|negotiate]  <br>10.在基于IOS的交换机上配置VTP管理域:  <br>switch# vlan database   <br>switch(vlan)# vtp domain domain-name  <br>在基于CLI的交换机上配置VTP管理域:   <br>switch(enable) set vtp [domain domain-name]  <br>11.在基于IOS的交换机上配置VTP 模式:  <br>switch# vlan database  <br>switch(vlan)# vtp domain domain-name  <br>switch(vlan)# vtp {sever|cilent|transparent}  <br>switch(vlan)# vtp password password  <br>在基于CLI的交换机上配置VTP 模式:   <br>switch(enable) set vtp [domain domain-name] [mode{ sever|cilent|transparent }][password password]  <br>12. 在基于IOS的交换机上配置VTP版本:  <br>switch# vlan database  <br>switch(vlan)# vtp v2-mode  <br>在基于CLI的交换机上配置VTP版本:  <br>switch(enable) set vtp v2 enable  <br>13. 在基于IOS的交换机上启动VTP剪裁:  <br>switch# vlan database  <br>switch(vlan)# vtp pruning  <br>在基于CLI 的交换机上启动VTP剪裁:  <br>switch(enable) set vtp pruning enable  <br>14.在基于IOS的交换机上配置以太信道:  <br>switch(config-if)# port group group-number [distribution {source|destination}]  <br>在基于CLI的交换机上配置以太信道:  <br>switch(enable) set port channel moudle/port-range mode{on|off|desirable|auto}  <br>15.在基于IOS的交换机上调整根路径成本:  <br>switch(config-if)# spanning-tree [vlan vlan-list] cost cost  <br>在基于CLI的交换机上调整根路径成本:  <br>switch(enable) set spantree portcost moudle/port cost  <br>switch(enable) set spantree portvlancost moudle/port [cost cost][vlan-list]   <br>16.在基于IOS的交换机上调整端口ID:  <br>switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority  <br>在基于CLI的交换机上调整端口ID:  <br>switch(enable) set spantree portpri {mldule/port}priority  <br>switch(enable) set spantree portvlanpri {module/port}priority [vlans]  <br>17. 在基于IOS的交换机上修改STP时钟:  <br>switch(config)# spanning-tree [vlan vlan-list] hello-time seconds  <br>switch(config)# spanning-tree [vlan vlan-list] forward-time seconds  <br>` switch(config)# spanning-tree [vlan vlan-list] max-age seconds  <br>在基于CLI的交换机上修改STP时钟:  <br>switch(enable) set spantree hello interval[vlan]  <br>switch(enable) set spantree fwddelay delay [vlan]  <br>switch(enable) set spantree maxage agingtiame[vlan]  <br>18. 在基于IOS的交换机端口上启用或禁用Port Fast 特征:  <br>switch(config-if)#spanning-tree portfast  <br>在基于CLI的交换机端口上启用或禁用Port Fast 特征:  <br>switch(enable) set spantree portfast {module/port}{enable|disable}  <br>19. 在基于IOS的交换机端口上启用或禁用UplinkFast 特征:  <br>switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second]  <br>在基于CLI的交换机端口上启用或禁用UplinkFast 特征:  <br>switch(enable) set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]  <br>20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name  <br>21. 为了从一条中继链路上删除VLAN,可使用下列命令:  <br>switch(enable) clear trunk module/port vlan-range  <br>22. 用show vtp domain 显示管理域的VTP参数.  <br>23. 用show vtp statistics显示管理域的VTP参数.  <br>24. 在Catalyst交换机上定义TrBRF的命令如下:  <br>switch(enable) set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee|ibm}]  <br>25. 在Catalyst交换机上定义TrCRF的命令如下:  <br>switch (enable) set vlan vlan-num [name name] type trcrf  <br>{ring hex-ring-num|decring decimal-ring-num} parent vlan-num  <br>26. 在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:   <br>switch(enable) set vlan vlan-num mod-num/port-num  <br>27. 命令show spantree显示一个交换机端口的STP状态.  <br>28. 配置一个ELAN的LES和BUS,可以使用下列命令:  <br>ATM (config)# interface atm number.subint multioint  <br>ATM(config-subif)# lane serber-bus ethernet elan-name   <br>29. 配置LECS:  <br>ATM(config)# lane database database-name  <br>ATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-address  <br>ATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-address  <br>ATM(lane-config-databade)# name …  <br>30. 创建完数据库后,必须在主接口上启动LECS.命令如下:  <br>ATM(config)# interface atm number  <br>ATM(config-if)# lane config database database-name  <br>ATM(config-if)# lane config auto-config-atm-address  <br>31. 将每个LEC配置到一个不同的ATM子接口上.命令如下:  <br>ATM(config)# interface atm number.subint multipoint  <br>ATM(config)# lane client ethernet vlan-num elan-num  <br>32. 用show lane server 显示LES的状态.  <br>33. 用show lane bus显示bus的状态.  <br>34. 用show lane database显示LECS数据库可内容.  <br>35. 用show lane client显示LEC的状态.  <br>36. 用show module显示已安装的模块列表.  <br>37. 用物理接口建立与VLAN的连接:  <br>router# configure terminal  <br>router(config)# interface media module/port  <br>router(config-if)# description description-string  <br>router(config-if)# ip address ip-addr subnet-mask  <br>router(config-if)# no shutdown  <br>38. 用中继链路来建立与VLAN的连接:  <br>router(config)# interface module/port.subinterface  <br>router(config-ig)# encapsulation[isl|dotlq] vlan-number  <br>router(config-if)# ip address ip-address subnet-mask  <br>39. 用LANE 来建立与VLAN的连接:  <br>router(config)# interface atm module/port  <br>router(config-if)# no ip address  <br>router(config-if)# atm pvc 1 0 5 qsaal  <br>router(config-if)# atm pvc 2 0 16 ilni  <br>router(config-if)# interface atm module/port.subinterface multipoint  <br>router(config-if)# ip address ip-address subnet-mask  <br>router(config-if)# lane client ethernet elan-num  <br>router(config-if)# interface atm module/port.subinterface multipoint  <br>router(config-if)# ip address ip-address subnet-name  <br>router(config-if)# lane client ethernet elan-name  <br>router(config-if)# …  <br>40. 为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行:  <br>router(config)# ip routing  <br>router(config)# router ip-routing-protocol  <br>router(config-router)# network ip-network-number  <br>router(config-router)# network ip-network-number   <br>41. 配置默认路由:  <br>switch(enable) set ip route default gateway  <br>42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令:  <br>router(config)# interface interface number  <br>router(config-if)# mls rp vlan-id vlan-id-num  <br>43. 在路由处理器启用MLSP:  <br>router(config)# mls rp ip  <br>44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:  <br>router(config)# interface interface number  <br>router(config-if)# mls rp vtp-domain domain-name  <br>45. 查看指定的VTP域的信息:  <br>router# show mls rp vtp-domain vtp domain name  <br>46. 要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:  <br>router(config-if)#mls rp management-interface  <br>47. 要检验MLS-RP的配置情况:  <br>router# show mls rp  <br>48. 检验特定接口上的MLS配置:  <br>router# show mls rp interface interface number  <br>49. 为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:  <br>set mls flow [destination|destination-source|full]  <br>50. 为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:  <br>router(config)# mls rp ip input-acl  <br>51. 当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:  <br>switch(enable) set mls enable  <br>52. 若想改变老化时间的值,可在特权模式下输入以下命令:  <br>switch(enable) set mls agingtime agingtime  <br>53. 设置快速老化:  <br>switch(enable) set mls agingtime fast fastagingtime pkt_threshold  <br>54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:  <br>switch(enable) show mls include  <br>55. 显示MLS高速缓存记录:  <br>switch(enable) show mls entry  <br>56. 用命令show in arp显示ARP高速缓存区的内容。  <br>57. 要把路由器配置为HSRP备份组的成员,可以在接口配置模式下使用下面的命令:  <br>router(config-if)# standby group-number ip ip-address   <br>58. 为了使一个路由器重新恢复转发路由器的角色,在接口配置模式下:  <br>router(config-if)# standy group-number preempt  <br>59. 访问时间和保持时间参数是可配置的:  <br>router(config-if)# standy group-number timers hellotime holdtime  <br>60. 配置HSRP跟踪:  <br>router(config-if)# standy group-number track type-number interface-priority  <br>61. 要显示HSRP路由器的状态:  <br>router# show standby type-number group brief  <br>62. 用命令show ip igmp确定当选的查询器。  <br>63. 启动IP组播路由选择:  <br>router(config)# ip muticast-routing  <br>64. 启动接口上的PIM:  <br>dalllasr1&gt;(config-if)# ip pim {dense-mode|sparse-mode|sparse-dense-mode}  <br>65. 启动稀疏-稠密模式下的PIM:  <br>router# ip multicast-routing  <br>router# interface type number  <br>router# ip pim sparse-dense-mode  <br>66. 核实PIM的配置:  <br>dallasr1&gt;# show ip pim interface[type number] [count]  <br>67. 显示PIM邻居:  <br>dallasr1&gt;# show ip neighbor type number  <br>68. 为了配置RP的地址,命令如下:  <br>dallasr1&gt;# ip pim rp-address ip-address [group-access-list-number][override]  <br>69. 选择一个默认的RP:  <br>dallasr1&gt;# ip pim rp-address  <br>通告RP和它所服务的组范围:  <br>dallasr1&gt;# ip pim send-rp-announce type number scope ttl group-list access-list-number  <br>为管理范围组通告RP的地址:  <br>dallasr1&gt;# ip pim send-rp-announce ethernet0 scope 16 group-list1  <br>dallasr1&gt;# access-list 1 permit 266.0.0.0 0.255.255.255  <br>设定一个RP映像代理:  <br>dallasr1&gt;# ip pim send-rp-discovery scope ttl  <br>核实组到RP的映像:  <br>dallasr1&gt;# show ip pim rp mapping  <br>dallasr1&gt;# show ip pim rp [group-name|group-address] [mapping]  <br>70. 在路由器接口上用命令ip multicast ttl-threshold ttl-value设定TTL阀值:  <br>dallasr1&gt;(config-if)# ip multicast ttl-threshold ttl-value  <br>71. 用show ip pim neighbor显示PIM邻居表。  <br>72. 显示组播通信路由表中的各条记录:  <br>dallasr1&gt;show ip mroute [group-name|group-address][scoure][summary][count][active kbps]   <br>73. 要记录一个路由器接受和发送的全部IP组播包:  <br>dallasr1&gt; #debug ip mpacket [detail] [access-list][group]  <br>74. 要在CISCO路由器上配置CGMP:  <br>dallasr1&gt;(config-if)# ip cgmp  <br>75.配置一个组播路由器,使之加入某一个特定的组播组:  <br>dallasr1&gt;(config-if)# ip igmp join-group group-address  <br>76. 关闭 CGMP:  <br>dallasr1&gt;(config-if)# no ip cgmp  <br>77. 启动交换机上的CGMP:  <br>dallasr1&gt;(enable) set cgmp enable  <br>78. 核实Catalyst交换机上CGMP的配置情况:  <br>catalystla1&gt;(enable) show config  <br>set prompt catalystla1&gt;  <br>set interface sc0 192.168.1.1 255.255.255.0  <br>set cgmp enable  <br>79. CGMP离开的设置:  <br>Dallas_SW(enable) set cgmp leave  <br>80. 在Cisco设备上修改控制端口密码:  <br>R1(config)# line console 0  <br>R1(config-line)# login  <br>R1(config-line)# password Lisbon  <br>R1(config)# enable password Lilbao  <br>R1(config)# login local  <br>R1(config)# username student password cisco  <br>81. 在Cisco设备上设置控制台及vty端口的会话超时:  <br>R1(config)# line console 0  <br>R1(config-line)# exec-timeout 5 10  <br>R1(config)# line vty 0 4  <br>R1(config-line)# exec-timeout 5 2  <br>82. 在Cisco设备上设定特权级:  <br>R1(config)# privilege configure level 3 username  <br>R1(config)# privilege configure level 3 copy run start  <br>R1(config)# privilege configure level 3 ping  <br>R1(config)# privilege configure level 3 show run  <br>R1(config)# enable secret level 3 cisco  <br>83. 使用命令privilege 可定义在该特权级下使用的命令:  <br>router(config)# privilege mode level level command  <br>84. 设定用户特权级:  <br>router(config)# enable secret level 3 dallas  <br>router(config)# enable secret san-fran  <br>router(config)# username student password cisco   <br>85. 标志设置与显示:  <br>R1(config)# banner motd ‘unauthorized access will be prosecuted!’  <br>86. 设置vty访问:  <br>R1(config)# access-list 1 permit 192.168.2.5  <br>R1(config)# line vty 0 4  <br>R1(config)# access-class 1 in  <br>87. 配置HTTP访问:  <br>Router3(config)# access-list 1 permit 192.168.10.7  <br>Router3(config)# ip http sever  <br>Router3(config)# ip http access-class 1  <br>Router3(config)# ip http authentication local  <br>Router3(config)# username student password cisco  <br>88. 要启用HTTP访问,请键入以下命令:  <br>switch(config)# ip http sever  <br>89. 在基于set命令的交换机上用setCL1启动和核实端口安全:  <br>switch(enable) set port security mod_num/port_num…enable mac address  <br>switch(enable) show port mod_num/port_num  <br>在基于CiscoIOS命令的交换机上启动和核实端口安全:  <br>switch(config-if)# port secure [mac-mac-count maximum-MAC-count]  <br>switch# show mac-address-table security [type module/port]  <br>90. 用命令access-list在标准通信量过滤表中创建一条记录:  <br>Router(config)# access-list access-list-number {permit|deny} source-address [source-address]  <br>91. 用命令access-list在扩展通信量过滤表中创建一条记录:  <br>Router(config)# access-list access-list-number {permit|deny{protocol|protocol-keyword}}{source source-wildcard|any}{destination destination-wildcard|any}[protocol-specific options][log]  <br>92. 对于带内路由更新,配置路由更新的最基本的命令格式是:  <br>R1(config-router)#distribute-list access-list-number|name in [type number]  <br>93. 对于带外路由更新,配置路由更新的最基本的命令格式是:  <br>R1(config-router)#distribute-list access-list-number|name out [interface-name] routing-process| autonomous-system-number  <br>94. set snmp命令选项:  <br>set snmp community {read-only|ready-write|read-write-all}[community_string]  <br>95. set snmp trap 命令格式如下:  <br>set snmp trap {enable|disable}  <br>[all|moudle|classis|bridge|repeater| auth|vtp|ippermit|vmps|config|entity|stpx]  <br>set snmp trap rvcr_addr rcvr_community  <br>96. 启用SNMP chassis 陷阱:  <br>Console&gt;(enable) set snmp trap enable chassis  <br>97. 启用所有SNMP chassis 陷阱:  <br>Console&gt;(enable) set snmp trap enable  <br>98. 禁用SNMP chassis 陷阱:  <br>Console&gt;(enable) set snmp trap disable chassis   <br>99. 给SNMP陷阱接收表加一条记录:  <br>Console&gt;(enable) set snmp trap 192.122.173.42 public  <br>100. show snmp 输出结果。  <br>101. 命令set snmp rmon enable 的输出结果。  <br>102. 显示SPAN信息:  <br>Consile&gt; show span<br>
发表于 2003-12-3 08:11:24 | 显示全部楼层
哦,知道了
发表于 2003-12-2 00:20:32 | 显示全部楼层
嗯,不错,不过太多东西看不懂,下次挑出有用的就好~<br><br>还有,是不是2950以上的交换机配置VLAN都要进入vlan database模式?
发表于 2003-12-2 09:43:02 | 显示全部楼层
&quot;在基于CLI 的交换机上启动VTP剪裁:switch(enable) set vtp pruning enable&quot;<br>我在BCMSN中的看到的Prune的CLI命令好像是Switch(enable):set vtp pruneeligilble vlan_range;在&lt;&lt;CCIE实验指南(卷一)&gt;&gt;中看到的和你给出的相同;当时就迷糊了,现在给我说说吧!
 楼主| 发表于 2003-12-2 10:49:25 | 显示全部楼层
两者都要使用,先允许剪裁,然后再具体决定剪裁哪个vlan。
发表于 2003-12-2 12:17:38 | 显示全部楼层
原来是这样,到时候再实际运用一下,加深理解:)
 楼主| 发表于 2003-12-2 13:51:46 | 显示全部楼层
是啊,纸上得来终觉浅。试试映象就很深了。
发表于 2003-12-2 17:56:53 | 显示全部楼层
怎么没人回答我的问题哩?
 楼主| 发表于 2003-12-2 22:13:38 | 显示全部楼层
<BLOCKQUOTE><strong>引用</strong>:<HR Size=1>原文由 <b>cwav</b> 发表:<br>嗯,不错,不过太多东西看不懂,下次挑出有用的就好~<br><br>还有,是不是2950以上的交换机配置VLAN都要进入vlan database模式?<HR SIZE=1></BLOCKQUOTE><br>IOS配置方式而已。并不是2950以上的都是这样配置。
发表于 2003-12-3 18:41:01 | 显示全部楼层
老大有没有现成的.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )

GMT+8, 2024-4-25 13:43 , Processed in 0.084265 second(s), 18 queries , Gzip On.

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