思科交换机基本命令(全)
- 格式:doc
- 大小:63.00 KB
- 文档页数:8
1. 交换机支持的命令:交换机基本状态:交换机口令设置:交换机VLAN设置:交换机设置IP地址:交换机显示命令:2. 路由器支持的命令:路由器显示命令:路由器口令设置:路由器配置:路由器文件操作:静态路由:动态路由:帧中继命令:基本访问控制列表:删除访问控制例表:router(config)#no access-list 102router(config-if)#no ip access-group 101 in 路由器的nat配置外部网关协议配置:配置PPP验证:3.PIX防火墙命令1. 交换机支持的命令:交换机基本状态:switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname ;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(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(config)#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 1switch(config-if)#ip address ;设置IP地址switch(config)#ip default-gateway ;设置默认网关switch#dir flash: ;查看闪存交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息2. 路由器支持的命令:路由器显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动路由器口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname ;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#login ;要求口令验证router(config-line)#password xx ;设置登录口令xxrouter(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address ;设置IP地址router(config-if)#ip address second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address ;设置子接口IProuter(config-subif.1)#encapsulation dot1q ;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset ;重新引导rommon>copy xmodem: flash: ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IPrommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IPrommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS静态路由:ip route ;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。
Cisco思科光纤交换机配置常用命令介绍交换机除了能够连接同种类型的网络之外,还可以在不同类型的网络(如以太网和快速以太网)之间起到互连作用。
你还在为不知道Cisco思科光纤交换机配置说明而烦恼么?下面小编为大家收集的Cisco思科光纤交换机配置说明教程,希望能帮到大家,一起来看看吧!Cisco思科光纤交换机配置说明的方法1. 初始化信息首次设置,必须通过console进行连接(需要U口转DB9针的接口线,专门卖接口线的有卖大约30元),然后进行初始化设计,以后设定IP后可通过LAN进行登陆具体步骤:(红色字体部分着重注意,需要进行设置,大部分按照默认设置即可,而且设置的部分进入管理工具软件可以更改) ---- System Admin Account Setup ----Enter the password for "admin": passwordConfirm the password for "admin": password--- Basic System Configuration Dialog ---This setup utility will guide you through the basic configuration of the system. Setup configures only enough connectivity for management of the system.Press Enter at any time to skip any dialog. Use ctrl-c at anytime to skip the remaining dialogs.Would you like to enter the basic configuration dialog (yes/no): yCreate another login account (yes/no) [n]:Configure read-only SNMP community string (yes/no) [n]:Configure read-write SNMP community string (yes/no) [n]: Enter the switch name: Pxx-MDS-x (where xx is your pod number and x is the switch number; for example:P01-MDS-1) Continue with Out-of-band (mgmt0) managementconfiguration? (yes/no) [y]:Mgmt0 IPv4 address : <10.0.x.y> (where x is your pod number and y is 5 for MDS-1 and 3 for MDS-2)(客户)0.16 Mgmt0 IPv4 netmask : 255.255.255.0Configure the default gateway? (yes/no) [y]:IPv4 address of the default gateway : 10.0.x.254 (where x is your pod number)Configure advanced IP options? (yes/no) [n]:Enable the telnet service? (yes/no) [y]:Enable the ssh service? (yes/no) [n]:Configure the ntp server? (yes/no) [n]:Configure default switchport interface state (shut/noshut) [shut]: (注意一下)noshutConfigure default switchport trunk mode (on/off/auto) [on]: Configure default zone policy (permit/deny) [deny]:Enable full zoneset distribution (yes/no) [n]:NOTE:初始设定的配置对新的VSAN起作用,即原始VSAN1无这些配置解决办法:1 zone default-zone permit VSAN2 新建 NEW VSAN2 将port转移VSAN2里面。
思科、华为全系列交换机路由器常用命令交换机/路由器配置综合复习交换机/路由器常用命令汇总/sxjd/network本课内容交换机常用命令路由器常用命令2·>Enable 进入特权模式··#Exit#End返回上一级操作模式返回到特权模式·#write memory 或copy running-config startup-config 保存配置文件·#del flash:config.text 删除配置文件(交换机及1700系列路由器)·#del flash:vlan.dat 删除Vlan配置信息(交换机)·(config)# hostname switchA 配置设备名称为switchA 4·(config)#enable secret level 1 0 star配置远程登陆密码为star·(config)#enable secret level 15 0 star 配置特权密码为star·Level 1为普通用户级别,可选为1~15,15为最高权限级别;0表示密码不加密·(config)#enable services web-server 开启交换机WEB管理功能·Services 可选以下:web-server(WEB管理)、telnet-server(远程登陆)等5查看信息·#show running-config查看当前生效的配置信息·#show interface fastethernet 0/3 查看F0/3端口信息·#show interface serial 1/2 查看S1/2端口信息·#show interface 查看所有端口信息·#show ip interface brief 以简洁方式汇总查看所有端口信息·#show ip interface 查看所有端口信息·#show version 查看版本信息6查看信息·#show mac-address-table 查看交换机当前MAC 地址表信息·#show running-config 查看当前生效的配置信息··#show vlan#show vlan id 10查看所有VLAN信息查看某一VLAN (如VLAN10)的信息·#show interface fastethernet 0/1 switchport 查看某一端口模式(如F 0/1)·#show aggregateport 1 summary 查看聚合端口AG1的信息7查看信息·#show spanning-tree 查看生成树配置信息·#show spanning-tree interface fastethernet 0/1 查看该端口的生成树状态·#show port-security 查看交换机的端口安全配置信息·#show port-security address 查看地址安全绑定配置信息·#show ip access-lists listname 查看名为listname的列表的配置信息·#show access-lists 8端口的基本配置·(config)#Interface fastethernet 0/3 进入F0/3的端口配置模式·(config)#interface range fa 0/1-2,0/5,0/7- 9 进入F0/1、F0/2、F0/5、F0/7、F0/8、F0/9的端口配置模式·(config-if)#speed 10 配置端口速率为10M,可选10,100,auto9端口的基本配置·(config-if)#duplex full 配置端口为全双工模式,可选full(全双工),half(半双式),auto(自适应)··(config-if)#no shutdown 开启该端口(config-if)#switchport access vlan 10 将该端口划入VLAN10中,用于VLAN·(config-if)#switchport mode trunk将该端口设为trunk模式, 可选模式为access , trunk ·(config-if)#port-group 1 将该端口划入聚合端口AG1中,用于聚合端口10聚合端口的创建·(config)# interface aggregateport 1 创建聚合接口AG1·(config-if)# switchport mode trunk 配置并保证AG1为 trunk 模式·(config)#int f0/23-24·(config-if-range)#port-group 1 将端口(端口组)划入聚合端口AG1中11生成树·(config)#spanning-tree 开启生成树协议·(config)#spanning-tree mode stp 指定生成树类型为stp可选模式stp , rstp , mstp·(config)#spanning-tree priority 4096 设置交换机的优先级为4096 , 优先级值小为高。
CISCO思科交换机3650G配置命令⼤全CISCO思科交换机3650G配置命令⼤全1.在基于IOS的交换机上设置主机名/系统名: switch(config)# hostname hostname在基于CLI的交换机上设置主机名/系统名: switch(enable) set system name name-string 2.在基于IOS的交换机上设置登录⼝令:switch(config)# enable password level 1 password 在基于CLI的交换机上设置登录⼝令: switch(enable) set password switch(enable) set enalbepass3.在基于IOS的交换机上设置远程访问: switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmask switch(config-if)# ip default-gateway ip-address 在基于CLI的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway 4.在基于IOS的交换机上启⽤和浏览CDP信息: switch(config-if)# cdp enable switch(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|capabilities|detail] 5.基于IOS的交换机的端⼝描述:switch(config-if)# description description-string 基于CLI的交换机的端⼝描述:switch(enable)set port name module/number description-string 6.在基于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/number switch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-num switch(config-if)# end在基于CLI的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list 9. 在基于IOS的交换机上配置VLAN中继线:switch(config)# interface interface mod/port switch(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|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate] 10.在基于IOS的交换机上配置VTP管理域: switch# vlan database switch(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|transparent }][password password] 12. 在基于IOS的交换机上配置VTP版本: switch# vlan database switch(vlan)# vtp v2-mode在基于CLI的交换机上配置VTP版本: switch(enable) set vtp v2 enable13. 在基于IOS的交换机上启动VTP剪裁: switch# vlan database switch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP剪裁: switch(enable) set vtp pruning enable 14.在基于IOS的交换机上配置以太信道:switch(config-if)# port group group-number [distribution {source|destination}] 在基于CLI的交换机上配置以太信道:switch(enable) set port channel moudle/port-range mode{on|off|desirable|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-priority 在基于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-second] 在基于CLI的交换机端⼝上启⽤或禁⽤UplinkFast 特征:switch(enable) set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]20. 为了将交换机配置成⼀个集群的命令交换机,⾸先要给管理接⼝分配⼀个IP地址,然后使⽤下列命令: switch(config)# cluster enable cluster-name 21. 为了从⼀条中继链路上删除VLAN,可使⽤下列命令: switch(enable) clear trunk module/port vlan-range 22. ⽤show vtp domain 显⽰管理域的VTP参数. 23. ⽤show vtp statistics显⽰管理域的VTP参数. 24. 在Catalyst交换机上定义TrBRF的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridge bridge-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-num 27. 命令show spantree显⽰⼀个交换机端⼝的STP状态.28. 配置⼀个ELAN的LES和BUS,可以使⽤下列命令:ATM (config)# interface atm number.subint multioint ATM(config-subif)# lane serber-bus ethernet elan-name 29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-address ATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-address ATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接⼝上启动LECS.命令如下: ATM(config)# interface atm numberATM(config-if)# lane config database database-name ATM(config-if)# lane config auto-config-atm-address 31. 将每个LEC配置到⼀个不同的ATM⼦接⼝上.命令如下: ATM(config)# interface atm number.subint multipoint ATM(config)# lane client ethernet vlan-num elan-num 32. ⽤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-string router(config-if)# ip address ip-addr subnet-mask router(config-if)# no shutdown 38. ⽤中继链路来建⽴与VLAN的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl|dotlq] vlan-number router(config-if)# ip address ip-address subnet-mask 39. ⽤LANE 来建⽴与VLAN的连接:router(config)# interface atm module/port router(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaal router(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-mask router(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-name router(config-if)# lane client ethernet elan-name router(config-if)# …40. 为了在路由处理器上进⾏动态路由配置,可以⽤下列IOS命令来进⾏: router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-number router(config-router)# network ip-network-number 41. 配置默认路由:switch(enable) set ip route default gateway42. 为⼀个路由处理器分配VLANID,可在接⼝模式下使⽤下列命令: router(config)# interface interface number router(config-if)# mls rp vlan-id vlan-id-num 43. 在路由处理器启⽤MLSP: router(config)# mls rp ip44. 为了把⼀个外置的路由处理器接⼝和交换机安置在同⼀个VTP域中: router(config)# interface interface number44. 为了把⼀个外置的路由处理器接⼝和交换机安置在同⼀个VTP域中: router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name 45. 查看指定的VTP域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM或路由器上的管理接⼝,可以在接⼝模式下输⼊下列命令: router(config-if)#mls rp management-interface 47. 要检验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 agingtime 53. 设置快速⽼化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显⽰交换机引⽤列表中的内容再确定: switch(enable) show mls include 55. 显⽰MLS⾼速缓存记录: switch(enable) show mls entry56. ⽤命令show in arp显⽰ARP⾼速缓存区的内容。
思科交换机的基本配置命令学习CISCO交换机基本配置:Console端口连接交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname csico ;设置交换机的主机名switch(config)#enable secret csico1 ;设置特权加密口令switch(config)#enable password csico8 ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;虚拟终端允许登录switch(config-line)#password csico6 ;设置虚拟终端登录口令csico6 switch#exit ;返回命令switch(config)#int f0/1 ;进入端口1switch(config)#speed ? 查看speed命令的子命令switch(config)#speed 100 设置该端口速率为100mb/s (10/auto) switch(config)#duplex ? 查看duplex的子命令switch(config)#duplex full 设置该端口为全双工(auto/half)switch(config)#description TO_PC1 这是该端口描述为TO_PC1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2switch(config-if)#switchport mode trunk ;设置为trunk模式(access 模式)switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlanswitch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain vtpserver ;设置vtp域名相同switch(config)#vtp password ;设置发vtp密码switch(config)#vtp server ;设置vtp服务器模式switch(config)#vtp client ;设置vtp客户机模式交换机设置IP地址,默认网关,域名,域名服务器,配置和查看MAC地址表:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address 192.168.1.1 255.255.255.0 ;设置IP 地址switch(config)#ip default-gateway 192.168.1.6 ;设置默认网关switch(config)#ip domain-name 设置域名switch(config)#ip name-server 192.168.1.18 设置域名服务器switch(config)#mac-address-table? 查看mac-address-table的子命令switch(config)#mac-address-table aging-time 100 设置超时时间为100msswitch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3加入永久地址在f0/3端口switch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址目标端口f0/6源端口f0/7switch(config)#endswitch#show mac-address-table 查看整个MAC地址表switch#clear mac-address-table restricted static 清除限制性静态地址交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息switch#show int f0/0 status;查看指定端口状态switch#dir flash: ;查看闪存(1)模式转换命令用户模式----特权模式,使用命令"enable"特权模式----全局配置模式,使用命令"config t"全局配置模式----接口模式,使用命令"interface 接口类型接口号"全局配置模式----线控模式,使用命令"line 接口类型接口号"注:用户模式:查看初始化的信息.特权模式:查看所有信息、调试、保存配置信息全局模式:配置所有信息、针对整个路由器或交换机的所有接口接口模式:针对某一个接口的配置线控模式:对路由器进行控制的接口配置(2)配置命令show running config 显示所有的配置show versin 显示版本号和寄存器值shut down 关闭接口no shutdown 打开接口ip add ip地址配置IP地址secondary IP地址为接口配置第二个IP地址show interface 接口类型接口号查看接口管理性show controllers interface 查看接口是否有DCE电缆【VLAN的基本配置命令】创建配置vlan1、从特权模式进入vlan模式,交换机添加VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:Switch>Switch>enSwitch#vlan database ;进入VLAN设置% Warning: It is recommended to configure VLAN from config mode,as VLAN database mode is being deprecated. Please consult userdocumentation for configuring VTP/VLAN in config mode.switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#vlan 3 name vlan3 ;建VLAN 3并命名为vlan3 switch(vlan)#no vlan 2 ;删vlan 2如下实例:Switch(vlan)#vlan 2 name yv1VLAN 2 added:Name: yv1Switch(vlan)#vlan 3 name yv2VLAN 3 added:Name: yv2Switch(vlan)#vlan 4 name yv3VLAN 4 added:Name: yv3Switch(vlan)#exit 保存退出APPLY completed.Exiting....划端口进VLAN首先进入用户模式“<Sw>"在用户模式下输入”en“,进入特权模式”Sw#<switch>enswitch#在特权模式下输入”configure terminal“,进入全局模式”Sw(config)#switch#configure terminalswitch#(config)#接下来在全局模式下进入接口模式,输入”int range f0/1-3“,这里注意了使用range参数才可以进入多接口,这里选择f0/1、f0/2、f0/3,三个接口。
思科交换机-常⽤命令及配置switch> ⽤户模式1:进⼊特权模式enableswitch> enableswitch#
2:进⼊全局配置模式configure terminalswitch> enableswitch#configure terminalswitch(conf)#
3:交换机命名hostname name 以cisco001 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname cisco001cisco001(conf)#
4:配置使能⼝令(未加密)enable password cisco 以cisco 为例switch> enableswitch#configure terminalcisco001(conf)# enable password cisco
5:配置使能密码(加密)enable secret ciscolab 以cicsolab 为例switch> enableswitch#configure terminalswitch(conf)# enable secret ciscolab
6:设置虚拟局域⽹vlan 1 interface vlan 1switch> enableswitch#configure terminalswitch(conf)# interface vlan 1switch(conf)# ip address 192.168.1.1 255.255.255.0 配置交换机端⼝ip 和⼦⽹掩码switch (conf-if)#no shut 激活端⼝switch (conf-if)#exitswitch (conf)#ip default-gateway 192.168.254 设置⽹关地址 7:进⼊交换机某⼀端⼝interface fastehernet 0/17 以17 端⼝为例switch> enableswitch#configure terminalswitch(conf)# interface fastehernet 0/17switch(conf-if)#
思科交换机基本配置实例讲解目录1、基本概念介绍 (1)2、密码、登陆等基本配置 (1)3、CISCO设备端口配置详解 (7)4、VLAN的规划及配置 (12)4.1核心交换机的相关配置 (12)4.2接入交换机的相关配置 (24)5、配置交换机的路由功能 (29)6、配置交换机的DHCP功能 (30)7、常用排错命令 (31)1、基本概念介绍IOS: 互联网操作系统,也就是交换机和路由器中用的操作系统VLAN: 虚拟lanVTP: VLAN TRUNK PROTOCOLDHCP: 动态主机配置协议ACL:访问控制列表三层交换机:具有三层路由转发能力的交换机本教程中“#”后的蓝色文字为注释内容。
2、密码、登陆等基本配置本节介绍的内容为cisco路由器或者交换机的基本配置,在目前版本的cisco交换机或路由器上的这些命令是通用的。
本教程用的是cisco的模拟器做的介绍,一些具体的端口显示或许与你们实际的设备不符,但这并不影响基本配置命令的执行。
Cisco 3640 (R4700) processor (revision 0xFF) with 124928K/6144K bytes of memory. Processor board ID 00000000R4700 CPU at 100MHz, Implementation 33, Rev 1.22 Ethernet interfaces8 Serial interfacesDRAM configuration is 64 bits wide with parity enabled.125K bytes of NVRAM.8192K bytes of processor board System flash (Read/Write)--- System Configuration Dialog ---Would you like to enter the initial configuration dialog? [yes/no]: n# 此处我们选择no,不进入他的初始化配置向导Press RETURN to get started!# 选择no以后,提示你按回车键开始,此处我们需要按回车键*Mar 1 00:43:56.591: %IP-5-WEBINST_KILL: Terminating DNS process*Mar 1 00:43:58.379: %SYS-5-RESTART: System restarted --Cisco IOS Software, 3600 Software (C3640-JK9O3S-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)Technical Support: /techsupportCopyright (c) 1986-2006 by Cisco Systems, Inc.Compiled Wed 22-Mar-06 21:46 by pwade*Mar 1 00:43:58.411: %SNMP-5-COLDSTART: SNMP agent on host Router is undergoing a cold startRouter># 等显示稳定后,出现最初的提示符,注意提示符是“>”,目前所处的状态称为用户模式。
思科交换机配置命令大全switch>用户模式1:进入特权模式enableswitch>enableswitch#2:进入全局配置模式configureterminalswitch>enableswitch#configureterminal3switch4switch5switch6switch7switch#configureterminalswitch(conf)#hostnameaptch2950aptech2950(conf)#interfacefastehernet0/17aptech2950(conf-if)#8:查看命令showswitch>enableswitch#showversion察看系统中的所有版本信息showinterfacevlan1查看交换机有关ip协议的配置信息showrunning-configure查看交换机当前起作用的配置信息showinterfacefastethernet0/1察看交换机1接口具体配置和统计信息showmac-address-table查看mac地址表showmac-address-tableaging-time查看mac地址表自动老化时间9:交换机恢复出厂默认恢复命令switch>enableswitch#erasestartup-configureswitch#reload10:双工模式设置switch>enableswitch#configureterminalswitch2950(conf)#hostnameaptch-2950aptech2950(conf)#interfacefastehernet0/17以17端口为例11:cdp12:在查看把“执行把“把“”:13switchaptech2950(conf)#interfacefastethernet0/1以17端口为telnet远程登录端口aptech2950(conf-if)#noshutaptech2950(conf-if)#exitaptech2950(conf)linevty04设置0-4个用户可以telnet远程登陆aptech2950(conf-line)#loginaptech2950(conf-line)#passwordedge以edge为远程登录的用户密码主机设置:运行:进入telnet远程登录界面password:edgeaptech2950>enpassword:ciscoaptech#14:交换机配置的重新载入和保存设置完成交换机的配置后:aptech2950(conf)#reload是否保存(y/n)y:保存设置信息n:不保存设置信息1.在基于IOS的交换机上设置主机名/系统名:switch(config)#hostnamehostname在基于CLI的交换机上设置主机名/系统名:switch(enable)setsystemnamename-string2.在基于3.在基于4.在基于5.基于基于CLI的交换机的端口描述:switch(enable)setportnamemodule/numberdescription-string 6.在基于IOS的交换机上设置端口速度:switch(config-if)#speed{10|100|auto}在基于CLI的交换机上设置端口速度:switch(enable)setportspeedmoudle/number{10|100|auto} switch(enable)setportspeedmoudle/number{4|16|auto}7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)#duplex{auto|full|half}在基于CLI的交换机上设置以太网的链路模式:switch(enable)setportduplexmodule/number{full|half} 8.在基于IOS的交换机上配置静态VLAN:switch#vlandatabaseswitch(vlan)#vlanvlan-numnamevlaswitch(vlan)#exitswitch#configureteriminalswitch(config)#interfaceinterfacemodule/number switch(config-if)#switchportmodeaccessswitch(config-if)#switchportaccessvlanvlan-num switch(config-if)#end在基于CLI的交换机上配置静态VLAN:9.在基于10.在基于11.在基于ord]12.switch#vlandatabaseswitch(vlan)#vtpv2-mode在基于CLI的交换机上配置VTP版本:switch(enable)setvtpv2enable13.在基于IOS的交换机上启动VTP剪裁:switch#vlandatabaseswitch(vlan)#vtppruning在基于CLI的交换机上启动VTP剪裁:switch(enable)setvtppruningenable14.在基于IOS的交换机上配置以太信道:switch(config-if)#portgroupgroup-number[distribution{source|destination}]在基于CLI的交换机上配置以太信道:switch(enable)setportchannelmoudle/port-rangemode{on|off|desirable|auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)#spanning-tree[vlanvlan-list]costcost在基于CLI的交换机上调整根路径成本:switch(enable)setspantreeportcostmoudle/portcostswitch(enable)setspantreeportvlancostmoudle/port[costcost][vlan-list]16.在基于IOS的交换机上调整端口ID:switch(config-if)#spanning-tree[vlanvlan-list]port-priorityport-priority在基于CLI的交换机上调整端口ID:17.在基于18.在基于19.在基于|on]20.列命令21.22.用23.用24.在Catalyst交换机上定义TrBRF的命令如下:switch(enable)setvlanvlan-name[namename]typetrbrfbridgebridge-num[stp{ieee|ibm}] 25.在Catalyst交换机上定义TrCRF的命令如下:switch(enable)setvlanvlan-num[namename]typetrcrf{ringhex-ring-num|decringdecimal-ring-num}parentvlan-num26.在创建好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-nameATM(lane-config-databade)#nameelan1-nameserver-atm-addressles1-nsap-address ATM(lane-config-databade)#nameelan2-nameserver-atm-addressles2-nsap-address ATM(lane-config-databade)#name…30.创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)#interfaceatmnumberATM(config-if)#laneconfigdatabasedatabase-nameATM(config-if)#laneconfigauto-config-atm-address31.32.用33.用34.用35.用36.用37.38.39.用router(config-if)#laneclientethernetelan-numrouter(config-if)#interfaceatmmodule/port.subinterfacemultipointrouter(config-if)#ipaddressip-addresssubnet-namerouter(config-if)#laneclientethernetelan-namerouter(config-if)#…40.为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行:router(config)#iproutingrouter(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-num43.在路由处理器启用MLSP:router(config)#mlsrpip44.为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)#interfaceinterfacenumberrouter(config-if)#mlsrpvtp-domaindomain-name45.查看指定的VTP域的信息:46.47.48.49.50.为使51.52.53.54.55.显示56.57.58.router(config-if)#standygroup-numberpreempt59.访问时间和保持时间参数是可配置的:router(config-if)#standygroup-numbertimershellotimeholdtime60.配置HSRP跟踪:router(config-if)#standygroup-numbertracktype-numberinterface-priority 61.要显示HSRP路由器的状态:router#showstandbytype-numbergroupbrief62.用命令showipigmp确定当选的查询器。
交换机的常用操作项1、更改主机名switch(config)#hostname sw12、设置进入特权模式的密码switch(config)#enable password 1234switch(config)#enable secret cisco3、设置console口密码switch(config)#line console 0switch(config-line)#password 123switch(config-line)#login4、查看mac地址列表switch#show mac-address-table5、查看mac地址列表刷新时间switch#show mac-address-table aging-time6、更改mac地址列表刷新时间switch(config)#mac-address-table aging-time 200 7、查看当前配置(RAM)switch#show running-config8、查看交换机的配置(NVRAM)switch#show startup-config9、保存配置switch#copy running-config startup-configswitch#write10、恢复出厂默认设置switch#erase startup-configswitch#reload11、查看cdp的全局信息switch#show cdp12、查看接口的cdp配置信息switch#show cdp interface f0/213、查看有关cdp包的统计信息switch#show cdp traffic14、查看邻居信息switch#show cdp neighbors15、查看所有入口项的详细信息switch#show cdp neighbors detailswitch#show cdp entry *16、添加接口的描述信息switch(config-if)# description connection to routerA 17、设置交换机的网关switch(config)#ip default-gateway 192.168.1.118、关掉DNS解析switch(config)# no ip domain-lookup19、实现交换机的远程管理switch(config)#enable secret ciscoswitch(config)#interface vlan 1switch(config-if)#ip address 192.168.1.100 255.255.255.0switch(config-if)#no shutdownswitch(config)#line vty 0 4switch(config-line)#password 123switch(config-line)#loginc:\>telnet 192.168.1.10020、交换机的密码恢复1、将交换机的电源拔下2、按mode键将电源插上,当出现switch:时将手松开3、switch:flash_init //加载到flash中4、switch:dir flash: //查看flash中的文件5、rename flash:config.text flash:config.old //更改文件名6、boot //重新启动交换机7、rename flash:config.old flash:config.text //将文件名改回8、copy flash:config.text running-config9、enable password cisco //重新设置密码10、write //保存21、创建vlan方法一switch#vlan databaseswitch(vlan)#vlan 10 name scswitch(vlan)#exit22、创建vlan方法二switch(config)#vlan 10switch(config-vlan)#name sc23、删除vlan方法一switch(vlan)#no vlan 10switch(vlan)#exit24、删除vlan方法二switch(config)#no vlan 1025、删除vlan方法三switch#delete vlan.dat26、将端口加入到vlan中switch(config-if)#switchport access vlan 1027、将一组连续的端口加入到vlan中switch(config)# interface range f0/1 – 5 (端口范围管理switch(config-if-range)#switchport access vlan 10 端口范围管理模式28、将端口从vlan中删除switch(config-if)#no switchport access vlan 10switch(config-if)#switchport access vlan 1switch(config-if-range)#no switchport access vlan 10 switch(config-if-range)#switchport access vlan 1 29、查看所有vlan的摘要信息switch#show vlan brief30、查看指定vlan的信息switch#show vlan id 1031、指定端口成为trunkswitch(config-if)#switchport mode trunk 两个端口全要设成trunk32、Trunk的自动协商switch(config-if)#switchport mode dynamic desirable switch(config-if)#switchport mode dynamic auto注意:如果中继链路两端都设置成auto将不能成为trunk 33、查看端口状态switch#show interface f0/24 switchport34、在trunk上移出vlanswitch(config-if)#switchport trunk allowed vlan remove 235、在trunk上添加vlanswitch(config-if)#switchport trunk allowed vlan add236、Cisco 2600路由器的基本操作从用户模式进入特权模式router>enablerouter#从特权模式进入全局配置模式router#config terminalrouter(config)#为路由器配置主机名router(config)#hostname teacherteacher(config)#进入路由器的以太口配置模式teacher(config)#interface fastethernet 0/0teacher(config_if)#37、查看Cisco 2600路由器的串口状态router#show interface serial 0/0serial 0/0 is up ,line protocol is up可操作状态………serial 0/0 is up ,line protocol is up连接问题…………serial 0/0 is up ,line protocol is down接口问题…………serial 0/0 is down ,line protocol isdown禁用状态…………serial 0/0 is administratively down ,line protocol is down38、 静态路由的实现router(config)#hostname AA(config)#interface f0/0 A(config-if)#ip address 192.168.1.1 255.255.255.0 A(config-if)#no shutdownA(config)#interface f0/1A(config-if)#ip address 192.168.2.1 255.255.255.0 A(config-if)#no shutdownA(config)#iproute 192.168.3.0 255.255.255.0 192.168.2.2B(config)#iproute 192.168.1.0 255.255.255.0 192.168.2.139、 配置默认路由route(config)#ip route 0.0.0.0 0.0.0.0 下一跳地址40、 查看路由表router#show ip route其中C 代表直连的网络,S 代表静态的路由,S*代表默认的路由 192.168.1.1 192.168.2.2 192.168.2.1 192.168.3.1 192.168.1.10 192.168.3.1041、为Cisco 2600路由器配置密码配置控制台密码router (config)#line console 0router (config-line)# password ciscorouter (config-line)# login42、配置特权模式密码router (config)#enable password cisco43、配置安全的加密密码router (config)#enable secret 123444、配置路由器标识router(config)#banner motd $This is Aptech company’s Router! Please don’t change the configuration whithout permissions$45、对所有密码进行加密router (config)#service password-encryption46、配置超时router(config)#line console 0router(config-line)#exec-timeout 0 0 //第一个0代表分钟,第二个0代表秒47、显示同步router(config)#line console 0router(config-line)#logging synchronous48、配置禁用DNSrouter(config)#no ip domain-lookup49、利用三台路由器实现静态路由和默认路由50、路由器密码恢复重启路由器按Ctrl+Break键进入ROM Monitor 模式rommon 1>confreg 0x2142rommon 2>reset重启后选择norouter>enablerouter#copy startup-config running-configrouter#config terminalrouter(config)#enable password ciscorouter(config)#config-register 0x2102router#copy running-config startup-configrouter#reload51、单臂路由——实现不同vlan之间的通信V L A N11、划分vlanswitch#vlan databaseswitch(vlan)#vlan 2写NAME,不行,switch(vlan)#vlan 3switch(vlan)#exit2、将端口加入vlanswitch(config)#interface range f0/6 -8switch(config-if-range)#switchport access vlan 2 switch(config-if-range)# interface range f0/9 -11 switch(config-if-range)#switchport access vlan 3 3、配置trunkswitch(config)#interface f0/12switch(config-if)#switchport mode trunk4、配置路由器的子接口封装dot1q,并设置IP地址router(config)#interface f0/0.1router(config-subif)#encapsulation dot1q 1router(config-subif)#ip address 192.168.0.1 255.255.255.0router(config-subif)#no shutrouter(config)#interface f0/0.2router(config-subif)#encapsulation dot1q 2router(config-subif)#ip address 192.168.1.1 255.255.255.0router(config-subif)#no shutrouter(config)#interface f0/0.3router(config-subif)#encapsulation dot1q 3router(config-subif)#ip address 192.168.2.1 255.255.255.0router(config-subif)#no shutrouter(config)#interface f0/0router(config-if)#no shut5、设置pc的IP地址和默认网关52、RIP版本V1和V2 的区别RIP v1发送路由更新时不携带子网掩码,属于有类路由协议发送路由更新时,目标地址为广播地址:255.255.255.255RIP v2发送路由更新时携带子网掩码,属于无类路由协议发送路由更新时,目标地址为组播地址:224.0.0.953、 RIP V1的配置配置步骤:1、配置路由器接口IP 地址routerA(config)#interface f0/0routerA(config-if)#ipaddress 192.168.1.1 255.255.255.0routerA(config-if)#no shutdownrouterA(config-if)#interface f0/1routerA(config-if)# ip address 10.0.0.2 255.0.0.0routerA(config-if)#no shutdownrouterB(config)#interface f0/0routerB(config-if)#ip address 10.0.0.1 255.0.0.0 192.168.2.0/24192.168.1.0/24routerB(config-if)#no shutdownrouterB(config)#interface f0/1routerB(config-if)#ip address 20.0.0.2 255.0.0.0 routerB(config-if)#no shutdownrouterC(config)#interface f0/0routerC(config-if)#ip address 20.0.0.1 255.0.0.0 routerC(config-if)#no shutdownrouterC(config)#interface f0/1routerC(config-if)#ip address 192.168.2.2 255.255.255.0routerC(config-if)#no shutdown2、在路由器上启动RIP进程,并宣告网络号:routerA(config)#router riprouterA(config-router)#network 10.0.0.0routerA(config-router)#network 192.168.1.0routerB(config)#router riprouterB(config-router)#network 10.0.0.0routerB(config-router)#network 20.0.0.0routerC(config)#router riprouterC(config-router)#network 20.0.0.0routerC(config-router)#network 192.168.2.03、验证配置是否正确1)查看路由表router#show ip route2)查看路由协议配置router#show ip protocols3)打开RIP协议调试命令router#debug ip rip4)退出router# no debug ip rip4、在PC上设置IP地址、子网掩码、默认网关,用ping命令测试连通性54、RIP V2的配置10.1.1.0/24 192.168.1.0/241、配置各路由器接口IP地址routerA(config)#interface f0/0routerA(config-if)#ip address 10.1.1.1 255.255.255.0routerA(config-if)#no shutdownrouterA(config-if)#interface f0/1routerA(config-if)# ip address 192.168.1.1 255.255.255.0routerA(config-if)#no shutdownrouterB(config)#interface f0/0routerB(config-if)#ip address 10.1.2.1 255.255.255.0routerB(config-if)#no shutdownrouterB(config)#interface f0/1routerB(config-if)#ip address 192.168.1.2 255.255.255.0routerB(config-if)#no shutdownrouterC(config)#interface f0/0routerC(config-if)#ip address 192.168.1.3 255.255.255.0routerC(config-if)#no shutdownrouterC(config)#interface f0/1routerC(config-if)#ip address 192.168.2.1 255.255.255.0routerC(config-if)#no shutdown2、在路由器上配置RIP V2 路由协议routerA(config)#router riprouterA(config-router)#version 2routerA(config-router)#no auto-summary不合并同段网络routerA(config-router)#network 10.0.0.0 routerA(config-router)#network 192.168.1.0 routerB(config)#router riprouterB(config-router)#version 2routerB(config-router)# no auto-summary routerB(config-router)#network 10.0.0.0 routerB(config-router)#network 192.168.1.0 routerC(config)#router riprouterC(config-router)# version 2routerC(config-router)# no auto-summary routerC(config-router)#network192.168.1.0 routerC(config-router)#network 192.168.2.0 3、验证配置是否正确1)查看路由表router#show ip route2)查看路由协议配置router#show ip protocols3)打开RIP协议调试命令router#debug ip rip4、在PC上设置IP地址、子网掩码、默认网关,用ping命令测试连通性55、上传路由器上的IOSrouter#show flash //查看IOS文件名router#copy flash tftpSource filename []? c2600-ik8o3s-mz.122-11.T.binAddress or name of remote host []? 192.168.1.11Destination filename [c2600-ik8o3s-mz.122-11.T.bin]?下载IOS到路由器router#copy tftp flash上传路由器上配置文件router#copy nvram:startup-config tftp:Address or name of remote host []? 192.168.1.11Destination filename [router-config]? startup-config下载配置文件到路由器router#copy tftp:startup-config nvramC2600路由器IOS被删除的恢复方法:1、ctrl+breakrommon 1>IP_ADDRESS=192.168.0.100 //路由器接口地址rommon 2>IP_SUBNET_MASK=255.255.255.0rommon 3>DEFAULT_GATEWAY=192.168.0.100rommon 4>TFTP_SERVER=192.168.0.254rommon 5>TFTP_FILE=c2600-ik8o3s-mz.122-11.T.binrommon 6>tftpdnld希望各位学员努力学习,将交换机和路由器的操作命令练会、练熟学如逆水行舟,不进则退。
思科交换机命令大全1.设置主机名/系统名IOS:switch(config)# hostname "hostname"CLI:switch(enable) set system name name-string2.设置登录口令IOS:switch(config)# enable password level 1 passwordCLI: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-addressCLI:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.启用和浏览CDP信息IOS:switch(config-if)# cdp enableswitch(config-if)# no cdp enableCLI:switch(enable) set cdp {enable|disable} module/port5.查看Cisco邻接设备的CDP通告IOS:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail] CLI:switch(enable) show cdp neighbors[module/port][vlan|duplex|capabilities|detail]6.端口描述 IOS:switch(config-if)#description escription-stringCLI:switch(enable)set port name module/number description-string 7.设置端口速度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}8.设置以太网的链路模式IOS:switch(config-if)# duplex {auto|full|half}CLI:switch(enable) set port duplex module/number {full|half}9.配置静态VLANIOS: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)# endCLI:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list10.配置VLAN中继线IOS: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-listswitch(config-if)# switchport trunk allowed vlan add vlan-list CLI:switch(enable)set trunk module/port[on|off|desirable|auto|nonegotiate]Vlan-range [isl|dotlq|dotl0|lane|negotiate]11.配置VTP管理域IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameCLI:switch(enable) set vtp [domain domain-name]12.配置VTP 模式IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password passwordCLI:switch(enable) set vtp [domain domain-name][mode{ sever|cilent|transparent }][password password]13.配置VTP版本IOS:switch# vlan databaseswitch(vlan)# vtp v2-modeCLI:switch(enable) set vtp v2 enable14.启动VTP剪裁IOS:switch# vlan databaseswitch(vlan)# vtp pruningCLI:switch(enable) set vtp pruning enable15.配置以太信道IOS:switch(config-if)# port group group-number [distribution{source|destination}] CLI:switch(enable) set port channel moudle/port-rangemode{on|off|desirable|auto}16.调整根路径成本IOS:switch(config-if)#spanning-tree [vlan vlan-list] cost costCLI:switch(enable)set spantree portcost moudle/port costswitch(enable)set spantree portvlancost moudle/port [costcost][vlan-list]17.调整端口IDIOS:switch(config-if)#spanning-tree[vlan vlan-list]port-priorityport-priorityCLI:switch(enable)set spantree portpri {mldule/port}priority switch(enable)set spantree portvlanpri {module/port}priority [vlans]18.修改STP时钟IOS:switch(config)# spanning-tree [vlan vlan-list] hello-time seconds switch(config)#spanning-tree [vlan vlan-list] forward-time secondsswitch(config)#spanning-tree [vlan vlan-list] max-age secondsCLI:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]19.启用或禁用Port Fast 特征IOS:switch(config-if)#spanning-tree portfastCLI:switch(enable)set spantree portfast {module/port}{enable|disable} 20.启用或禁用UplinkFast 特征IOS:switch(config)#spanning-tree uplinkfast [max-update-ratepkts-per-second]CLI:switch(enable)set spantree uplinkfast {enable|disable}[rate为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个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 bridge-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-addressles1-nsap-addressATM(lane-config-databade)# name elan2-name server-atm-addressles2-nsap-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 fastagingtimepkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable) show mls include55. 显示MLS高速缓存记录: switch(enable) show mls entry56. 用命令show in arp显示ARP高速缓存区的内容。
思科路由器|交换机配置命令第一章 实验拓扑、终端服务器配置命令作用R1>enable从用户模式进入特权模式R1#configure terminal进入配置模式R1(config)#interface g0/0进入千兆位以太网接口模式R1(config-if)#ip add 172.16.0.1 255.255.255.0配置接口的IP地址R1(config-if)#no shutdown打开接口R1(config)#line vty 0 4进入虚拟终端vty 0~vty 4R1(config-line)#password cisco配置虚拟终端密码为ciscoR1(config-line)#login用户要进入路由器,需要先进行登录Exit退回到上一级模式R1(config)#enable password cisco配置进入特权模式的密码为cisco,密码不加密End (Ctrl+Z)直接回到特权模式R1#show int g0/0显示g0/0接口信息R1(config)#hostname Terminal-Server配置路由器的主机名为Terminal-ServerR1(config)#enable secret cisco配置进入特权模式的密码为cisco,密码加密R1(config)#no ip domain-lookup路由器不使用DNS服务器解析主机的IP地址R1(config-line)#logging synchonous对路由器上的提示信息进行同步,防止信息干扰我们输入命令R1(config)#no ip routing关闭路由器的路由功能R1(config)#ip default-gateway 10.1.14.254配置路由器访问其他网段时所需的网关R1#show line显示各线路的状态R1(config)#line33 48进入33~38线路模式R1(config-line)#transport input all允许所有协议进入线路R1(config)#int loopback0进入Loopback0环回接口R1(config)#ip host R1 1.1.1.1为1.1.1.1主机起一个主机名R1R1(config)#alias exec crl clear line 33为命令起一个别名R1(config)#privilege exec level 0 clear line把命令clear line 的等级改为0,在用户模式下也可以执行它R1(config)#banner motd设置用户登录路由器时的提示信息第二章 路由器基本配置命令汇总命令作用R1#clock set hh:mm:ss month day year设置路由器的时间R1#show clock显示路由器的时间R1#show history显示历史命令R1#terminal no editing关闭CLI的编辑功能R1#terminal editing打开CLI的编辑功能R1#terminal histroy size 50修改历史命令缓冲区的大小R1#copy running-config startup-config把内存中的配置文件保存到NVRAM中R1(config-if)#clock rate 128000配置串口上的时钟(DCE端)R1#show version显示路由器的IOS版本等信息R1#show running-config显示内存中的配置文件R1#show startup-config显示NVRAM中的配置文件R1#show interface s0/0/0显示接口的信息R1#show flash显示FLASH的有关信息R1#show controllers s0/0/0显示s0/0/0的控制器信息R1#show ip arp显示路由器中的arp表R1#copy running-config tftp把内存中的配置文件复制到TFTP服务器上R1#copy tftp running-config把TFTP服务器上的配置文件复制到内存中R1#copy flash tftp把FLASH中的IOS保存到TFTP服务器上rommon 1>confreg 0x2142在rommon模式下修改配置寄存器的值rommon 1>i (boot)在rommon模式下重启路由器R1#copy startup-config running-config把NVRAM中的配置文件复制到内存中R1(config)#config-register 0x2102修改配置寄存器值为0x2102R1#reload重启路由器R1#delete flash删除FLASH中的IOSR1#copy tftp flash从TFTP服务器上复制IOS到FLASH中rommon 1>tftpdnld在rommon模式下,从TFTP服务器下载IOS R1#show cdp显示CDP运行信息R1#show cdp interface显示CDP在各接口的运行情况R1#show cdp neighbors显示CDP邻居信息R1#show cdp entry R2显示CDP邻居R2的详细信息R1#clear cdp table清除CDP邻居表R1(config-if)#no cdp enable接口下关闭CDPR1(config)#no cdp run / cdp run关闭/打开整个路由器的CDPR1(config)#cdp timer 30CDP每30 s发送一次R1(config)#cdp holdtime 120让邻居为本设备发送的CDP消息保持120 s第三章 静态路由命令汇总命令作用R1(config)#ip route 1.1.1.0 255.255.255.0 s0/1配置静态路由R1#show ip route查看路由表R1(config)#ip classless / no ip classless打开/关闭有类路由功能R1#ping 2.2.2.2 source loopback 0指定源端口进行ping 测试第四章 RIP命令汇总命令作用R1#show ip route查看路由表R1#show ip protocols查看IP路由协议配置和统计信息R1#show ip rip database查看RIP数据库R1#debug ip rip动态查看RIP的更新过程R1#clear ip route *清除路由表R1(config)#router rip启动RIP进程R1(config-router)#network 1.0.0.0通告网络R1(config-router)#version 2定义RIP的版本R1(config-router)#no auto-summary关闭自动汇总R1(config-if)#ip rip send version配置RIP发送的版本R1(config-if)#ip rip receive version配置RIP接收的版本R1(config-router)#passive-interface s0/1配置被动接口R1(config-router)#neighbor A.B.C.D配置单播更新的目标R1(config-if)#ip summary-address rip ip mask配置RIP手工汇总R1(config)#key chain lgm定义钥匙链R1(config-keychain)#key <0-2147483647>配置Key IDR1(config-keychain-key)#key-string cisco配置Key ID的密匙R1(config-if)#ip rip triggered配置触发更新R1(config-if)#ip rip authentication mode md5/text配置认证模式R1(config-if)#ip rip authention key-chain lgm配置认证使用的钥匙链R1(config-router)#timers basic配置更新的计时器R1(config-router)#maximum-paths配置等价路径的最大值R1(config)#ip default-network向网络中注入默认路由第五章 EIGR命令汇总命令作用R1#show ip eigrp neighbors查看EIGRP邻居表R1#show ip eigrp topology查看EIGRP拓扑结构数据库R1#show ip eigrp interface查看运行EIGRP路由协议的接口的状况R1#show ip eigrp traffic查看EIGRP发送和接收到的数据包的统计情况R1#debug eigrp neighbors查看EIGRP动态建立邻居关系的情况R1#debug eigrp packets显示发和接收的EIGRP数据包R1(config-if)#ip hello-interval eigrp配置EIGRP的HELLO发送周期R1(config-if)#ip hold-time eigrp配置EIGRP的HELLO hold时间R1(config)#router eigrp number启动EIGRP路由进程R1(config)#no auto-summary关闭自动汇总R1(config-if)#ip authentication mode eigrp配置EIGRP的认证模式R1(config-if)#ip authentication key-chain eigrp在接口上调用钥匙链R1(config-router)#variance配置非等价负载均衡R1(config-if)#delay <1-16777215>配置接口下的延迟R1(config-if)#bandwidth 100配置接口下的带宽R1(config-if)#ip summary-address eigrp手工路由汇总第六章 OSPF命令汇总命令作用R1#show ip route查看路由表R1#show ip ospf neighbor查看OSPF邻居的基本信息R1#show ip ospf database查看OSPF拓扑结构数据库R1#show ip ospf interface查看OSPF 路由器接口的信息R1#show ip ospf查看OSPF进程及其细节R1#debug ip ospf adj查看OSPF邻接关系创建或中断的过程R1#debug ip ospf events显示OSPF发生的事件R1#debug ip ospf packet显示路由器收到的所有的OSPF数据包R1(config)#router ospf process ID启动OSPF路由进程R1(config-router)#router-id 1.1.1.1配置路由器IDR1(config-router)#network 192.168.1.0 0.0.0.255 area ared id通告网络及网络所在的区域R1(config-if)#ip ospf network broadcast / point-to-point配置接口网络类型R1(config-if)#ip ospf cost <1-65535>配置接口Cost值R1(config-if)#ip ospf hello-interval <1-65535>s配置Hello间隔R1(config-if)#ip ospf dead-interval <1-65535>s配置OSPF邻居的死亡时间R1(config-if)#ip ospf priority <0-255>配置接口优先级R1(config-router)#auto-cost reference-bandwidth <1-4294967>配置参考带宽R1#clear ip ospf process清除OSPF进程R1(config-router)#area area-id authentication启动区域简单口令认证R1(config-if)#ip ospf authentication-key cisco配置认证密码R1(config-router)#area area-id authentication message-digest启动区域MD5认证R1(config-if)#ip ospf message-digest-key <1-255> md5 cisco配置key ID及密匙R1(config-if)#ip ospf authentication启用链路简单口令认证R1(config-if)#ip ospf authentication message-digest启用链路MD5认证R1(config-router)#default-information originate向OSPF区域注入默认路由第七章 HDLC、PPP命令汇总命令作用R1(config-if)#encapsulation hdlc把接口的封装改为HDLCR1(config-if)#encapsulation PPP把接口的封装改为PPPR1(config-if)#ppp pap sent-username R1 password 123PAP认证时,向对方发送用户名R1和密码123 R1(config-if)#ppp authentication pap PPP的认证方式为PAPR1(config-if)#user R1 password 123为对方创建用户R1,密码为123R1#debug ppp authentication打开PPP的认证调试过程R1(config-if)#ppp authentication chap PPP的认证方式为CHAP第八章 帧中继命令汇总命令作用R1(config)#frame-relay switching把路由器当成帧中继交换机R1(config-if)#encapsulation frame-relay接口封装成帧中继R1(config-if)#frame-relay lmi-type cisco配置LMI的类型R1(config-if)#frame-relay intf-type dce配置接口是帧中继的DCE还是DTER1(config-if)#frame-relay route dlci interface s0/0 dlci配置帧中继交换表R1#show frame-relay route显示帧中继交换表R1#show frame pvc显示帧中继PVC状态R1#show frame lmi显示帧中继LMI信息R1#show frame-relay map查看帧中继映射R1(config-if)#no frame-relay inverse-arp关闭帧中继自动映射R1(config-if)#ip split-horizon打开水平分割R1(config)#int s0/0/0.1 multipoint创建点到多点子接口R1(config)#int s0/0/0.3 point-to-point创建点到点子接口R1(config-subif)#frame-relay interface-dlci 104在点到点子接口上配置DLCI第九章 ACL命令汇总命令作用R1#show ip access-lists查看所定义的IP访问控制列表R1#clear access-list counters将访问控制列表计数器清零R1(config)#access-list <1-199> permit / deny定义ACLR1(config-if)#ip access-group在接口下应用ACLR1(config-line)#access-class <1-199> in / out在vty下应用ACLR1(config)#ip access-list standard / extended定义命名的ACLR1(config)#time-range time定义时间范围R1(config)#username username password password建立本地数据库R1(config-line)#autocommand定义自动执行的命令第十章 DHCP命令汇总命令作用R1#show ip dhcp pool查看DHCP地址池的信息R1#show ip dhcp binding查看DHCP的地址绑定情况R1#show ip dhcp database查看DHCP数据库R1#show ip interface查看接口信息R1#debug ip dhcp server events动态查看DHCP服务器的事件R1(config)#service dhcp开启DHCP服务R1(config)#no ip dhcp conflict logging关闭DHCP冲突日志R1(config)#ip dhcp pool配置DHCP分配的地址池R1(dhcp-config)#network DHCP服务器要分配的网络的掩码R1(dhcp-config)#default-router默认网关R1(dhcp-config)#domain-name域名R1(dhcp-config)#netbios-name-server WINS服务器R1(dhcp-config)#dns-server域名服务器R1(dhcp-config)#option 150 ip FTP服务器R1(dhcp-config)#lease配置租期R1(dhcp-config)#ip dhcp excluded-address排除地址段R1(config-if)#ip helper-address配置DHCP中继的地址第十一章 NAT命令汇总命令作用R1#clear ip nat translation *清除动态NAT表R1#show ip nat translation查看NAT表R1#show ip nat statistics查看NAT转换的统计信息R1#debug ip nat动态查看NAT转换过程R1(config)#ip nat inside source static配置静态NATR1(config-if)#ip nat inside配置NAT内部接口R1(config-if)#ip nat outside配置NAT外部接口R1(config)#ip nat pool配置动态NAT地址池R1(config)#ip nat inside source list access-list-number pool name配置动态NATR1(config)#ip nat inside source list access-list-numbe r pool name overload配置PAT第十二章 交换机基本配置命令汇总命令作用S1(config-if)#duples {full|half|auto}配置以太口的双工属性S1(config-if)#speed {10|100|1000|auto}配置以太口的速率S1(config)#ip default-gateway 172.16.0.254配置默认网关S1(config-if)#switch mode access把端口以为访问模式S1(config-if)#switch port-security打开交换机的端口安全功能S1(config-if)#switch port-security maximum 1该端口下的MAC条目最大数量为1S1(config-if)#switch port-security violation配置交换机端口安全S1(config-if)#switch port-security mac-address MAC地址允许指定MAC地址的设备接入本接口S1#show mac-address-table显示MAC地址表S1(config-if)#mac-address XXXX.XXXX.XXXX改变接口的MAC地址rename flash;config.text flash;config.old将FLASH中的文件改名copy xmodem; flash;c2950-i6q412-mz.121-22.EA5a.bin通过Xmodem模式把文件复制到FLASH中boot重启交换机第十三章 VLAN、Trunk和VTP命令汇总命令作用S1#vlan database进入到VLAN Database配置模式S1(vlan)#vlan 2 name VLAN2创建VLAN 2S1(config-if)#switch access vlan 2把端口划分到VLAN 2中S1(config)#interface range f0/2 - 3批量配置接口的属性S1#show vlan查看VLAN的信息S1(config-if)#switchport trunk encanpsulation配置Trunk链路的封装类型S1(config-if)#switch mode trunk把接口配置为TrunkS1#show interface f0/13 trunk查看交换机端口的Trunk状态S1(config-if)#switchport nonegotiate Trunk链路上不发送Trunk协商包S1(config)#vtp mode server配置交换机为VTP serverS1(config)#vtp domain NAME配置VTP域名S1(config)#vtp password cisco配置VTP的密码S1(config)#vtp mode client配置交换机为VTP clientS3(vlan)#vtp transparent配置交换机为VTP transparentS1#show vtp status显示VTP的状态S1(config)#vtp pruning启用VTP修剪S1(config)#vtp version 2VTP版本为 2S1(config)#interface port-channel 1创建以太通道S1(config-if)#channel-group 1 mode on把接口加入到以太通道中,并指明以太通道模式S1(config)#port-channel load-balance dst-mac配置EtherChannel的负载平衡方式S1#show etherchannel summary查看EtherChannel的简单信息第十四章 STP命令汇总命令作用S1#show spanning-tree查看STP树信息S1(config)#spanning-tree vlan 1 priority 4096配置VLAN1的桥优先级S1(config)#spanning-tree portfast配置为Portfast,当有设备接入时立即进入转发状态S1(config)#spanning-tree uplinkfast配置Uplinkfast特性S1(config)#spanning-tree backbonefast配置Backbonefast特性S1(config)#spanning-tree mode rapid-pvst把STP的运行模式设为RSTP+PVSTS1(config-if)#spanning-tree link-type point-to-point把接口的链路类型改为点对点S1(config)#spanning-tree mode mst把生成树的模式改为MSTS1(config)#spanning-tree mst configuration进入MST的配置模式S1(config-mst)#name TEST-MST命名MST的名字S1(config-mst)#revision 1配置MST的revision号S1(config-mst)#instance 1 vlan 1-2把VLAN 1和VLAN 2的生成树映射到实例1S1(config-if)##spanning-tree guard root在接口下配置Root Guard特性S1(config-if)#spanning-tree bpduguard enable在接口上配置Bpduguard特性第十五章 VLAN间路由命令汇总命令作用S1(config)#int g0/0.1创建子接口S1(config-subif)#encap dot1q 1 native子接口承载哪个VLAN的流量以及封装类型S1(config)#ip routing打开路由功能S1(config-if)#no switchport接口不作为交换机接口S1(config)#ip cef开启CEF功能。
交换机基本状态:switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname ;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(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(config)#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 1switch(config-if)#ip address ;设置IP地址switch(config)#ip default-gateway ;设置默认网关switch#dir flash: ;查看闪存交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息交换机命令总结基本配置命令Switch >enable 进入特权模式Switch #config terminal 进入全局配置模式Switch (config)#hostname 设置交换机的主机名Switch(config)#enable password 进入特权模式的密码(明文形式保存)Switch(config)#enable secret 加密密码(加密形式保存)(优先)Switch(config)#ip default-gateway 配置交换机网关Switch(config)#show mac-address-table 查看MAC地址Switch(config)logging synchronous 阻止控制台信息覆盖命令行上的输入Switch(config)no ip domain-lookup 关闭DNS查找功能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 进入控制台口switch(config-line)# password xxswitch(config-line)# 设置登录口令login 允许登录<!--[if !supportLineBreakNewLine]--><!--[endif]-->Cisco发现协议(CDP)Switch(config)#show cdp 显示Cisco设备全局配置信息Switch(config)#show cdp interface 端口查看CDP配置下端口信息Switch(config)#show cdp neighbors 显示直连Cisco设备信息Switch(config)#show cdp neighbors detail 查看邻居详细信息<!--[if !supportLineBreakNewLine]--><!--[endif]-->恢复出厂配置Switch(config)#erase startup-configSwitch(config)delete vlan.dat配置接口标识接口标识用于区分路由器的各个接口。
交换机基本状态: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 password 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-timeout和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线路指的是我们进行telnet的时候使用的线路。
一、基本配置switch>enable //进入特权模式switch#config terminal //进入全局配置模式switch(config)#hostname //设置交换机的主机名switch(config)#enable secret xxx //设置进入特权MD5加密口令switch(config)#enable password xxa //设置进入特权明文加密口令switch(config)#line console 0 //进入控制台口switch(config-line)#line vty 0 4 //设置进入虚拟终端的连接数目0~4 5个switch(config-line)#login //允许登录switch(config-line)#password xx //设置登录到普通用户口令xxswitch#exit //返回命令二、交换机vlan的配置switch#vlan database //进入VLAN设置switch(vlan)#vlan 2 //建VLAN 2switch(vlan)#no vlan 2 //删vlan 2Switch(config)# interface range fastethernet 0/1-5 //进入同种类型多端口配置三、端口操作switch(config)#int f0/1 //进入端口1switch(config-if)#switchport access vlan 2 // 将端口1当前端口加入vlan 2 switch(config-if)#switchport mode trunk //将f0/1设置为中继干线switch(config-if)#switchport trunk allowed vlan 1,2 //设置允许通过中继的vlanswitch(config-if)#switchport trunk encap dot1q //设置vlan 中继执行的协议VLAN的端口聚合叫TRUNK,用来在不同的交换机之间进行连接,以保证在跨越多个交换机上建立的同一个VLAN的成员能够相互通讯。
思科模拟器命令: 设置交换机名字为yzh Switch> 进入超级终端控制台 Switch>enable 进入交换机特权模式 Switch# Switch#configure terminal 进入交换机全局配置模式 Switch(configure)#hostname yzh 改变名字为XXX yzh(configure)# 显示改名成功 yzh(configure)#exit 退回上级操作模式,即返回特权模式 yzh# yzh#exit 返回到用户模式 yzh> 参看交换机有关信息 yzh# yzh#configure terminal 进入交换机全局配置模式 yzh#show version 查看交换机的版本信息 yzh#show vlan 查看交换机的VLAN信息,默认情况下所有借口均属于VLAN yzh#show running-config 查看交换机当前生效的配置信息 配置交换机接口f0/2 yzh> yzh>enable yzh# yzh#configure terminal 进入交换机配置模式 yzh(config)#interface fastEthernet 0/2 进入交换机接口fa0/2 yzh(config-if)# 进入接口配置模式 yzh(config-if)#speed 100 设置接口F0/2速率为100M yzh(config-if)#duplex half 配置接口的双工模式是半双工 yzh(config-if)#no shutdown 开启接口,使得处于工作状态,等待转发数据。 yzh(config-if)#exit 输入exit返回全局模式 yzh(config)#exit 返回特权模式 yzh# 位于特权模式 yzh#show interfaces fastEthernet 0/2 查看刚才对接口f0/2配置情况 设置交换机Enable特权密码为admin yzh> 进入超级终端控制台 yzh>enable 进入交换机特权模式 yzh#configure terminal 进入交换机配置模式 yzh(config)#enable secret admin 设置Enable密码为admin 注:验证密码自己思考。 查看设备配置信息 yzh#show running-config 保存配置信息 yzh#write 保存设置配置,把配置指令写入对到系统文件夹中 yzh#dir 查看系统文件 删除配置,恢复初始配置 yzh# yzh#dir 查看系统文件 yzh#delete? 输入“?”号,获得帮助 yzh#delete flash:config.txt 删除配置文件 系统就恢复了出厂配置
三层交换机与二层交换机的大多数都相同。 配置三层交换机的名称为SW3,enable密码为admin,并且配置与远程登陆相关的选项。 Switch>enable 进入交换机特权模式 Switch#configure terminal 进入交换机全局模式 Swirch(config)#hostname yzh 修改交换机名称 Yzh(config)#enable password admin 设置交换机enable密码为admin Yzh(config)#interface vlan1 进入vlan1 Yzh(config-if-VLAN1)#ip address 192.168.1.1 255.255.255.0 配置IP地址 yzh(config-if-VLAN1)#exit 退出配置vlan1 yzh(config)#username admin password admin 配置登陆交换机的用户名与密码 yzh(config)#line vty 0 4 进入vty端口配置 yzh(config-line)#login local 配置vty端口使用本地数据库验证 yzh(config-line)#exit 退出vty端口配置 yzh(config)# 配置OK 保存三层交换机配置。 SW3#write 配置三层交换机名称与VLAN yzh>enable 进入交换机特权模式 yzh#configure terminal 进入交换机全局模式 yzh(config)#hostname YZH 修改交换机名称为YZH YZH(config)#vlan10 创建vlan10 YZH(config-vlan)#vlan20 创建vlan20 YZH(config-vlan)#exit YZH(config)#interface range fastEthernet 0/1-10 进入fa/1-10端口 YZH(config-if-range)#switchport access vlan10 划分fa/1-10端口为vlan10 YZH(config-if-range)exit YZH(config)#interface range fastEthernet 0/11-20 进入fa/11-20端口 YZH(config-if-range)#switchport access vlan20 划分fa/11-20端口为vlan20 YZH(config-if-range)#exit 查看vlan配置信息 YZH(config)#exit YZH#show vlan 查看交换机vlan信息 配置vlan10与vlan20的IP地址,使vlan10与vlan20之间能相互通讯。 YZH(config)#interface vlan10 进入vlan10 YZH(config-vlan10)#ip address 192.168.1.1 255.255.255.0 配置vlan10的IP地址 YZH(config-vlan10)#exit YZH(config)#interface vlan20 进入vlan20 YZH(config-vlan20)#ip address 192.168.2.1 255.255.255.0 配置vlan20的IP地址 YZH(config)#exit YZH#show running-config 查看交换机配置信息 在三层交换机上配置vlan10与20的IP地址后,PC1与PC2可以相互通讯 YZH>enable 进入特权模式 YZH#configure terminal 进入全局模式 YZH(config)#hostname yzh 修改名称 yzh(config)#interface range fasrEthernet 0/1-2 进入fa0/1、fa0/2端口 yzh(config-if-range)#port-group 1 把fa0/1、fa0/2端口聚合为端口组1 yzh(config-if-range)#exit yzh(config)#exit 注:验证测试:查看交换机配置 yzh#show running-config 配置三层交换机SW1的生成树协议 yzh>enable yzh#configure yzh(config)#hostname YZH YZH(config)#spanning-tree 配置生成树 YZH(config)#exit 验证配置: YZH#show vlan 查看VLAN划分信息 配置二层交换机SWB的VLAN划分 YZH>enable YZH #configure terminal YZH(config)#hostname SWB 配置交换机名称 YZH (config)#vlan20 创建VLAN20 YZH (config-vlan)#exit YZH (config)#int fa0/1 YZH (config-if)#swit YZH (config-if)#switchport access vlan20 将端口Fa0/1划分为VLAN20 YZH (config-if)#exit YZH (config)#int fa0/24 YZH (config-if)#switchport access vlan20 将端口Fa0/24划分为VLAN20 YZH (config-if)#exit 配置三层交换机SW1不同VLAN之间的通信 YZH>enable YZH #configure terminal YZH (config)#hostname yzh !配置交换机名称 yzh (config)#vlan10 !创建VLAN10 yzh (config-vlan)#vlan20 !创建VLAN20 yzh (config-vlan)#vlan 30 !创建VLAN30 yzh (config-vlan)#exit yzh (config)#interface vlan10 !配置VLAN10的IP地址 yzh (config-VLAN10)#ip address 192.168.1.1 255.255.255.0 yzh (config-VLAN10)#exit yzh config)#interface vlan20 !配置VLAN20的IP地址 yzh (config-VLAN20)#ip address 192.168.2.1 255.255.255.0 yzh config-VLAN20)#exit yzh (config)#interface vlan 30 !配置VLAN30的IP地址 yzh (config-VLAN 30)#ip address 192.168.3.1 255.255.255.0 yzh (config-VLAN 30)#exit yzh (config)#interface range fastEthernet 0/1-7 yzh (config-if-range)#switchport access vlan10 !划分VLAN10 yzh (config-if-range)#exit yzh (config)#interface range fastEthernet 0/8-14 yzh (config-if-range)#switchport access vlan20 !划分VLAN20 yzh (config-if-range)#exit yzh (config)#interface range fastEthernet 0/15-21 yzh (config-if-range)#switchport access vlan 30 !划分VLAN30 yzh (config-if-range)#exit 配置风暴控制。 在交换机配置F0/1端口(连接PC1 的端口)对广播报文进行风暴控制,限制其端口收到的报文速率(pps) yzh#configure yzh(config)#interface fastEthernet 0/1 yzh(config-if)#storm-control broadcast pps 100 配置报文速率阈每秒100个报文 yzh(config-if)#exit 配置交换机端口安全的最大连接数和端口违背模式,绑定PC机IP地址和MAC地址到端口上 yzh>enable yzh#configure yzh(config)#interface fastEthernet 0/1 yzh(config-FastEthernet 0/1)#switchport port-security 打开端口安全功能 yzh(config-FastEthernet 0/1)#switchport port-security mac address 0023.7d51.72ad ip-addreess 192.168.1.1 yzh(config-if-range)#switchport port-security violation shutdown 配置安全违背关闭模式 验证交换机端口的最大连接数和端口违背模式 yzh(config)#show port-secruity 验证端口绑定的MAC地址和IP地址 yzh(config)#show port-security 验证端口绑定的MAC地址和IP地址 yzh(config)#show port-security address 配置镜像源端口0/1-2的进出流量映射到目的端口F0/20