Juniper SRX CLI命令範例 file 、request 命令



File 命令(showcopydeletelist)

通過這些 file 命令,您可以查看設備上某個位置的檔並將其複製
到另一台設備上,或將它從您的設備複製到遠端系統(如伺服器)上,
或從遠端系統複製到該設備上。在設備上保存和載入設定檔有助於:
n 存檔和備份配置
n 在設備之間共用設定檔
n 保存和載入在同一網路內的多個設備(如路由篩選器)之
間可能比較常見的部分設定檔。要查看檔,請使用


file show 命令:
用來查看文字檔內容的。
root@srx100> file show /cf/var/tmp/krt_gencfg_filter.txt
((gencfg_t->gencfg_major_type == 16) || ((gencfg_t->gencfg_major_type == 32) &&
(gencfg_t->gencfg_minor_type == 3)) || (gencfg_t->gencfg_major_type == 12))
root@srx100> file show /cf/etc/host.conf
# $FreeBSD: src/etc/host.conf,v 1.6 1999/08/27 23:23:41 peter Exp $
# First try the /etc/hosts file
hosts
# Now try the nameserver next.
bind
# If you have YP/NIS configured, uncomment the next line
# nis
root@srx100>


file list 命令:
file listdosdir或是linuxls命令一樣,是用來查看目錄或是檔案的命令。
如果您查找的是系統相關部分名稱,file list會自動幫您查找相關資訊。
root@srx100> file list juniper.conf.gz
/cf/root/juniper.conf.gz: No such file or directory
root@srx100> file list /var
/var:
at@  -> /cf/var/at
crash@ -> /cf/var/crash
cron@ -> /cf/var/cron
db@  -> /cf/var/db
empty/
etc@ -> /mfs/var/etc
home@ -> /cf/var/home
jail@ -> /cf/var/jail
log@ -> /cf/var/log
named@ -> /cf/etc/namedb
packages@ -> /cf/packages
pdb@ -> /cf/var/pdb
run@ -> /mfs/var/run
sw@  -> /cf/var/sw
tmp@ -> /cf/var/tmp
transfer@ -> /cf/var/transfer
validate@ -> /cf/var/validate
root@srx100> file list /cf/var/tmp/usb
/cf/var/tmp/usb:
junos-srxsme-12.1X46-D40.2-domestic.tgz*
root@srx100>


File copy 命令
您可以使用 file copy 命令手動存檔檔,該命令所用語法與標準的
Unix cp 命令相同:
file copy /target-directory/target-filename /destinationdirectory/
destination-filename
例如, 要將當前活動的設定檔 (/cf/config/juniper.conf.gz) 作為
backup.gz 複製到設備的 /cf/var/home/user 目錄下,請執行以下操作:
root@srx100> file copy /cf /config/juniper.conf.gz /cf /var/home/user/backup.gz

Copy the jinstall package to the router. We recommend that you copy it to the /var/tmp directory, which is a large file system on the hard disk.
user@host> file copy ftp://[username:prompt]@[ftp.hostname.net]/[filename]  /var/tmp/
Example:
user@host> file copy ftp://anonymous:geg@test.jnpr.net/ junos/jinstall-7.5R2.8-domestic-signed.tgz /var/tmp/
Note: Remember to use binary mode when transferring files via FTP.


file delete 命令
您可以使用 file delete 命令刪除檔案。
root@srx100> file delete /cf/var/home/user/backup.gz


JUNOS設備中的各種設定檔以及其位置

/config
存儲使用中的配置和最近三代的配置
/var/db/config
存儲四代和更高版本的配置。 可以顯示在 "檔顯示" 命令中,該指令被壓縮並以 GZ 格式存儲。 FreeBSD 可以使用 Zcat 命令顯示
/var/tmp
要存儲image的目錄,如在JUNOS軟體升級期間。 它還存儲每個守護進程的核心轉儲檔。
/var/log
包含通過各種 Log traceoption 函數獲得的調試資訊檔
/var/home
創建每個使用者的主目錄。
每個使用者存儲本機存放區在每個使用者的主目錄中的資訊。
例如,如果使用 save 命令保存當前配置。

/config/juniper.conf.gz
It is the config. It is used for rollback 0.
Note that juniper.conf juniper.conf.gz and juniper.conf.gz.jc are morally equivalent.

/config/juniper.conf+.gz
This is the candidate configuration and only exists during commit.

/config/juniper.conf.1.gz through juniper.conf.3.gz
Rollback configurations 1 through 3.

/config/rescue.conf.gz
A copy of a known good and working configuration that you can load in case of an emergency without having to remember which rollback number to use.

/var/run/db/juniper.db
This is the shared candidate database

/var/run/db/juniper.data+
A copy of the candidate dbused during commit checkand
during commitbecomes juniper.data if all is well.

/var/run/db/junper.save
juniper.data may contain the results of expanding groups and applying transient changes from commit scriptsin either casejuniper.save represents the committed db before those changes are applied.
This is needed for seeding private edit sessions and looking at the committed config without inheritance etc.

/var/db/config/juniper.conf.4.gz through juniper.conf.49.gz
Rollback configurations 4 through 49.
Alsoon JSeries at least the balance of configs in config and var/db/config is configurable.

juniper.data
This is the committed config database (i.e.the active configuration).



request 命令

request 命令用於執行系統範圍的功能,如重新啟動、升級和關閉設備。
此命令組還具有連線、離線重新開機單個元件,以及在不必重新啟動整個設備的情況下重新開機單個元件的功能:
root@srx210> request chassis fpc slot 0 restart
Restart initiated, use "show chassis fpc" to verify
root@srx210> show chassis fpc
            Temp CPU Utilization (%)    Memory Utilization (%)
Slot State (C)     Total Interrupt     DRAM (MB) Heap Buffer
0 Starting 32     0       0           0           0   0
1 Online    30     0       0           8           11 14
2 Empty
3 Empty

request system autorecovery state save   ##恢復出廠設定後SRX alarm亮紅燈解決辦法
request system configuration rescue save   ##設定當前運行中之設定檔為救援配置
request system halt    ##設備關機
request system reboot     ##重啟設備
request system snapshot    ##備份軟體及設定
request system software add /var/tmp/junos-srxsme-10.0R2-domestic.tgz no-copy no-validate reboot  ##JUNOS系統更新
request system software add no-copy no-validate reboot ftp://172.16.1.1/junos-srxsme-11.4R4.4-domestic.tgz  ##JUNOS系統更新
request system software rollback       ##作業系統Downgrade降級(回到前一次版本)
request system services dhcp renew fe-0/0/2.0    ##Renew/Obtain a DHCP Client IP address on the SRX firewall
request system storage cleanup   ##清理檔案系統



root@srx100> request ?
Possible completions:
  chassis              Perform chassis-specific operations
  dhcp                 Perform DHCP operations
  dhcpv6               Perform DHCPv6 operations
  interface            Perform interface tasks
  l2circuit-switchover  Perform l2circuit switchover
  lacp                 Request LACP actions
  message              Send text message to other users
  modem               
  mpls                 Perform Multiprotocol Label Switching operations
  multicast            Perform multicast operations
  network-access       Request network-access related information
  pim                  Perform PIM operations
  pppoe                Perform PPPoE specific operations
  routing-engine       Log in to Routing Engine
  security             Request security operation
  services             Service requests
  snmp                 Request actions from the Simple Network Management Protocol daemon
  support              Perform JUNOS support tasks
  system               Perform system-level operations
  vpls-switchover      Perform LDP VPLS pseudowire switchover
  wireless-wan         Wireless WAN related requests
  wlan                 Wireless LAN related requests
root@srx100>

這個網誌中的熱門文章

如何測試網路連線--網路斷線了怎麼辦?

筆記電腦刷BIOS失敗無法開機—用CH341A編程器重刷BIOS教學!

INTEL XTU使用教學以及對筆電應具備的XTU設定概念