路由器 命令行基礎


 

用戶視圖模式

<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:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM