5分钟掌握思科、华为基础配置

基础命令集

模式

  • 用户模式

cisco
用户模式、(R1>) #用户查看模式
特权模式(R1#)、
全局配置模式(R1(config)#)、 #配置模式
接口模式、(config-if)#)
协议模式 (config-router)#

HuaWei:
用户视图、系统视图、接口视图、协议视图

辅助工具

问号:? 查看命令
tab键:Tab  针对唯一参数进行补齐
简写参数:
cisco:
sho ip int br  #查看接口信息
huawei:dis ip int bri  #只显示三层接口
dis int br #显示所有接口

进入和退出特权

cisco :

enable     #进入特权模式
exit   #一级一级退出
end #直接退出特权

HuaWei:
system-view   #进入系统 视图
<Huawei>system-view
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]

[Huawei]quit             #一级一级退出
returen   #直接退出用户视图

保存、清除配置

cisco:
write    #保存
    R1#wr   
    Building configuration...
[OK]

 erase:清除配置
 R1#erase startup-config 
 


huawei:
save :保存
<Huawei>save 
……y

deltete :删除配置
<Hua_R1>delete vrpcfg.zip 

改名

cisco:
hostname
R1(config)#hostname R1

huawei:
sysname 
[Huawei]sysname Hua_R1
sysname Hua_R1
[Hua_R1]

配ip地址

cisco:
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown  #激活接口
R1(config-if)#exit
R1(config)#
注意 :华为不需要激活,默认激活
cisco 里面以 no 开头(删除关闭)
huawei:里面以undo开头(删除,关闭) 

查看

cisco :
show 开头

show run  #查看当前所以配置


huawei:

display 开头
display current-configuration configuration  #查看当前所以配置



修改时间

cisco:
R1(config)#clock timezone BJ +8 #修改时区
R1(config)#eixt
R1#clock set 15:21:00 FEB 22 2020

R1#show clock 
15:21:27.599 BJ Sat Feb 22 2020
R1#


huawei:
<R1>clock timezone BJ add 8    #设置时区
<R1>clock datetime 17:55:00 2020-02-22  #设置时间
<R1>display clock                             #查看时间
2020-02-22 01:56:01   

Saturday

Time Zone(BJ) : UTC+08:00

<R1>

管理登录

console 口配置

R1(config)#line console 0   #进入console口
R1(config-line)#password  wyh123  #设置密码
R1(config-line)#login  #生效
R1(config-line)#exit    #退出
R1(config)#

 
使用本地用户名登录---涉及到权限管理

R2(config)#line console 0   #进入console口
R2(config-line)#login local   #本地生效
R2(config-line)#exit
R2(config)#username ccna password ccna  #设置本地用户 密码
HUAWEI:


注意:cisco私有加密
R2(config)#service password-encryption  #加密所以密码

============

HUAWEI:
[HAUWEI]user-interface console 0   # 进入console口
[HAUWEI-ui-console0]authentication-mode password  #选择认证模式
[HAUWEI-ui-console0]set authentication password cipher 设置认证秘密
[HAUWEI-ui-console0]qui  #退出
[HAUWEI]

telent 配置


cisco:
    R2(config)#line  vty 0 4
    R2(config-line)#password cisco
    R2(config-line)#transport input telent #只允许telent远程登录
    R2(config-line)#login
    R2(config-line)#exit
    R2(config)#banner login "hello world!" #登录前提示语
    R2(config)#banner exec "tong xue ni hao!!" #登录成功后提示语

验证

R1#telnet 192.168.1.2
Trying 192.168.1.2 ... Open
hello world!

User Access Verification

Password: 
% Password:  timeout expired!
Password: tong xue ni hao!!
R2>

==============

HUAWEI:

[R2]telnet server enable   #开启telent功能
[R2]user-interface vty  0  4  #进入vty 口
[R2-ui-console0]authentication-mode aaa  #选择aaa认证模式
[R2-ui-console0]quit 
[R2]aaa
[R2-aaa]local-user wyh password cipher hcie #配置用户名,密码
[R2-aaa]local-user wyh service-type telnet  选择服务
[R2-aaa]local-user wyh privilege level 3  #给与权限

[Huawei]header login information 'shu ru  qian ti shi' #登录前提示信息

[Huawei]header shell information 'deng lu hou ti shi’ #登录后提示信息

验证:


<R1>telnet 1.1.1.2

Trying 1.1.1.2 ...

Press CTRL+K to abort

Connected to 1.1.1.2 ...



shu ru mi ma qian ti shi  #登录前提示的



Login authentication


Username:admin

Password:

deng lu hou ti shi    #登录后提示的

Info: The max number of VTY users is 10, and the number

      of current VTY users on line is 1.

      The current login time is 2020-02-22 17:49:26.

<R2>

SSH 配置

CISCO:
R2(config)#ip domain-name cisco.com  #设置域名
R2(config)#crypto key generate rsa  #生成RSA密钥
The name for the keys will be: R2.cisco.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]: 2048 #密码长度
% Generating 2048 bit RSA keys, keys will be non-exportable...[OK]

R2(config)#
R2(config)#line vty 0 4
R2(config-line)#transport input ssh  #设置SSH登录
R2(config-line)#login local 
R2(config-line)#exit
R2(config)#

R2(config)#ip ssh time-out 30 #设置超时秒数

R2(config)#ip ssh authentication-retries 3 
#设置认证次数

================

HUAWEI:

一、在本地设备服务端生成秘钥对

rsa local-key-pair create

二、配置VTY

[HAUWEI]user-interface vty 0 4  #进入虚拟终端
[HAUWEI-ui-vty0-4]authentication-mode aaa #认证模式AAA
[HAUWEI-ui-vty0-4]protocol inbound ssh  #配置允许登录接入用户类型的协议(all | ssh | telnet)
[HAUWEI-ui-vty0-4]quit
[HAUWEI]


三、创建用户以及密码
Huawei]aaa       #进入AAA
[Huawei-aaa]local-user admin password cipher admin privilege level 3  #设置用户名密码、用户等级


四、打开服务以及认证方式
[Huawei]stelnet server enable  #打开SSH
[Huawei]ssh user admin authentication-type password #认证模式为密码模式
[Huawei]ssh user admin service-type stelnet
#服务方式

访问权限

操作系统

主流大类:

    1、思科设备:IOS
    2、华为设备:VRP
    3、锐捷设备:
    4、华三设备:

启动步骤:

加电自检--> 加载系统--> 加载配置

设备升级

设备升级的方式:

TFTP/FTP升级IOS:

Router#show version #查看版本

设备ip地址设置为 192.168.1.2 /24
PC地址:192.168.1.1 /24
备份前,先备份当前设备的操作系统

cd flash:  #进入flash目录
dir  #查看系统文件
copy flash:/系统文件   ftp: 回车
目的ip地址(自己的电脑地址)


delete flash:/系统文件名  #删除系统

上传系统文件:
copy ftp:flash:回车
目的地址是
dir #查看系统文件
boot system flash:/上传第系统  #手动指定启动配置文件

保存配置

如果没有操作系统,可以从插入usb 到设备,其格式最好为FAT格式,如果读取不了,可以格式化,(电脑上格式化化)
format us #格式化 设备上格式化

eg:

cd  ?       #首先看有没有读取
usbflash0:    #已近读取的USB

copy usbflash0:/文件系统名 回车
目的地址


如果开机还是读取不了系统,可以从U盘读取

CTR +break|pause 键  #进入 系统模式模式 rommanl ,{少数ctrl+b}

dev 
boot usbflash0:/系统文件名 #加载读取过成很慢

进入系统后,copy 到设备上
copy usbflash:/系统名 flash:/

密码破解

去官网查找
https://support.huawei.com/enterprise/zh/access-network/smartax-ma5620-pid-1563473

总结:

我们一般做cisco实验的时候,通常配置实验会使用工程三招:

 R1(config) # no ip domain lookup
#关闭域名解析 (防止敲错命令查询)
 R1(config) #line console 0
R1(config-line) #logging synchronous log     # 当前显示信息同步
R1(config-line) #no exec-timeout
#关闭会话超时,防止一段时间不操作自动退出

#config-register 0x2142        //更改存储模式   实验室
#config-register 0x2102        //工程专用
注:以上两条用于控制flash读写
config# enable password cisco  //明文加密
config# enable secret cisco       //密文加密
发布了60 篇原创文章 · 获赞 3 · 访问量 2062

猜你喜欢

转载自blog.csdn.net/weixin_42313749/article/details/104584178