labunix's blog

labunixのラボUnix

FortiGate-80Cの初期設定、バックアップ、リストア、アップグレード

■FortiGate-80Cの初期設定、バックアップ、リストア
 「System started.」が表示されてから数分(2分位)待たされる。

■初期ログイン、ログオフ
 ユーザ名はadmin、パスワード無し()
 ホスト名がシリアルになっている点に注意。

FGT80C0123456789 login: admin
Password: 
Welcome !
FGT80C0123456789 # exit

■まずは初期化方法
 ユーザ名は「admin」、パスワードは無し。
 または、ユーザ名は「maintainer」、「bcpb」とシリアルがパスワード
 ※ただし、「maintainer」のログインはloginプロンプトが
  出てから30秒超えると受け付けなくなるので注意。

FGT80C0123456789 login: admin
Password: 
Welcome !

FGT80C0123456789 login: maintainer
Password: bcpbFGT80C0123456789
Welcome !

This operation will reset the system to factory default!
Do you want to continue? (y/n)y


System is resetting to factory default...


The system is going down NOW !!

■adminパスワードの変更

FGT80C0123456789 login: admin
Password: 
Welcome !

FGT80C0123456789 # config system admin
FGT80C0123456789 (admin) # edit admin
FGT80C0123456789 (admin) # set password password
FGT80C0123456789 (admin) # end
FGT80C0123456789 # exit
Auto backup config ...
FGT80C0123456789 login: admin
Password: ********
Welcome !

■「NAT/Routeモード」時のIP設定
 管理用のIPさえ振れば、後はWANと、DNS、gatewayの設定はWebでもCUIでも。
 下記を参考に。

  QuickStart Guide
  http://docs.fortinet.com/uploaded/files/833/FortiGate-80C-LENC-QuickStart.pdf

FGT80C0123456789 # config system interface
FGT80C0123456789 (interface) # edit internal
FGT80C0123456789 (internal) # set ip 172.31.31.253/24
FGT80C0123456789 (internal) # show 
config system interface
    edit "internal"
        set vdom "root"
        set ip 172.31.31.253 255.255.255.0
        set allowaccess ping https ssh http
        set dns-query recursive
        set type physical
    next
end
FGT80C0123456789 (internal) # end

■natモードのGWの設定方法

FGT80C0123456789 # config router static
FGT80C0123456789 (static) # edit 1
FGT80C0123456789 (1) # set gateway 172.31.31.254
FGT80C0123456789 (1) # show 
config router static
    edit 1
        set gateway 172.31.31.254
    next
end
FGT80C0123456789 (1) # end
FGT80C0123456789 #

■「Transparentモード」時のIP設定
 これも管理用のIPを振るだけ。
 ※natモードに戻すには初期化が必要かも。

FGT80C0123456789 # config system settings
FGT80C0123456789 (settings) # set opmode transparent
FGT80C0123456789 (settings) # set ip 172.31.31.253/24
FGT80C0123456789 (settings) # set gateway 172.31.31.254
FGT80C0123456789 (settings) # end

Changing to TP mode

■DNSの設定形式は以下。

config system dns
set primary 172.31.31.254
set secondary 172.31.31.1
end

■「terminal length 0」相当のコマンド
 ※デフォルトはmore形式

FGT80C0123456789 # config system console
FGT80C0123456789 (console) # set output standard
FGT80C0123456789 (console) # end
FGT80C0123456789 # get system console 
baudrate            : 9600
mode                : line 
output              : standard 

FGT80C0123456789 # config system console
FGT80C0123456789 (console) # set output more
FGT80C0123456789 (console) # end
FGT80C0123456789 # get system console 
baudrate            : 9600
mode                : line 
output              : more 

■natモードか、transparentモードか。
 「get」コマンドでステータスを確認出来る。

# get system settings 
opmode              : nat 
bfd                 : disable 
utf8-spam-tagging   : enable 
wccp-cache-engine   : disable 
vpn-stats-log       : 
vpn-stats-period    : 0
v4-ecmp-mode        : source-ip-based 
asymroute           : disable 
strict-src-check    : disable 
asymroute6          : disable 
per-ip-bandwidth    : enable 
sip-helper          : enable 
sip-nat-trace       : enable 
status              : enable 
sip-tcp-port        : 5060
sip-udp-port        : 5060
sccp-port           : 2000
multicast-forward   : disable 
multicast-ttl-notchange: disable 
allow-subnet-overlap: disable 
ecmp-max-paths      : 10

■ping

# execute ping 172.31.31.254
PING 172.31.31.254 (172.31.31.254): 56 data bytes
64 bytes from 172.31.31.254: icmp_seq=0 ttl=64 time=9.9 ms
64 bytes from 172.31.31.254: icmp_seq=1 ttl=64 time=0.3 ms
64 bytes from 172.31.31.254: icmp_seq=2 ttl=64 time=0.2 ms

--- 172.31.31.254 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.2/3.4/9.9 ms

■ftp経由のバックアップ
 相手がFTPサーバなら、以下のコマンドで。
 認証の指定方法が若干特殊なので注意。

# execute backup config ftp sample 172.31.31.254 username password
Please wait...
Please wait...

Connect to ftp server 172.31.31.254 ...
Send config file to ftp server OK.

■ftp経由のリストア
 ※自動的に再起動する。

# execute restore config ftp sample 172.31.31.254 username password

■ちょっとした変更でもバックアップしたconfigは長いので、
 「show」コマンドで変更の都度確認するなり、
 コマンド実行ログを残すクセを付けた方が良さそう。

$ wc -l sample 
1908 sample

■というわけでsshログイン

$ script ssh.log
Script started, file is ssh.log
$ ssh admin@172.31.31.253
# 

■firmwareのアップグレードはWebからの方が簡単そうだったので、
 Web管理コンソールにログインして「.out」ファイルを指定して実行。

 The FortiGate Cookbook FortiOS 5.0
 http://www.fortinet.co.jp/doc/FortiGate-Cookbook50_p139.pdf

■Firmwareのアップデート時、コンソールには以下の表示
 コンソールがログインプロンプト表示になるまで待つ。

Checking new firmware integrity ... pass


Firmware upgrade in progress
Firmware upgrade in progressDone.


The system is going down NOW !!
Please stand by while rebooti
■バージョンの確認
 5.2系にはまだしない。
 HP社が20141月時点で検証済みとしている5.0.5とした。

# get system status 
Version: FortiGate-80C v5.0,build0252,131031 (GA Patch 5)
...

 FortiOS4.0バージョンサポート終了日更新のお知らせ
 http://h20565.www2.hp.com/hpsc/doc/public/display?docId=emr_na-c04109140

■Web管理の日本語化
 以下の順に左側のメニューをたどり、「Apply」で適用。

System > Admin > Settings > View Settings > Language > Japanese