CCNA Basic cofiguration commands

here are basic cisco router configuratuion commands you will need to fully understand before going to Routing protocols topics:

翻译:这些是基本的思科路由器操作命令
注:本文档来自思科网络学院(英文版),//后为翻译的内容,翻译仅供参考,如有不妥之处,敬请修正。

Basic configuration   //基本配置

Router>ena    //有用户模式进入特权模式                          
Router#show version     //查看版本信息
Router#show start       //查看启动配置
Router#show run        //查看运行配置
Router#show history   //查看历史命令
Router#show clock     //查看时钟
Router#show users    //查看用户
Router#show flash     //查看flash的文件与情况
Router#show tech-support   //设备基本命令的集成
Router#show interfaces       //查看端口的情况(详细)
Router#show ip interface brief   //查看端口的基本情况
Router#copy run start       //保存运行配置到启动配置
Router#ping             //ping命令
Router#reload          //重新启动

Router#config t        //从特权模式进入全局模式
Router(config)#ip host yasser 10.0.0.100     //配置路由器名字和地址,可以在ping后面接名字或地址
Router(config)#interface fastEthernet 0/0    //进入接口配置模式
Router(config-if)#ip address 10.0.0.1 255.0.0.0   //配置IP地址
Router(config-if)#speed auto       //配置速度
Router(config-if)#duplex auto      //配置工作模式
Router(config-if)#no shutdown     //启用接口
Router(config-if)#exit       //退出接口配置模式

Secure Router & Setting Telnet connection     //路由安全和telnet配置

Router(config)#enable password 1111    //配置特权密码(明文)
Router(config)#no enable password       //取消特权密码
Router(config)#enable secret 1111        //配置特权密码(加密)
Router(config)#line console 0           //进入console 0
Router(config-line)#password 2222    //配置console密码
Router(config-line)#login       //启用密码
Router(config-line)#exit        //退出该模式
Router(config)#line vty 0 4    //进入vty
Router(config-line)#password 3333     //配置vty登录的密码
Router(config-line)#login      //启用密码
Router(config-line)#exit      //退出该模式
Router(config)#service password-encryption     //加密密码
Router(config)#banner motd # dont login #     //配置登陆前看到的信息
Router(config)#username yasser password 2222     //配置用户名和密码(明文)
Router(config)#username yasserramzy secret 2222    //配置用户名和密码(加密)
Router(config)#username yasserauda privilege 15 password 2222    //配置用户名和密码(明文)并给与最高权限
Router(config)#username yasserramzyauda privilege 15 secret 2222  

//配置用户名和密码(加密)并给与最高权限
Router(config)#no ip domain-lookup      //取消域名解析

 

Cisco DISCOVERY PROTOCOL     //思科发现协议
Router(config)#cdp run     

Router#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
Switch Fas 0/1 171 S 2960 Fas 0/1
Router Fas 0/0 122 R C2800 Fas 0/0

Router#show cdp interface
Vlan1 is administratively down, line protocol is down
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
FastEthernet0/0 is up, line protocol is up
Sending CDP packets every 60 seconds
Holdtime is 180 seconds
FastEthernet0/1 is up, line protocol is up
Sending CDP packets every 60 seconds
Holdtime is 180 seconds

Router#show cdp entry *
Device ID: Switch
Entry address(es):
Platform: cisco 2960, Capabilities: Switch
Interface: FastEthernet0/1, Port ID (outgoing port): FastEthernet0/1
Holdtime: 148
Version :
Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX,
RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Wed 12-Oct-05 22:05 by pt_team
advertisement version: 2
Duplex: full
---------------------------
Device ID: Router
Entry address(es):
IP address : 120.0.0.2
Platform: cisco C2800, Capabilities: Router
Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/0
Holdtime: 158
Version :
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version
12.4(15)T1, RELEASE SOFTWARE (fc2)
Technical Support:
http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 06:21 by pt_rel_team
advertisement version: 2
Duplex: full

Password recovery       //密码恢复

1- connect your router using console cable      //使用console线连接电脑和路由器
2- turn off turn on your router          //关闭路由器并开启
3- press ctrl + pause break              //开启时按ctrl+【pause break】
4- change confreg to 0x2142          //修改寄存器为0x2142
5- reset       //重新启动
6- n
7- ena      //进入特权模式
8- copy start run       //将启动配置到运行配置
9- config t        //进入全局模式
10- use password commands to change or remove passwords      //使用密码配置命令,修改密码或移除密码 
11- confgire-register 0x2102      //配置寄存器值为0x2102
12- exit        //退出
13- copy run start    //保存运行配置到启动配置

BACKUP & RESTORE      //备份与恢复

Router#copy tftp flash    //恢复
Router#copy flash tftp    //备份
Router#copy run tftp      //备份
Router#copy start tftp     //备份
Router(config)#boot system flash ?
WORD System image filename

note: Boot priority (system,flash,tftp,rxboot.rommon)
 
DHCP     //配置DHCP

Router(config)#ip dhcp pool me         //定义dhcp地址池名字
Router(dhcp-config)#network 10.0.0.0 255.0.0.0     //关联网络
Router(dhcp-config)#default-router 10.0.0.10       //网关
Router(dhcp-config)#dns-server 10.0.0.11       //DNS
Router(dhcp-config)#exit 
Router(config)#ip name-server 10.0.0.11       //配置名字服务器
Router(config)#ip dhcp excluded-address 10.0.0.100 10.0.0.200     //dhcp分配除外的地址
Router(config)#exit

Router#show ip dhcp binding      //查看dhcp绑定
IP address Client-ID/ Lease expiration Type Hardware address

Router(config)#interface fastEthernet 0/0     //进入接口
Router(config-if)#ip address dhcp       //该接口从dhcp地址池中获取地址

SSH         //SSH配置
Router(config)#username yasser password 2222      //配置用户名和密码(明文)
Router(config)#hostname alexrouter     //路由器名字
alexrouter(config)#ip domain-name me.com     //域名
alexrouter(config)#ip ssh time-out 30    //SSH超时时间
alexrouter(config)#ip ssh authentication-retries 3    //使用SSH登录错误的次数不准超过3次
alexrouter(config)#ip ssh version 2    //SSH版本为2
Please create RSA keys (of at least 768 bits size) to enable SSH v2.
alexrouter(config)#crypto key generate rsa     //产生RSA
The name for the keys will be: alexrouter.me.com
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 512      //输入大小
% Generating 512 bit RSA keys, keys will be non-exportable...[OK]        //密钥产生完成
*Mar 1 0:1:26.828: RSA key size needs to be at least 768 bits for ssh version 2
*Mar 1 0:1:26.828: %SSH-5-ENABLED: SSH 1.5 has bee

 
译者注:以上只是一些基本的操作命令,并不全,如需要更多的详细情况,参阅思科的相关介绍和产品说明书。

你可能感兴趣的:(ssh,路由器,DHCP,基本配置,思科)