Juniper SRX常用命令


1、恢復出廠配置
root> request system zeroize media
#media這個參數在模擬器上是沒有辦法配置的。
這條命令會清空除了系統os以外的所有配置,(包括日志,許可等等)一台新的機器或者一台恢復了出廠設置的設備,默認用戶名為root,沒有密碼。

2、加載出廠配置
root# load factory-default
注意模式變換:讀取出廠配置,不會刪除日志、許可、本地文件等等,但會重置root。

3、配置ROOT密碼
第一種:root# set system root-authentication plain-text-password
這是交互式配置,你試一下就知道了
第二種:root# set system root-authentication encrypted-password
Possible completions:
<encrypted-password> Encrypted password string
這里后面的密碼是要已經經過MD5加密的密文(復制粘貼配置用,他不用交互)

4、配置dns服務器
root# set system name-server 114.114.114.114

5、覆蓋當前修改的配置副本,到運行中的配置
root# commit
配置模式下修改的是副本,這代表你做的一切配置都不一定會生效,commit就是把副本覆蓋到當前配置的命令,srx會自動保存這些配置,並且進行編號,編號從0開始,越小時間越近

6、創建用戶
set system login user AAA uid 2001
set system login user AAA class super-user
set system login user AAA authentication plain-text-password
"$1$JjTpAOWR$Qdo4LZbv6vIH.9Lfrnmtp1" #這一段就是密文,也就是上面第二種秘密配置方法里要填的東西
[edit]
root@SRX1# edit system login user AAA
[edit system login user AAA]
root@SRX1#
發現沒有,上面那個中括號,這個其實是當前路徑,而edit可以配置的同時進入該路徑,然后就可以在當前路徑下的配置參數,這個就是junos的層級配置,試試就知道了。

7、設置接口ip
root@SRX1# set interfaces ge-0/0/0 unit 0 family inet address 1.1.1.2/24
這里注意幾點
1、unit就類似與子接口,srx是不允許直接在接口上配ip的
2、如果一個接口ip代表這個物理接口的ip,必須是unit 0

8、替換IP
[edit]
root@SRX1# edit interfaces ge-0/0/0
[edit interfaces ge-0/0/0]
root@SRX1# replace pattern 1.1.1.2/24 with 1.1.1.3/24

9、多個端口同時設置
[edit]
root@SRX1# wildcard range set interfaces ge-0/0/[0-1,3] link-mode full-duplex
interfaces {
ge-0/0/0 {
link-mode full-duplex;
unit 0 {
family inet {
address 1.1.1.2/24;
}
}
}
ge-0/0/1 {
link-mode full-duplex;
}
ge-0/0/3 {
link-mode full-duplex;
}

10、刪除多個
[edit]
root@SRX1# wildcard delete interfaces ge-0/0/[0-1,3]

11、保護配置
protect關鍵字
unprotect關鍵字
這兩個直接加層級就好,除非使用system zeroize media,不然在保護狀態,是干不掉他的。

12、回滾配置,一共存多少個,可以設置
root@SRX1# rollback ?
Possible completions:
<[Enter]> Execute this command
0 2017-07-04 06:34:34 UTC by root via cli
1 2017-07-04 05:48:28 UTC by root via cli
2 2017-07-04 03:37:11 UTC by root via cli
3 2017-07-04 03:32:07 UTC by root via cli
4 2017-07-04 03:29:17 UTC by root via cli
5 2017-07-04 03:27:59 UTC by root via cli
6 2017-07-04 03:25:04 UTC by root via cli
7 2017-07-04 02:56:05 UTC by root via other
| Pipe through a command

13、設置rollback數量
root@SRX1# set system max-configurations-on-rollbacks 50
root@SRX1# set system max-configurations-on-flash 100
Value 100 is not within range (0..49) at '100'
可以發現最多一共可以存50個,這兩條命令,其實只配第一條也是可以的,他是用來確認rollback的數量的,第二條on-flush是用來設置你有多少個配置保存在設備的config文件所屬的文件夾下,但是並不是說剩下的配置他不保存,不保存的話你怎么恢復呢?剩下的其實是保存再var的一個目錄下,可以去官網查一下,我看有人也提問這個問題,回復的還是很准確的。

14、默認回退(后悔機制)
root@SRX1# commit confirmed
commit confirmed will be automatically rolled back in 10 minutes unless confirmed
commit complete
# commit confirmed will be rolled back in 10 minutes
默認是10分鍾,如果在10分鍾內沒有再commit,他就會自動回滾

15、常用命令
root@SRX1# status   #查看誰正在配置
root@SRX1# delete   #刪除當前級別下所有的配置
root@SRX1# run show version   #查看版本
root@SRX1# commit check   #提交檢查(檢查語法,不生效)
root@SRX1# commit comment TEST1   #給提交的配置打上標記
root@SRX1# active interfaces ge-0/0/0   #啟用配置
root@SRX1# deactivate interfaces ge-0/0/0   #不啟用(配置不生效)
root@SRX1# set system host-name SRX1   #設置主機名
root@SRX1# run show system users    #查看登陸用戶
root@SRX1# run show system commit   #查看rollback
root@SRX1# run show system uptime   #查看設備運行時間
root@SRX1> request system reboot   #重啟
root@SRX1> request system power-off   #關機
root@SRX1> show interfaces terse   #查看接口狀態和接口IP
root@SRX1> show security monitoring fpc 0   #查看cpu,內存
root@SRX1# set interfaces ge-0/0/3 disable    #關閉接口
root@SRX1# delete interfaces ge-0/0/3 disable    #開啟接口

16、SRX常用查看命令,操作模式下使用,配置模式下run show
show system software    查看當前軟件版本號
show system uptime     查看系統啟動時間
Show chassis haredware    查看硬件板卡及序列號
show chassis environment    查看硬件板卡當前狀態
show chassis routing-engine    查看主控板(RE)資源使用及狀態
show route    查看路由表
show arp    查看ARP表
show log messages    查看系統日志
show interface terse    查看所有接口運行狀態
show interface ge-x/y/z detail    查看接口運行細節信息
monitor interface ge-x/y/z    動態統計接口數據包轉發信息
monitor traffic interface ge-x/y/z   動態報文抓取(Tcpdump,類似ScreenOS snoop命令)
show security policies from-zone untrust to-zone trust    查看policy
show security nat    查看nat策略
show security flow session summary    查看當前防火牆並發會話數
show security flow session    查看當前防火牆具體並發會話
clear security flow session all   清除當前session
show security alg status    檢查全局ALG開啟情況
SRX對應ScreenOS debug flow basic   跟蹤報文處理路徑的命令
set security flow traceoptionsflag basic-datapath    開啟SRX基本報文處理Debug
set security flow traceoptionsfile filename.log    將輸出信息記錄到指定文件中
set security flow traceoptionsfile filename.log size <file-size>    設置該文件大小,缺省128k
set security flow traceoptionspacket-filter filter1 destination-prefix 5.5.5.2    設置報文跟蹤過濾器
run file show filename.log   查看該Log輸出信息
SRX對應ScreenOS get tech命令,開Case時需要抓取的信息:request support information


免責聲明!

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



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