Router基本配置:
Router>                                  \\路由器的启动时所进入的用户模式
Router>enable                             \\键入该命令以进入特许模式
Router#                                  \\此显示模式表示已经进入了特许模式
Router#configure terminal                    \\键入该命令以进入全局配置模式
Router(config)#                            \\此显示模式表示已经进入了全局配置模式
Router(config)#hostname 51cto          \\键入该命令把路由器的名称改为 “51cto”

配置控制台密码
51cto(config)#line console 0      
51cto(config_line)#login  
51cto(config_line)#password cisco

配置控制台其他参数
51cto(config)#line console 0
51cto(config_line)#exec-timeout 0 0                \\配置console口超时时间
51cto(config_line)#logging synchronous            \\配置显示同步

配置欢迎信息
51cto(config)#banner motd #   (回车)
输入一段欢迎信息并以“#”结束。(回车)

配置路由器密码
51cto(config)#enable password cisco                \\为路由器设置使能口令为cisco
51cto(config)#enable secret ciscolab                \\为路由器设置使能密码为ciscolab
配置路由器端口IP地址
51cto(config)interface fastethernet 0/0
51cto(config-if)#ip add 192.168.1.1 255.255.255.0
51cto(config-if)#no shutdown
51cto(config-if)#exit                    
51cto(config)#exit                      

配置路由器f0/0端口描述信息
51cto(config)interface fastethernet 0/0
51cto(config-if)#description “要描述的信息”

进入路由器的串口配置模式
51cto (config)#interface serial 0/0
51cto (config_if)#

设置串口的时钟频率
51cto (config)#interface serial 0/0
51cto (config_if)#clock rate 64000

设置串口的带宽
51cto (config)#interface serial 0/0
51cto (config_if)#bandwidth 64

配置静态路由
51cto(config) #ip route 目标网络 目标网络子网掩码 下一跳地址

配置缺省路由
51cto(config) #ip route 0.0.0.0 0.0.0.0 下一跳地址
51cto#copy running-config startup-config      \\将配置信息存盘(存入NVRAM)
51cto#show running-config                 \\查看当前的配置信息(RAM中的信息)
51cto#show startup-config                  \\查看已存盘的信息(NVRAM中的信息)
51cto#show ip route                       \\查看路由表信息
51cto#show cdp neighbors                  \\查看此路由器还连有哪些cisco的设备
51cto#erase startup-config                   \\将路由器恢复到出厂配置
51cto#reload                             \\重新启动路由器
路由器密码恢复
1开机按住Ctrl+Break
2执行confreg 0x2142
3执行reset
4执行copy startup-config running-config 将路由器配置拷贝到running-config中
5在全局配置模式下修改密码,并执行config-register 0x2102
6 copy running-config startup-config 保存信息
7 reload 重新启动路由器
Switch基本配置:
Switch>                                  \\交换机的启动时所进入的用户模式
Switch>enable                             \\键入该命令以进入特许模式
Switch#                                  \\此显示模式表示已经进入了特许模式
Switch#configure terminal                    \\键入该命令以进入全局配置模式
Switch(config)#                            \\此显示模式表示已经进入了全局配置模式
Switch(config)#hostname 51cto           \\键入该命令把交换机的名称改为“51cto”
51cto(config)#enable password cisco       \\为交换机设置使能口令为cisco
51cto(config)#enable secret cisco           \\为交换机设置使能密码为cisco
51cto(config)#interface FastEthernet 0/10    \\进入交换机的快速以太网端口f0/10
51cto(config-if)#description link to Server A \\配置f0/10的描述信息,描述此端口和服务器Server A相连
51cto(config-if)#duplex full                \\配置f0/10端口为全双工
51cto(config-if)#speed 10                  \\配置f0/10端口速率为10Mb/s
51cto(config-if)#exit                      \\退出端口模式到全局配置模式
51cto(config)#exit                        \\退出全局模式到特许模式
51cto#copy running-config startup-config     \\将配置信息存盘(存入NVRAM)
51cto#show version                       \\查看交换机的版本信息
51cto#show running-config                \\查看当前的配置信息(RAM中的信息)
51cto#show startup-config                  \\查看已存盘的信息(NVRAM中的信息)
51cto#show mac-address-table               \\查看交换机的MAC地址表内容
51cto#show cdp neighbors                  \\查看此交换机还连有哪些cisco的设备
51cto#erase startup-config                   \\将交换机恢复到出厂配置
51cto#reload                             \\重新启动交换机

Cisco Catalyst2950交换机的密码恢复
1.关机
2.按住“MODE”键开机
3.等到超级终端显示已开机,松开“MODE”键
4.执行flash_init命令,
可以查看flash的内容,dir flash:
5.把flash里的“config.text”文件改名字为“config.old”
    rename flash:config.text flash:config.old
6.执行boot启动交换机
7.把flash里的“config.old”文件改名字为“config.text”
    rename flash:config. old flash:config. text
8.把“config.text”考入系统的“running-config”
    copy flash:config.text running-config
9.修改密码并且存盘保存信息