路由器 命令行基础

 

用户视图模式

<Huawei>system

 

 

系统视图模式

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.

 

 

 接口视图模式

 

 显示热键

[Huawei]display hotkey 
----------------- HOTKEY -----------------

            =Defined hotkeys=
Hotkeys    Command
CTRL_G    display current-configuration
CTRL_L    undo idle-timeout
CTRL_O    undo debugging all

 

设置路由器hostname

[Huawei]sysname route1
[route1]

 

设置时钟,查看时钟

用户视图模式设置, 先设置时区,后设置 时间

<route2>clock timezone CTS add 8

<route2>clock datetime 17:49:50 2016-12-20

 

对console口 设置密码

[route2]user-interface console 0
[route2-ui-console0]authentication-mode password 
Please configure the login password (maximum length 16):huawei
修改console的密码 [route2
-ui-console0] set authentication password cipher huawei

 

对vty(telnet 进行配置)

[route2]user-interface vty 0 4
[route2-ui-vty0-4]authentication-mode password 
Please configure the login password (maximum length 16):huawei
[route2-ui-vty0-4]set authentication password cipher huawei
设置用户权限,
[route2-ui-vty0-4]user privilege level 3
设置登陆超时时间1分10秒
[route2-ui-vty0-4]idle-timeout 1 10
显示display current-configuration的长度
[route2-ui-vty0-4]screen-length 100

显示历史命令行缓冲区的大小
[route2-ui-vty0-4]history-command max-size 10

 

在路由器上配置接口IP地址

[route2]interface GigabitEthernet 0/0/0
[route2-GigabitEthernet0/0/0]ip ad    
[route2-GigabitEthernet0/0/0]ip address 10.0.0.1 8

 

查看网络接口配置情况

[route2]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 1
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 1
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.0.0.1/8           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s) 

 

命令行功能

显示路由器基本信息
[route1]display version 
Huawei Versatile Routing Platform Software
VRP (R) software, Version 5.130 (AR1200 V200R003C00)
Copyright (C) 2011-2012 HUAWEI TECH CO., LTD
Huawei AR1220 Router uptime is 0 week, 0 day, 0 hour, 53 minutes

查看接口状态信息, 物理层 和 链路层都是down状态
[route1]display interface GigabitEthernet0/0/0
GigabitEthernet0/0/0 current state : DOWN
Line protocol current state : DOWN

显示全部接口的IP简要信息,包含IP地址
[route1]display  ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
NULL0                             unassigned           up         up(s)


显示路由表
[route1]display ip routing-table

127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0


显示保存的配置(flash中)

[route1]display current-configuration 

 

显示保存的配置(flash)

[route1]display saved-configuration 

 

显示flash的文件

<route1>dir flash:
Directory of flash:/

 

Idx Attr Size(Byte) Date Time(LMT) FileName
0 drw- - Dec 20 2016 09:33:34 dhcp
1 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip
2 -rw- 2,263 Dec 20 2016 09:33:24 statemach.efs
3 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip

 

1,090,732 KB total (784,468 KB free)

 

保存文件

<route1>save

 

重启设备

<route1>reboot

 

实现每个管理员都有一个密码,使用telnet登陆

[route2]user-interface vty 0 4

[route2-ui-vty0-4]authentication-mode aaa 

[route2-ui-vty0-4]quit

[route2]aaa

#创建本地用户名密码, 用户信息保存在本台路由器上, 创建用户admin, 密码 huawei,权限级别为15

[route2-aaa]local-user admin password cipher huawei privilege level 15

本地用于admin 使用telnet 验证
[route2-aaa]local-user admin service-type telnet

 

 

stelnet 加密登陆设置

生成密钥对

[route2]rsa local-key-pair create
The key name will be: Host
% RSA keys defined for Host already exist.
Confirm to replace them? (y/n)[n]:y
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Input the bits in the modulus[default = 512]:2048
Generating keys...
............+++

显示密钥对

[route2]display rsa local-key-pair public 

 

[route2]user-interface vty 0 4


[route2-ui-vty0-4]authentication-mode aaa


[route2-ui-vty0-4]protocol inbound ssh

[route2-ui-vty0-4]quit

[route2]aaa

[route2-aaa]local-user feng password cipher huawei privilege level 15

[route2-aaa]local-user feng service-type ssh

查看ssh登陆的用户名

[route2-aaa]display ssh user-information
-------------------------------------------------------------------------------

Username Auth-type User-public-key-name
-------------------------------------------------------------------------------
feng password null


查看ssh状态,默认状态是 disable

[route2]display ssh server status

[route2]display ssh server status
SSH version :1.99
SSH connection timeout :60 seconds
SSH server key generating interval :0 hours
SSH Authentication retries :3 times
SFTP Server :Disable
Stelnet server :Disable

 

把stelnet 启动状态

[route2]stelnet server enable

 

客户端登陆,需要执行

[route1] ssh client first-time enable
[route1] stelnet 10.0.0.1

 

 

VRP文件系统基础

<Huawei>dir flash:
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  Dec 21 2016 10:23:00   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  Dec 21 2016 10:22:46   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip

1,090,732 KB total (784,468 KB free)

删除文件
<Huawei>delete sslvpn.zip.tar.gz

其实没有彻底删除,像回收箱,查看
<Huawei>dir /all

恢复删除的文件:
<Huawei> undelete  sslvpn.zip.tar.gz


彻底删除
<Huawei> reset recycle-bin

配置保存:
<Huawei> save
查看内存中的配置
<Huawei> display current-configuration

查看保存flash中的配置
<Huawei> display saved-configuration



删除flash中的配置文件,删除后路由器重启,配置文件为空
<Huawei>delete vrpcfg.zip
<Huawei>reset saved-configuration 

显示路由器开机启动的一些情况

<Huawei>display startup
MainBoard:
Startup system software: null
Next startup system software: null
Backup system software for next startup: null
Startup saved-configuration file: flash:/vrpcfg.zip
Next startup saved-configuration file: flash:/vrpcfg.zip
Startup license file: null
Next startup license file: null
Startup patch package: null
Next startup patch package: null
Startup voice-files: null
Next startup voice-files: null

 

下次启动读取flash下的 fengjian.zip 

<Huawei>copy vrpcfg.zip fengjian.zip

<Huawei>startup saved-configuration flash:/fengjian.zip

 

比较内存中配置与 下次启动的配置文件对比

<Huawei>compare configuration

 

存储设备修复,修复flash

<Huawei>fixdisk flash:

 

posted @ 2016-12-20 17:51  fengjian1585  阅读(5494)  评论(0编辑  收藏  举报