文章目錄
基礎命令集
模式
- 用戶模式
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 //密文加密