CCNA试验考试命令总结
    路由器实验:
  
  router> enable         从用户模式进入特权模式  
  router# disable or exit    从特权模式退出到用户模式  
  router# show sessions     查看本机上的TELNET会话
    router# disconnect       关闭所有的TELNET会话  
  router# show users       查看本机上的用户  
  router# erase startup-config  删除NVRAM中的配置  
  router# reload         重启路由器  
    router# config terminal    从用户模式进入特权模式  
  router(config)# hostname rl  配置用户名为rl  
  router(config)# #banner welcome# 配置开机话语  
  router# show controllers serial0 查看串口0的物理层信息,主要是查看DTE/DCE  
  router# show ip interface   查看端口的IP配置信息  
  router# show hosts       查看主机表  
  end or ctrl+z         从各种配置模式退到特权模式  
  rl(config)# no ip domain-lookup 关闭动态域名解析  
  rl(config)# ip domain-lookup  打开动态域名解析  
  rl(config)# ip name-server 202.106.0.20 打开动态域名解析之后便可以指定DNS服务  
  rl(config)# interface serial 0 进入serial 0的接口配置模式 
  rl(config-if)# no shutdown   路由器出厂默认所有端口关闭,使用此命令使它们打开  
  rl(config-if)# encapsulation ppp 封装ppp 
  rl(config-if)# clockrate 64000 如果是DCE使需要设置时钟速率,如果是DTE就不必设置  
  rl(config-if)# bandwidth 64   设置端口带宽为64K
  rl(config-if)# ctrl+c 或者ctrl+z 快捷键退出到特权模式                
  rl# show interface serial 0   查看s0信息,如果看到serial和line protocol都显示up,说明链路两端都设置成功,注意:如果出现serial down, line down 可能对方的端口没有打开;no shutdown 或者电缆没有插好;如果出现serial up, line down 可能是DCE端没有设置clock rate, 也可能是封装格式不对
  
  rl# show cdp neighbors     查看CDP邻居信息
  
  rl(config-if)# ip add 10.0.0.1 255.0.0.0 进入相应的接口,配置相应的IP地址
  
  rl# ping 10.0.0.2        使用ping命令查看邻居的连通性
  
  rl# show ip route        查看路由表,可以看到以C打头的路由信息,这是直连的路由信息;
                   可以看到R开头的路由信息,是从rip学来的路由信息;可看到以I
                   开头的路由信息取代了以R开头的路由信息,这是因为igrp的管理距离是100,小于rip的120
  
  rl(config-if)# router rip    启动RIP路由协议
  
  rl(config-router)# network 10.0.0.0
                  发布网段。注意network后面是接的网络号,而不是IP地址
  rl# show ip protocol      查看配置的路由协议
  
  rl(config)# router igrp 300   一定要注意在IGRP后面加自治系统号
                  考试的时候题目会告诉你AS NUMBER,照敲就是                
  rl(config-router)# network 10.0.0.0
  
  rl(config)# line vty0 4     进入虚拟线程配置模式,在这个模式里可对telnet功能进行配置
  
  rl(config-line)# login
  
  rl(config-line)# password      cisco 配置telnet密码,默认的网络设备telnet的功能是关闭的,配了密码之后会自动打开
  
  rl(config)# enable password cisco 配置进入enable模式的密码, 区分大小写
  
  rl(config)# enable secret ciscocisco 配置进入enable模式的密码,是加密的密码,show run是看不见的
  
  rl(config)# line console 0
  
  rl(config-line)# login
  
  rl(config-line)# password cisco 配置进入用户模式的密码
  
  rl(config-line)# logging synchronous 输入同步
  
  rl(config-line)# exec-timeout 0 0 禁止因为一段时间没有输入而跳出
  
  rl# copy running-config startup-config 保存配置,考试的时候注意题目的要求,如果题目里要求你保存配置就一定不能少了这一项
  
  r1# copy tftp startup-config
  
  r1# copy running-config tftp
  
  r1# copy tftp flash
  
  交换机实验:
  
  switch(config)# ip address 192.168.0.177 255.255.255.0 与路由器在接口上的配置IP不同,交换机是在全局配置模式配置
  
  switch(config)# ip default-gateway 192.158.0.1 给交换机配置一个缺省网关,请注意,不用写掩码
  
  switch(config)# vlan2 name cisco 配置一个vlan2并且指定名字叫CISCO
  
  switch# show interfaces     查看端口状态
  
  switch(config)# interface e0/10 进入端口e0/10
  
  switch(config-if)# vlan-membership static 2 将端口放进vlan2里面
  
  switch(config)# int f0/26    进入快速以太网端口f0/26
  
  switch(config-if)# trunk on   启用trunk,注意:只能在百兆以上端口启用trunk
  
  switch(config-if)# notrunk-vlan 51 52 在主干上关闭VLAN51、52的传输
 
 
 
CCNA中用到的所有命令
路由器:
用户模式和特权模式:
Router>enable
Router>exit (logout、quit)
Router#disable
Rouiter#exit (logout、quit)
接口模式:
Router(config)#interface +接口名称 ----Router(config-if)#
子接口模式:
Router(config)#interface +接口名称.子接口号码 ----Router(config-subif)#
链路模式:
Router(config)#line console 0 ----Router(config-line)#
Router(config)#line vty 0 4 ----Router(config-line)#
命令缓存:
Router>show history
Router>terminal history size +数字
Router的Setup模式:
Router#setup
Router的其他命令:
Router#show version
Router#show running-config
Router#show startup-config
Router的RAM和NVRAM:
Router#copy running-config startup-config
Router#copy startup-config running-config
Router#write erase
Router的Banner命令:
Router(config)#banner motd #??#
Router的特权模式密码:
Router(config)#enable password +密码
Router(config)#enable secret +密码
Router的console密码:
Router(config)#line console 0
Router(config-line)#login
Router(config-line)#password +密码
Router的vty密码:
Router(config)#line vty 0 4
Router(config-line)#login
Router(config-line)#password +密码
接口标识:
Router(config-if)#description +描述信息
配置console的其他参数:
Router(config-line)#exec-timeout +分钟+秒
Router(config-line)#logging synchronous
配置串口参数:
Router#show controller serial+编号
Router(config-if)#clock rate 64000
Router(config-if)#bandwidth 64
关闭接口:
Router(config-if)#(no) shutdown
CDP的配置:
Router#show cdp neighbors
Router#show cdp neighbors detail
Router#show cdp entry *
Router#show cdp interface
Router#show cdp traffic
Router#(no) cdp run
Router(config)#(cdp) enable
Telnet的配置:
Router#telnet +ip地址
Router#exit
Router#show sessions
Router#show user
Router#<ctrl-shift-6> x
Router#resume +编号 (或者按两次Enter)
Router#disconnect +编号
Router#clear +编号
Ping和Traceroute:
Router#ping +ip地址
Router#Traceroute+ip地址
配置Config-register:
Router(config)#config-register+寄存器地址
配置启动顺序:
Router(config)#boot system flash +名称
Router(config)#boot system tftp +文件名+ip地址
Router(config)#boot system rom
备份和恢复IOS:
Router#show flash
Router#copy flash tftp
Router#copy tftp flash
路由器的IP配置:
Router(config-if)#ip address+ip地址+子网掩码
Router#terminal ip netmask-format (bit-count | decimal | hexadecimal)
Router(config)#ip host +主机名+ip地址 [ip地址]
Router(config)#ip domain-name +域名
Router(config)#ip name-server +DNSserver的IP地址
Router(config)#(no) IP domain-lookup
Router(config)#show hosts
配置静态路由:
Router(config)#ip route 目的网络+掩码 [下一跳address | 本地接口] [distance] [permanent]
Router#show ip route
配置缺省路由:
Router(config)#ip route 0.0.0.0 0.0.0.0 [下一跳address | 本地接口] [distance] [permanent]
Router(config)#ip classless
Router(config)#no ip classless
配置VLAN间路由:
Router(config-if)#interface fa0/0.1
Router(config-subif)#encapsulation isl +vlan编号
配置RIP:
Router(config)#router rip
Router(config-router)#network +自然网络号
Router#show ip protocols
Router#show ip route
Router#(no ) debug ip rip
Router(config-router)#maximum-paths <1-6>
配置IGRP:
Router(config)#router igrp +自治系统编号
Router(config-router)#network +自然网络号
Router#(no ) debug ip igrp transactions
Router#(no) debug ip igrp events
Router(config-router)#traffic-share [share | min]
Router(config-router)#variance +容差
Router(config-router)#maximum-paths <1-6>
配置标准ACL:
Router(config)#access-list +编号 [permint | deny] 源地址 翻转掩码
Router(config-if)#ip access-group +编号 [in | out]
Router#show access-list [编号]
Router#show ip interface +接口名称
配置扩展ACL:
Router(config)#access-list 编号 [permit | deny] protocol source source-mask [operator port ] destination destination-mask [operator port ]
Router(config-if)#ip access-group 编号 [in |out]
配置named ACL:
Router(config)# ip access-list [standard | extended] name
Router(config [std-|ext-nacl])# (no) [permit |deny] +测试条件
Router(config-if)#ip access-group [in | out]
配置ACL控制VTY的访问:
Router(config)#line vty 0 4
Router(config-line)#access-class access-list-number [in | out]
配置Novell路由:
Router(config)#ipx routing
Router(config-if)# ipx network 网络号 encapsulation +封装类型
配置Novell封装:
Router(config-subif)# ipx network 网络号 encapsulation +封装类型
Router(config-if)# ipx network 网络号 encapsulation +封装类型 secondary
配置Novell的标准ACL:
Router(config)#access-list 编号 [perming | deny ] 源网络号 [节点地址] [节点掩码] 目的网络号 [节点地址] [节点掩码]
Router(config-if)#ipx access-group 编号 [in | out]
配置Novell的扩展ACL:
Router(config)#access-list 编号 [permit | deny ] protocol 源网络号 [节点号] [掩码] 源socket 目的网络号 [节点号] [掩码]
查看IPX的命令
Router#show ipx interface
Router# show ipx route
Router#show ipx servers
Router#show ipx traffic
Router#debug ipx routing activity
Router#debug ipx sap
Router#ping ipx +IPX地址
PPP的配置:
1. 封装ppp
Router(config-if)#encapsulation ppp
2. 配置主机明、用户名和密码
Router(config)#hostname +主机名
Router(conifg)#username +用户名 password +密码
3. 选择一种验证方式:
Router(config-if)#ppp authentication [chap | chap pap | pap chap | pap]
ISDN的配置:
Router(config)#isdn switch-type +交换机类型
Router(config)#interface bri0 +接口编号
Router(config-if)#isdn spid1 spid号码 [本地目录号码]
Router(config-if)#isdn spid2 spid号码 [本地目录号码]
DDR的配置:
1. 配置静态路由:
2. 定义敏感数据:
? 不使用ACL:
Router(config)#dialer-list 编号 protocol +某个协议 [permit | deny ]
? 使用ACL:
Router(config)#dialer-list 编号 protocol +某个协议 list +ACL编号
3. 配置拨号信息:
Router(config-if)#ip address +IP地址+子网掩码
Router(config-if)#dialer-list 编号
Router(config-if)#dialer map protocol 下一跳路由器地址 name 远端路友器的主机名 [speed 56 | 64 ] [broadcast] +拨号字符串
4. 可选配置:
? 动态器用第二条链路:
Router(config-if)#dialer load-threshold load [outbound | inbound | either]
? 配置超时:
Router(config-if)#dialer idle-timeout seconds
配置帧中继:
1. 配置接口的地址、封装类型
Router(config-if)#encapsulation frame-relay [cisco | ietf]
2. 配置LMI类型:(可选)
Router(config-if)#frame-relay lmi-type [ansi | cisco | q933a]
3. 配置逻辑带宽:
Router(config-if)#bandwidth +带宽
4. 配置映射:
? 静态映射:
Router(config-if)#frame-relay map protocol 地址 dlci编号 [broadcast] [cisco | ietf]
? 动态映射:(缺省)
Router(config-if)#frame-relay inverse-arp protocol dici编号
帧中继的监控和管理:
Router#show interface
Router#show frame-relay lmi
Router#show frame-relay pvc
Router#show frame-relay map
Router#clear frame-relay-inarp
Router#debug frame-relay lmi
交换机的配置:
Switch#show version
Switch#show running-config
Switch(config)#hostname +交换机主机名
Switch#show ip
Switch#show spantree
Switch#show interface
交换机的双工配置:
Switch(config-if)#duplex+双工配置
交换机的IP配置:
Switch(config)#ip address+ip地址+子网掩码
Switch(config)#ip default-gateway+ip地址
交换机MAC地址表的配置
Switch(config)#mac-address-table permanent +MAC地址+对应的端口
Switch(config)#mac-address-table restricted static +MAC地址+对应的端口+允许访问该端口的源端口
Switch(config)#show mac-address-table
Switch(config-if)#port secure max-mac-count +该端口最大课学习的MAC地址数
Switch(config)#address-violation (suspend / disable /ignore)
Switch#show mac-address-table security
交换机配置文件的备份和恢复:
Switch#copy nvram tftp://tftp的IP地址//配置文件名
Switch#copy tftp:// tftp的IP地址//配置文件名 nvram
VLAN的配置:
1. 配置VTP:
Switch(config)#vtp [server | client | transparent ] [domain +VTP域名] [trap (enable | disable) ] [password +密码 ] [pruning (enable | disable) ]
2. 配置干道链路:
Switch(config-if)#trunk [on | off | desirable | auto |nonnegotiate]
Switch#show trunk [A | B]
3. 创建和修改VLAN
Switch(config)#vlan +vlan编号 [name+VLAN名称]
Swtich#show vlan [VLAN编号]
4. 将某个端口加入到某个VLAN
Switch(config-if)# vlan-membership [static(vlan编号) | dynamic]
Switch#show vlan-membership