Juniper SRX 自動安裝USB(Autoinstall USB) 製作方法
Juniper SRX (Junos OS) Autoinstall USB自動安裝隨身碟製作方法
當您有多台Juniper SRX設備要更新JUNOS,而您又想簡化upgrade程式,只想要派個人將USB隨身碟插入SRX設備上,並按個按鈕,就能完成升級的動作了,此時您就必須使用SRX USB autoinstallation的JUNOS升級方式了。
SRX USB autoinstallation的升級跟版本無關,也就是您可以進行升級或是降級的動作。
請您在更新前記得要備份重要資料,以防萬一。
SRX
Autoinstall USB功能跟SRX本身的版本也有關係,至少要10.4以上才能支援USB自動昇級的功能。
在開始前您可以先參考Juniper原廠說明:
開啟或關閉SRX USB 自動安裝功能:
root@srx100# show system autoinstallation /* 查看自動安裝功能設定 */
[edit] /* 預設開啟autoinstallation功能,所以顯示空白列 */
root@srx100#
root@srx100# set system autoinstallation usb disable. /* 關閉自動安裝功能 */
root@srx100# show system autoinstallation /* 查看自動安裝功能設定 */
usb {
disable;
}
[edit]
root@srx100#
root@srx100# delete system autoinstallation usb disable. /* 開啟自動安裝功能 */
root@srx100# commit
root@srx100# show system auto? /* 查看系統有哪些自動功能 */
Possible completions:
> auto-configuration
auto-snapshot Enable
auto-snapshot when boots from alternate slice
> autoinstallation Autoinstallation configuration
[edit]
root@srx100#
SRX Autoinstall USB其製作步驟如下:
1. 先拿個USB隨身碟,並將其格式化成FAT/FAT16/FAT32的格式
2. 將要昇級的JUNOS版本(例如junos-srxsme-12.1X46-D65.4-domestic.tgz)複製到USB隨身碟中根目錄下(記住只能有一個JUNOS image檔案)
以下是我現有的版本
[edit]
root@srx100> show
system software ##檢查當前系統版本
Information for JUNOS:
Comment:
JUNOS Software Release [12.1R7.9]
3. 在USB隨身碟上製作autoinstall.conf檔案。
在鍵盤上按"視窗鍵+R鍵",就會跳出執行視窗,請您在"開啟"欄位中輸入"cmd"後按"確定",來進入DOS模式。
然後輸入以下指令,其中echo "" 會將雙引號內的內容回應到螢幕上,但在此我們用轉向符號 > 來將其內容轉到檔案上,因為雙引號中間並沒有文字,所以會產生一個空的文字檔。
C:\> echo
"" > [USB隨身碟的磁碟代號]:\autoinstall.conf
例如我的USB隨身碟的磁碟代號是f,所以我的指令是:
C:\> echo
"" > f:\autoinstall.conf ##製作一個名為autoinstall.conf的空的文字檔,目的是提供給SRX設備辨識用
或是在電腦上將空的 "新文字文件.txt"(檔案大小為0) 文字檔更名為autoinstall.conf,然後複製到USB隨身碟也可以。
此時USB隨身碟內只有兩個檔案:autoinstall.conf和JUNOS image(例如junos-srxsme-12.1X46-D65.4-domestic.tgz)
4. 把USB隨身碟插到SRX的USB slot中,接著稍待片刻讓SRX偵測到USB。
當您插入USB時,Console會出現類似以下的提示:
root@srx100>
umass1:
SanDisk Ultra,rev
2.10/1.00,addr 4
da1 at
umass-sim1 bus 1 target 0 lun 0
da1:
<SanDisk Ultra 1.00> Removable Direct Access SCSI-6 device
da1:
40.000MB/s transfers
da1:
14663MB (30031250 512 byte sectors: 255H 63S/T 1869C )
在此同時系統偵測到autoinstall.conf與JUNOS image的存在,SRX100設備面板上四個燈號會全部變成紅色(ALARM、STATUS、POWER、HA),並且每秒四個紅燈一起閃爍一次來等待您按下RESET CONFIG按鈕。
5. 請直接按一下SRX的RESET
CONFIG按鈕(面板上有標明RESET CONFIG,注意不要按錯POWER按鈕,並且只是按一下就放開,而不是長按不放)
6. 接下來所有的四個燈號都會變紅色燈號恆定(不閃爍了),然後就開始自動進行昇級動作,一直到四個燈號全部變成綠色恆亮,並且console畫面出現Saving state for rollback
...訊息,畫面還告訴您要使用request
system reboot命令來重開機,此時按兩下enter就會跳回操作模式,請您依照指示重開機,等到重開機完成燈號就會恢復正常,而系統也會完成升級的動作了。
以下為第三步驟完成後,第四步驟開始時console所顯示的實做畫面,請您依照指示進行即可。
root@srx100>
umass1: SanDisk Ultra,rev 2.10/1.00,addr 4
da1 at umass-sim1 bus 1 target 0 lun 0
da1: <SanDisk Ultra 1.00>
Removable Direct Access SCSI-6 device
da1: 40.000MB/s transfers
da1: 14663MB (30031250 512 byte
sectors: 255H 63S/T 1869C ) ##以上部分為插入USB隨身碟時所產生的訊息,此時設備面板上四個燈號會全部變成紅色(ALARM、STATUS、POWER、HA),並且每秒四個紅燈一起閃爍一次
Formatting alternate root (/dev/da0s2a )...
##當按下RESET
CONFIG按鈕後所產生的訊息,然後設備開始更新JUNOS系統
/dev/da0s2a : 297.9MB (610044 sectors) block size 16384,fragment size 2048
using
4 cylinder groups of 74.47MB,4766 blks,9600 inodes.
super-block backups (for fsck -b #) at:
32,152544,305056,457568
Extracting /tmp/mnt_usb_dev.1804/junos-srxsme-12.1X46-D45.4-domestic.tgz
...
Checking compatibility with
configuration
Initializing...
Verified manifest signed by
PackageProduction_12_1_0
Verified JUNOS-12.1R7.9-domestic signed
by PackageProduction_12_1_0
Using JUNOS-12.1X46-D45.4-domestic from
/altroot/cf/packages/install-tmp/JUNOS-12.1X46-D45.4-domestic
Copying package ...
Verified manifest signed by
PackageProductionRSA_2016
Hardware Database regeneration
succeeded
Validating against
/config/Juniper.conf.gz
Connectivity fault management process:
rtslib: ERROR kernel does not support all messages: expected 102 got 98,a
reboot or software upgrade may be required
Connectivity fault management process:
Connectivity fault management process:
rtslib: WARNING version mismatch for msg notify msg: expected 0 got 232,a
reboot or software upgrade may be required
Connectivity fault management process:
Connectivity fault management process:
rtslib: WARNING version mismatch for msg residx: expected 98 got 95,a reboot or
software upgrade may be required
Connectivity fault management process:
Connectivity fault management process:
rtslib: WARNING version mismatch for msg unknown: expected 98 got 6,a reboot or
software upgrade may be required
Connectivity fault management process:
mgd: commit complete
Validation succeeded
Validating against
/config/rescue.conf.gz
Connectivity fault management process:
rtslib: ERROR kernel does not support all messages: expected 102 got 98,a
reboot or software upgrade may be required
Connectivity fault management process:
Connectivity fault management process:
rtslib: WARNING version mismatch for msg notify msg: expected 0 got 232,a reboot
or software upgrade may be required
Connectivity fault management process:
Connectivity fault management process:
rtslib: WARNING version mismatch for msg residx: expected 98 got 95,a reboot or
software upgrade may be required
Connectivity fault management process:
Connectivity fault management process:
rtslib: WARNING version mismatch for msg unknown: expected 98 got 6,a reboot or
software upgrade may be required
Connectivity fault management process:
mgd: commit complete
Validation succeeded
Installing package
'/altroot/cf/packages/install-tmp/JUNOS-12.1X46-D45.4-domestic' ...
Verified
JUNOS-boot-SRXsme-12.1X46-D45.4.tgz signed by PackageProductionRSA_2016
Verified junos-srxsme-12.1X46-D45.4-domestic
signed by PackageProductionRSA_2016
JUNOS 12.1X46-D45.4 will become active at next reboot
WARNING: A reboot is required to load this software correctly
WARNING: Use the
'request system reboot' command
WARNING: when
software installation is complete
Saving state for rollback ...
##當面板四個燈號都變綠燈恆亮時,畫面會停在此處
root@srx100> ##此時要按enter才會跳回操作模式
root@srx100> show
system software ##檢查當前系統版本
Information for JUNOS:
Comment:
JUNOS Software Release [12.1R7.9]
root@srx100> request system reboot ##重新開機
warning: The configuration has been
changed but not committed
Reboot the system ? [yes,no] (no) yes
Shutdown NOW!
[pid 2023]
root@srx100>
*** FINAL System shutdown message from
root@srx100 ***
System going down IMMEDIATELY
...
... ##重開機過程省略
...
SRX100 (ttyu0)
login: root
Password:
--- JUNOS 12.1X46-D45.4 built 2016-02-04
21:01:05 UTC
root@srx100% cli
root@srx100> show system software backup
Backup JUNOS package information:
File name: /altroot/cf/packages/JUNOS-12.1R7.9-domestic
File size: 147277493
root@srx100>
大功告成!