vSRX on your laptop
PCではじめるvSRX
〜JUNOSを触ってみよう!〜
Juniper Networks, K.K.
kazubu
June 2015
2 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この資料では、以下の内容について説明します。
vSRXと本資料について
VMware Playerのインストールとネットワーク設定
vSRXのインストールと初期設定
rootパスワードとホスト名、タイムゾーンの設定
ユーザの作成
Interfaceに対するIPアドレスの割り当て(DHCP, Static)
JUNOSの基本オペレーション
この資料の後に、様々なユースケースを紹介しています。 Firewall <Firewall/NAT>
Firewall <IPsec>
JUNOS Router <Static/Dynamic Routing>
JUNOS Router <MPLS/VPLS>
JUNOS Automation <Event Policy>
NetScreen/SSG-like GUI – “CW4S”
そちらも是非併せてご参照ください。
3 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXと本資料について
vSRXとは、VMware/KVM上で動作する、ブランチ型SRXシリーズサービスゲートウェイを基にしたバーチャルアプライアンス型セキュア・ルーターです。
サポートする機能等については、リリースノートをご参照ください。
本資料では、vSRXをVMware Player上で試用していただくための簡単な例と手順を紹介します。
※vSRXの公式な動作サポートプラットフォームは、VMware ESXi 5.0および5.1, 5.5, KVM(CentOS 6.3, Ubuntu 14.04, Contrail 1.0)となります。本資料はあくまで試用を目的とした参考資料であり、公式にはサポート対象外の構成となりますので、ご注意ください。
4 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのインストール
5 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのダウンロード
Webブラウザで https://my.vmware.com/jp/web/vmware/free を開きます。
ページ下部Desktop & End-User Computing 内にVMware Playerがありますので、製品のダウンロードをクリックします。
遷移後の画面上部にバージョンを選択するドロップダウンボックスがありますので、5.0を選択します。
VMware Player 5.0.3 for Windows 32-bit and 64-bit をダウンロードします。
6 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのインストール
ダウンロードしたインストーラを実行し、手順に沿ってインストールを完了します。
インストール中に選択する項目についてはお好みで設定してください。
7 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのネットワーク設定
8 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのネットワーク設定
VMware Player上にインストールしたvSRXから、PC上の2つのNICをそれぞれ使用するために、VMwareのネットワーク設定を変更します。
PCのOnboard NICUSB などによる
増設NIC
9 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
仮想ネットワークエディタの起動
VMware Playerでは、ネットワーク設定を変更する機能を起動するためのインターフェースが用意されていませんが、以下の手順で起動することができます。
1. デスクトップ等を右クリックし、ショートカットを新規作成する
2. ショートカットの場所に以下の値を指定する
rundll32 "c:¥Program Files (x86)¥VMware¥VMware Player¥vmnetui.dll",VMNetUI_ShowStandalone
3. ショートカット名を任意に設定する(e.g. vmnetcfg)
4. 作成したショートカットを右クリックし、管理者権限で実行する
10 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
仮想ネットワークの設定
仮想ネットワークエディタを起動すると以下のような画面が開くので、「ネットワークの追加」をクリックします。
11 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
仮想ネットワークの設定
追加するネットワークを選択する画面が表示されるので、空いている物の中から任意に選択します。なお、今回はVMnet5を使用します。
追加が完了すると以下のように、仮想ネットワークが作成されます。
12 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ブリッジの設定
初期状態ではVMnet0が自動ブリッジとして設定されているため、まずVMnet0のブリッジ先NICを固定します。
仮想ネットワークエディタでVMnet0を選択し、ブリッジ先に上流側のNICを指定します。
13 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ブリッジの設定
同じ手順で、VMnet5のブリッジ先に下流側のNICを指定します。
14 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
変更の適用
最後に、仮想ネットワークエディタのOKをクリックし、変更したネットワーク構成を保存します。
15 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
16 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
vSRXのイメージを準備します。 vSRXのイメージは以下のサイトよりダウンロードすることが可能です。
http://www.juniper.net/support/downloads/?p=junosvfirefly-eval
ダウンロードの際には、Juniperのサポートサイトへログインするためのアカウントが必要となります。お持ちでない場合、あらかじめ以下のサイトよりアカウントを作成しておいてください。
https://tools.juniper.net/entitlement/setupAccountInfo.do
VMware Playerでお試しいただく際には、VMware版のイメージをダウンロードしていただく必要があります。
17 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
VMware Playerを起動します。
VMware Player左上のメニューで、ファイル→開く(O)を選択します。
18 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
ファイルを選択する画面が開くので、同梱のovaファイルを選択します。
19 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
仮想マシンの名前と保存先を指定する画面が出てくるので、任意の名前と保存先を指定し、インポートします。
インポートの開始前に、使用許諾契約(EULA)が表示されるので、内容を読んだ上で同意します。
20 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ネットワーク設定の編集
インポートが完了すると、指定した名前の仮想マシンがVMware Playerに追加されています。それを選択し、「仮想マシン設定の編集」を選択します。
21 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ネットワーク設定の編集
仮想マシン設定ウィンドウの左ペインに表示されているネットワークアダプタを選択し、ブリッジが選択されていることを確認します。
次に、ネットワークアダプタ2を選択し、ネットワーク接続の種類をカスタムに変更して、先程作成した仮想ネットワーク(VMnet5)を選択します。
22 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの起動
OKを押してVMware Playerのメイン画面に戻り、「仮想マシンの再生」をクリックすると、vSRXが起動します。
23 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
24 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
vSRXが起動しているウィンドウをクリックすると、VM内にキーボードで入力を行うことができるようになります。
なお、 CtrlとAltを同時に押すことで、ホストPCの操作に戻ることができます。
まず、vSRXにrootでログインします(パスワードなし)。
25 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
ログインに成功すると、root@%といったシェルモードのプロンプトが表示されるので、「cli」と入力し、オペレーションモードに移行します。
次に「configure」と入力して、コンフィギュレーションモードに移行します。
26 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
以下の設定コマンドを入力し、ホスト名とrootのパスワード、タイムゾーンを設定します。
commitと打つと設定が反映され、プロンプトにホスト名が表示されるようになります。root# set system host-name 任意のホスト名root# set system root-authentication plain-text-password
New password:
Retype new password:
root# set system time-zone Asia/Tokyo
[edit]
root# commit
commit complete
[edit]
root@host#
27 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
以下の設定コマンドを入力し、ユーザを新規作成します。
[edit]
root@host# set system login user ユーザ名 class super-user
[edit]
root@host# set system login user ユーザ名 authentication plain-
text-password
New password:
Retype new password:
認証にはパスワードのほかに、SSH用の公開鍵も指定可能です。
(例)
root@host# set system login user ユーザ名 authentication ssh-rsa
"ssh-rsa AAAAB………Q== comment"
28 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
以下の設定コマンドを入力して、ge-0/0/0.0(上流側ネットワークのインターフェース)にDHCPによるアドレス自動割当を設定します。
[edit]
root@host# set interfaces ge-0/0/0 unit 0 family inet dhcp
[edit]
root@host# commit
commit complete
[edit]
root@host#
なお、DHCPサーバが存在しない場合は、以下のようにしてIPアドレスを割り当て、デフォルトルートを設定します。
root@host# set interfaces ge-0/0/0 unit 0 family inet address
192.168.0.10/24
root@host# set routing-options static route 0/0 next-hop
192.168.0.1
29 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
「exit」と入力することで、コンフィギュレーションモードからオペレーションモードへ復帰することができます。
オペレーションモードへ復帰し、show interfaces terseと入力し、ge-0/0/0.0インターフェースに設定されたIPアドレスを確認します。
root@vsrx> show interfaces terse
Interface Admin Link Proto Local Remote
ge-0/0/0 up up
ge-0/0/0.0 up up inet 192.168.0.10/24
gr-0/0/0 up up
…
この時点で、上流側ネットワークからvSRXに対して、SSHやHTTP等による接続が可能となっています。
以上でvSRXの初期設定は完了です。
30 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
JUNOSの基本オペレーション
31 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
JUNOSの基本オペレーション
ここでは、JUNOSの基本的なオペレーションを抜粋して紹介します。
より詳しい情報は、末尾にて紹介しております、DayOne ブックレット等をご参照ください。
Juniper Networks Day One ブックレット(日本語版)
http://www.juniper.net/jp/jp/dm/dayone/
32 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
3つのモード
JUNOSのCLIには以下の3つのモードがあります
Shellモード
UNIXコマンドが実行可能
シリアルコンソール等、実機のttyにrootでログインした際の最初のモード
"cli" と入力することによってOperationalモードに移行可能
Operationalモード
パラメータの表示、プロセスの再起動やシャットダウン、情報のclear等が可能
SSHやTelnet等でログインした際や、root以外のユーザでログインした際の最初のモード
"configure" と入力することによってConfigurationモードに移行可能
Configurationモード
設定の編集が可能
Top levelにて"exit" または、任意のlevelにて"exit configuration-mode"と入力することにより、Operationalモードに復帰可能
33 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Operationalモードのツリー構造
コマンドは階層を持っています。
ex) root> show route terse
clear configure monitor set show
brief exact protocol table terse
bgp chassis interfaces isis ospf route version
大項目
小項目
34 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ショートカットキー
カーソルの移動
Ctrl-B Back one character
Ctrl-F Forward one character
Ctrl-A To beginning of line
Ctrl-E To end of line
文字の削除
Delete or
backspace key Delete character before cursor
Ctrl-D Delete character under cursor
Ctrl-K Delete from cursor to end of line
Ctrl-U Delete all characters
Ctrl-W Delete entire word to left of cursor
35 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ショートカットキー
その他
Ctrl-L Redraw the current line
Ctrl-P Move backwards through command history
Ctrl-N Move forward through command history
Help
? 次に入力すべきコマンドやパラメータのヒント
36 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ラインの編集
コマンド補完機能
TabかSpaceキーでコマンドを補完
Example:
root@host> show i
^
'i' is ambiguous.
Possible completions:
igmp Show Internet Group Management Protocol
information
interfaces Show interface information
ipv6 Show IP version 6 information
isdn Show Integrated Services Digital Network
information
isis Show Intermediate System-to-Intermediate
System information
root@host> show i
37 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Syntax errorの通知
コマンドシンタックスエラーがあると
^ マークが「どこ」にエラーがあるかを示します
メッセージは正しいコマンドのヒントを表示します
Example:
root@host# load
^
syntax error, expecting <command>.
[edit]
root@host#
38 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Configモードのツリー構造
Operationalモードと同様でconifgモードでも階層構造になっています
top
atm e3 sonet t3
clock fpc
firewall interfaces protocols system more…
ethernet
alarm
chassis
大項目
小項目
39 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
階層間の移動
下の階層に入るにはedit コマンドを使用
直接小項目まで打ち込むときには、set コマンドでフルパスを指定します
top
atm e3 sonet t3
clock fpc
firewall interfaces protocols system more…
ethernet
alarm
chassis
[edit chassis alarm ethernet]
40 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
階層間の移動
exit:今までいたレベルに戻ります
topでexitを実行すると,Operationalモードに戻ります
Operationalモードでexitを実行すると,システムからLogoutします
ShellからcliでOperationalモードに入った場合、Shellに戻ります
up:一つ上のレベルに移動します
top:最上位のレベルに移動します
41 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Commitベースの設定管理
Commitするまで設定は反映されません
もし設定を間違えたら,rollbackにて前の状態に戻ることが可能です
commit
rollback n
Candidateconfiguration
Activeconfiguration
1 2 ...
0
Rollback files stored in/config/juniper.conf.n (n=1-5)/cf/var/db/config/juniper.conf.n (n=6-49)
42 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
編集中の設定確認
Configurationモードで編集中の設定を確認するには、showコマンドを使用します
設定の一部の階層のみを表示させたいときには、showの後に階層を入力します(例: show interfaces)
[edit]
root@host# show interfaces
ge-0/0/0 {
unit 0 {
family inet {
dhcp
}
}
}
ge-0/0/1 {
unit 0 {
family inet {
address 192.168.200.1/24;
}
}
}
43 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定の変更(set/rollbackコマンド)
設定の追加や変更にはsetコマンドを使用します
Commitするまでは反映されません
Example:
[edit]
root@host# set chassis alarm ethernet link-down red
[edit]
root@host#
元の設定に戻したい場合はrollbackコマンドを実行してください
もし何回かcommitしてしまっていたら,rollback n(0-49)でその時点まで戻ります。
44 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
編集前後のconfigチェック
編集している時には,Running Configを表示するコマンドはありません.差分を確認するには以下のコマンド(パイプ)を使用します
show | compare
Example:
root@host# show |compare
[edit interfaces ge-0/0/0 unit 0 family inet]
address 10.0.0.1/30 { ... }
+ address 10.1.1.1/30;
45 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定の削除(Deleteコマンド)
設定を削除するにはdeleteコマンドを使用します
Example:
[edit]
lab@srx1# edit chassis alarm ethernet
[edit chassis alarm ethernet]
lab@srx1# delete link-down
lab@srx1#
topでdelete[改行]とすると全てのconfigを削除してしまうので,注意
46 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Configのアクティベート
commit コマンドによって編集した設定がアクティブになります
[edit]
lab@srx1# commit
commit complete
[edit]
lab@srx1#
必ずcommitする前にconfigをチェックするようにしましょう
[edit]
lab@srx1# commit check
configuration check succeeds
[edit]
lab@srx1#
47 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定の自動復旧(トラブルを未然に防ぐ機能)
commit confirmed コマンドでcommitすると再度commitしない限りdefault10分で元のconfigにrollbackします
指定した時間あるいはdefaultの10分以内に2度目のcommitを入れることでconfigは完全に反映されます
Example:[edit]
lab@srx1# commit confirmed 1
commit confirmed will be automatically rolled back in 1 minutes
unless confirmed
commit complete
vSRX on your laptop
ユースケース集
Juniper Networks, K.K.
June 2015
49 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この資料では、以下の内容について説明します。 ユースケース
1. Firewall <Firewall/NAT>
– Firewall設定, NAT設定
– DHCPサーバ設定
2. Firewall <IPsec>
– Firewall設定, NAT設定
– IPsec設定
3. JUNOS Router <Static/Dynamic Routing>
– ルータとして使用するための設定
– Static Route設定
– OSPF設定
– BGP設定
4. JUNOS Router <MPLS/VPLS>
– MPLSの設定
– VPLSの設定
5. JUNOS Automation <Event Policy>
– JUNOScriptとEvent Policyの概要
– Event Policyのユースケースと設定例
6. NetScreen/SSG-like GUI – "CW4S"
vSRX on your laptop
ユースケース : Firewall <Firewall/NAT>
Juniper Networks, K.K.
June 2015
51 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この章では以下の手順を紹介します。
Firewall設定, NAT設定
DHCPサーバ設定
52 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
想定環境
この資料は、以下のような環境を想定して作成されています。また、「vSRXのインストールと初期設定」を完了していることを前提としています。
ハードウェア
CPU: x86-64/AMD64を搭載したプロセッサ
RAM: 4GB以上
HDD: 空き容量10GB程度
NIC: 2つまたはそれ以上
ソフトウェア
OS: Windows 7
VMM: VMware Player 5.0
vSRX 12.1X47-D20
ネットワーク
上流側ネットワークとして、DHCPが利用可能なIPネットワークが存在する
下流側ネットワークとして、DHCPクライアントとなるPCが1台もしくはそれ以上存在する
53 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
FIREWALLの設定
54 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Firewallの設定
ここでは、vSRXをシンプルなファイアウォールとして設定する手順を紹介します。
想定するネットワークは以下のようなものです。
Internet
Router
vSRX
Clientge-0/0/0 ge-0/0/1
55 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPアドレスの設定
まずはじめに、以下の設定コマンドを入力し、下流側IFに対してIPアドレスを設定します。
※IPアドレスやプレフィックス長は適宜読み替えてください
[edit]
root@host# set interfaces ge-0/0/1 unit 0 family inet address
192.168.200.1/24
56 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Security Zone
JuniperのFirewallでは、単体または複数のInterfaceをSecurity Zoneというグループに割り当て、ゾーン間の通信およびゾーン内の通信に対してさまざまな制御を行います。
vSRXでは、デフォルトでtrust, untrustという2つのSecurity Zoneが存在し、ge-0/0/0.0(ge-0/0/0 unit 0) のみがuntrustに割り当てられています。
trustは名前の通り、信頼されたネットワーク(内側)として、untrustは信頼されていないネットワーク(外側)として機能するように設定されています。
57 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
インターフェースのSecurity Zoneへの割り当て
今回の設定例では、ge-0/0/0を外側、ge-0/0/1を内側として設定するため、まずは以下のようにして、ge-0/0/1を内側のZone(trust)に割り当てます。
[edit]
root@host# set security zones security-zone trust interfaces ge-
0/0/1.0
58 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
インターフェースに対するシステムサービスの許可
そのままでは、SSHやHTTP/HTTPS, DHCP等のシステムサービスが通信できませんので、以下のようにしてインターフェースに対する通信を許可します。
[edit]
root@host# set security zones security-zone trust interfaces ge-
0/0/1.0 host-inbound-traffic system-services ssh
※sshのほかにも、httpやhttps, dhcp, ping, ftp等のシステムサービスが定義されており、同様に許可することができます。
59 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ポリシーの設定
ゾーン間やゾーン内での通信は、ポリシーがない場合はすべて暗黙のポリシーにより禁止されます。
vSRXでは、デフォルトでtrust内及び、trustからuntrustへの通信を許可するポリシーが定義されています。(default-permit)
たとえば以下のように設定することにより、trustゾーンからuntrustゾーンへのtelnet接続を禁止することができます。
[edit]
root@host# set security policies from-zone trust to-zone untrust
policy deny-telnet match source-address any
root@host# set security policies from-zone trust to-zone untrust
policy deny-telnet match destination-address any
root@host# set security policies from-zone trust to-zone untrust
policy deny-telnet match application junos-telnet
root@host# set security policies from-zone trust to-zone untrust
policy deny-telnet then reject
root@host# insert security policies from-zone trust to-zone
untrust policy deny-telnet before policy default-permit ← deny-telnetをdefault-permitの上に移動root@host# commit
60 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
Router
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0DHCP
ge-0/0/1.0192.168.200.1
telnet
telnet以外
既存セッションの戻りパケット
既存セッションにないパケット
SSH/DHCP
SSH/DHCP以外
SSH
SSH以外
61 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
フローセッションの確認
Firewallは通信をセッションベースで管理するため、すべての通信に対して一意にフローセッションが生成されます。
これは以下のようにして確認することができます。
root@host# exit ← ConfigurationモードからOperationalモードへ移行Exiting configuration mode
root@host> show security flow session
Session ID: 1109, Policy name: default-permit/5, Timeout: 1774,
Valid
In: 192.168.200.11/49239 --> a.b.c.d/80;tcp, If: ge-0/0/1.0,
Pkts: 41, Bytes: 4930
Out: a.b.c.d/80 --> 192.168.200.11/32326;tcp, If: ge-0/0/0.0,
Pkts: 55, Bytes: 7324
Total sessions: 1
62 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
63 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
Firewall設定が完了しても、上位のルータがクライアントPCの所属するIPサブネット(例:192.168.200.0/24)への経路を持っていないため、まだクライアントPCはインターネットに接続することはできません。
これを解決する方法として以下のようなものがあります。
上位のルータに静的経路を設定する
上位のルータおよびvSRXにルーティングプロトコルを設定する
NATを設定する
ここでは、NATを設定することによってクライアントPCをインターネットに接続可能にします。
64 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
以下の設定コマンドを入力し、trustゾーンからuntrustゾーンへ出ていく通信に対して、untrust側インターフェースのIPアドレスでSource NATを行います。
[edit]
root@host# set security nat source rule-set trust-to-untrust from
zone trust
root@host# set security nat source rule-set trust-to-untrust to
zone untrust
root@host# set security nat source rule-set trust-to-untrust rule
trust-to-untrust-rule match source-address 0.0.0.0/0
root@host# set security nat source rule-set trust-to-untrust rule
trust-to-untrust-rule then source-nat interface
root@host# commit
65 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
Router
vSRX
Client PCge-0/0/0.0DHCP
ge-0/0/1.0192.168.200.1
telnet
telnet以外
既存セッションの戻りパケット
既存セッションにないパケット
SSH
SSH以外
SSH/DHCP
SSH/DHCP以外
NAT
Untrust Zone Trust Zone
66 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
67 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
下流インターフェース配下のクライアントPCにIPアドレスを割り当てるため、DHCPサーバを設定します。
68 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
たとえば、192.168.200.0/24のネットワークで192.168.200.10から192.168.200.99をクライアントPCに動的に割り当てる場合、以下のように設定を行います。
[edit]
root@host# set system services dhcp pool 192.168.200.0/24
address-range low 192.168.200.10 high 192.168.200.99
root@host# set system services dhcp pool 192.168.200.0/24 router
192.168.200.1
root@host# set security zones security-zone trust interfaces ge-
0/0/1.0 host-inbound-traffic system-services dhcp
なお、上位インターフェース側のDHCPサーバが配布しているDNSサーバ等の設定を再配布する場合、以下のような設定を行います。
[edit]
root@host# set interfaces ge-0/0/0 unit 0 family inet dhcp
update-server
root@host# set system services dhcp pool 192.168.200.0/24
propagate-settings ge-0/0/0.0
69 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
まとめ
この章では、以下の手順を紹介しました。
Firewallの設定
インターフェースのSecurity Zoneへの割り当て
ポリシーの設定
フローセッションの確認
NATの設定
インターフェースアドレスを用いたSource NATの設定
DHCPサーバの設定
70 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定
最終的に、以下のような設定で動作しているはずです (一部関係のない記述については省略)
set system host-name host
set system root-authentication encrypted-password "*****"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password "*****"
set system services ssh
set system services dhcp pool 192.168.200.0/24 address-range low 192.168.200.10
set system services dhcp pool 192.168.200.0/24 address-range high 192.168.200.99
set system services dhcp pool 192.168.200.0/24 router 192.168.200.1
set system services dhcp pool 192.168.200.0/24 propagate-settings ge-0/0/0.0
set interfaces ge-0/0/0 unit 0 family inet dhcp update-server
set interfaces ge-0/0/1 unit 0 family inet address 192.168.200.1/24
set security nat source rule-set trust-to-untrust from zone trust
set security nat source rule-set trust-to-untrust to zone untrust
set security nat source rule-set trust-to-untrust rule trust-to-untrust-rule match source-address 0.0.0.0/0
set security nat source rule-set trust-to-untrust rule trust-to-untrust-rule then source-nat interface
set security policies from-zone trust to-zone trust policy default-permit match source-address any
set security policies from-zone trust to-zone trust policy default-permit match destination-address any
set security policies from-zone trust to-zone trust policy default-permit match application any
set security policies from-zone trust to-zone trust policy default-permit then permit
set security policies from-zone trust to-zone untrust policy deny-telnet match source-address any
set security policies from-zone trust to-zone untrust policy deny-telnet match destination-address any
set security policies from-zone trust to-zone untrust policy deny-telnet match application junos-telnet
set security policies from-zone trust to-zone untrust policy deny-telnet then reject
set security policies from-zone trust to-zone untrust policy default-permit match source-address any
set security policies from-zone trust to-zone untrust policy default-permit match destination-address any
set security policies from-zone trust to-zone untrust policy default-permit match application any
set security policies from-zone trust to-zone untrust policy default-permit then permit
set security policies from-zone untrust to-zone trust policy default-deny match source-address any
set security policies from-zone untrust to-zone trust policy default-deny match destination-address any
set security policies from-zone untrust to-zone trust policy default-deny match application any
set security policies from-zone untrust to-zone trust policy default-deny then deny
set security zones security-zone trust tcp-rst
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services ssh
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services dhcp
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ssh
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services dhcp
vSRX on your laptop
ユースケース : Firewall <IPsec>
Juniper Networks, K.K.
June 2015
72 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この資料では以下の項目について紹介します。
Firewall, NAT, DHCPの設定
IPsecの設定
対向機器の設定例
73 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
想定環境
この資料は、以下のような環境を想定して作成されています。また、「vSRXのインストールと初期設定」及び、「Firewallの設定」と「NATの設定」を完了していることを前提としています。
ハードウェア
CPU: x86-64/AMD64を搭載したプロセッサ
RAM: 4GB以上
HDD: 空き容量10GB程度
NIC: 2つまたはそれ以上
ソフトウェア
OS: Windows 7
VMM: VMware Player 5.0
vSRX 12.1X47-D20
ネットワーク
上流側ネットワークとして、IPネットワークが存在する
対向として、IPsec対応ルータ/ファイアウォールが存在する
下流側ネットワークとして、DHCPクライアントとなるPCが1台もしくはそれ以上存在する
74 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
FIREWALLの設定
75 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Firewallの設定
まずはじめに、vSRXをファイアウォールとして設定します。
想定するネットワークは以下のようなものです。
vSRX
Clientge-0/0/0 ge-0/0/1
10.0.200.1
10.0.200.10 192.168.200.1
Internet
76 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPアドレスとデフォルトルートの設定
まずはじめに、以下の設定コマンドを入力し、各IFに対してIPアドレスを設定します。
※IPアドレスやプレフィックス長は適宜読み替えてください
[edit]
root@host# set interfaces ge-0/0/0 unit 0 family inet address
10.0.200.10/24
root@host# set interfaces ge-0/0/1 unit 0 family inet address
192.168.200.1/24
以下の設定コマンドを入力し、上位ルータに対してのデフォルトルートを設定します。
[edit]
root@host# set routing-options static route 0.0.0.0/0 next-hop
10.0.200.1
77 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Security Zone
JuniperのFirewallでは、単体または複数のInterfaceをSecurity Zoneというグループに割り当て、ゾーン間の通信およびゾーン内の通信に対してさまざまな制御を行います。
vSRXでは、デフォルトでtrust, untrustという2つのSecurity Zoneが存在し、ge-0/0/0.0(ge-0/0/0 unit 0) のみがuntrustに割り当てられています。
trustは名前の通り、信頼されたネットワーク(内側)として、untrustは信頼されていないネットワーク(外側)として機能するように設定されています。
78 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
インターフェースのSecurity Zoneへの割り当て
今回の設定例では、ge-0/0/0を外側、ge-0/0/1を内側として設定するため、まずは以下のようにして、ge-0/0/1を内側のZone(trust)に割り当てます。
[edit]
root@host# set security zones security-zone trust interfaces ge-
0/0/1.0
79 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
インターフェースに対するシステムサービスの許可
そのままでは、SSHやHTTP/HTTPS, IPsec(IKE)等のシステムサービスが通信できませんので、以下のようにして各インターフェースに対する通信を許可します。
[edit]
root@host# set security zones security-zone untrust interfaces
ge-0/0/0.0 host-inbound-traffic system-services ssh
root@host# set security zones security-zone untrust interfaces
ge-0/0/0.0 host-inbound-traffic system-services ike
root@host# set security zones security-zone trust interfaces ge-
0/0/1.0 host-inbound-traffic system-services ssh
※sshのほかにも、httpやhttps, dhcp, ping, ftp等のシステムサービスが定義されており、同様に許可することができます。
80 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.010.0.200.10
ge-0/0/1.0192.168.200.1
全てのパケット
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH/DHCP
SSH/DHCP以外
81 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
フローセッションの確認
Firewallは通信をセッションベースで管理するため、すべての通信に対して一意にフローセッションが生成されます。
これは以下のようにして確認することができます。
root@host# exit ← ConfigurationモードからOperationalモードへ移行Exiting configuration mode
root@host> show security flow session
Session ID: 1109, Policy name: default-permit/5, Timeout: 1774,
Valid
In: 192.168.200.11/49239 --> a.b.c.d/80;tcp, If: ge-0/0/1.0,
Pkts: 41, Bytes: 4930
Out: a.b.c.d/80 --> 192.168.200.11/32326;tcp, If: ge-0/0/0.0,
Pkts: 55, Bytes: 7324
Total sessions: 1
82 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
83 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
Firewall設定が完了しても、上位のルータがクライアントPCの所属するIPサブネット(例:192.168.200.0/24)への経路を持っていないため、まだクライアントPCはインターネットに接続することはできません。
これを解決する方法として以下のようなものがあります。
上位のルータに静的経路を設定する
上位のルータおよびvSRXにルーティングプロトコルを設定する
NATを設定する
ここでは、NATを設定することによってクライアントPCをインターネットに接続可能にします。
84 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
以下の設定コマンドを入力し、trustゾーンからuntrustゾーンへ出ていく通信に対して、untrust側インターフェースのIPアドレスでSource NATを行います。
[edit]
root@host# set security nat source rule-set trust-to-untrust from
zone trust
root@host# set security nat source rule-set trust-to-untrust to
zone untrust
root@host# set security nat source rule-set trust-to-untrust rule
trust-to-untrust-rule match source-address 0.0.0.0/0
root@host# set security nat source rule-set trust-to-untrust rule
trust-to-untrust-rule then source-nat interface
85 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
vSRX
Client PCge-0/0/0.010.0.200.10
ge-0/0/1.0192.168.200.1
全ての通信
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH
SSH以外
NAT
Untrust Zone Trust Zone
86 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
87 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
下流インターフェース配下のクライアントPCにIPアドレスを割り当てるため、DHCPサーバを設定します。
88 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
たとえば、192.168.200.0/24のネットワークで192.168.200.10から192.168.200.99をクライアントPCに動的に割り当てる場合、以下のように設定を行います。
[edit]
root@host# set system services dhcp pool 192.168.200.0/24
address-range low 192.168.200.10 high 192.168.200.99
root@host# set system services dhcp pool 192.168.200.0/24
router 192.168.200.1
root@host# set security zones security-zone trust interfaces
ge-0/0/1.0 host-inbound-traffic system-services dhcp
89 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
vSRX
Client PCge-0/0/0.010.0.200.10
ge-0/0/1.0192.168.200.1
全ての通信
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH/DHCP
SSH/DHCP以外
NAT
Untrust Zone Trust Zone
DHCP
90 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsecの設定
91 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsecの設定
ここでは、vSRXをIPsec GWとして設定する手順を紹介します。
想定するネットワークは以下のようなものです。
vSRX
Clientge-0/0/0 ge-0/0/1
10.0.200.1
10.0.200.10 192.168.200.1
10.0.100.1
10.0.100.10
192.168.100.1
Client
Internet
92 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
デフォルトルートの設定
以下の設定コマンドを入力し、上位ルータに対してのデフォルトルートを設定します。
[edit]
root@host# set routing-options static route 0.0.0.0/0 next-hop
10.0.200.1
93 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsecの設定
他拠点とのIPsecトンネルを設定していきます。
今回の例では以下のパラメータを使用するものとします。• ルートベースVPN
• 対向セグメント: 192.168.100.0/24
• Interface: st0.100 (unnumbered)
• Zone: vpn
• IKE Phase1• Authentication: Pre-shared Key
• PSK: IPsecVSRX
• DH group: group1
• Encryption Algorithm: 3DES-CBC
• Authentication Algorithm: MD5
• Mode: main
• IPsec(IKE Phase2)• Security Algorithm: ESP
• Encryption Algorithm: AES-128-CBC
• Authentication Algorithm: SHA-1
• Perfect Forward Secrecy: group 1
94 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Interfaceの設定
以下の設定コマンドを入力し、インターフェイス及びゾーンの作成と、スタティックルートの設定を行います。
[edit]
root@host# set interfaces st0.100 family inet
root@host# set security zones security-zone vpn
root@host# set security zones security-zone vpn interfaces st0.100
root@host# set routing-options static route 192.168.100.0/24 next-hop
st0.100
95 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Policyの設定
以下の設定コマンドを入力し、trustゾーンとvpnゾーン間の通信を許可します。
[edit]
root@host# set security policies from-zone trust to-zone vpn policy permit-
all match source-address any
root@host# set security policies from-zone trust to-zone vpn policy permit-
all match destination-address any
root@host# set security policies from-zone trust to-zone vpn policy permit-
all match application any
root@host# set security policies from-zone trust to-zone vpn policy permit-
all then permit
root@host# set security policies from-zone vpn to-zone trust policy permit-
all match source-address any
root@host# set security policies from-zone vpn to-zone trust policy permit-
all match destination-address any
root@host# set security policies from-zone vpn to-zone trust policy permit-
all match application any
root@host# set security policies from-zone vpn to-zone trust policy permit-
all then permit
96 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IKEの設定
以下の設定コマンドを入力し、IKE Phase1の設定を行います。
[edit]
root@host# set security ike proposal ike-p1-prop authentication-method pre-
shared-keys
root@host# set security ike proposal ike-p1-prop dh-group group1
root@host# set security ike proposal ike-p1-prop encryption-algorithm 3des-
cbc
root@host# set security ike proposal ike-p1-prop authentication-algorithm
md5
root@host# set security ike policy ike-policy mode main
root@host# set security ike policy ike-policy proposals ike-p1-prop
root@host# set security ike policy ike-policy pre-shared-key ascii-text
IPsecVSRX
root@host# set security ike gateway ike-gw ike-policy ike-policy
root@host# set security ike gateway ike-gw address 10.0.100.10
root@host# set security ike gateway ike-gw external-interface ge-0/0/0.0
97 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsec(IKE Phase2)の設定
以下の設定コマンドを入力し、IPsec(IKE Phase2)の設定を行います。
[edit]
root@host# set security ipsec proposal ike-p2-prop protocol esp
root@host# set security ipsec proposal ike-p2-prop encryption-algorithm
aes-128-cbc
root@host# set security ipsec proposal ike-p2-prop authentication-algorithm
hmac-sha1-96
root@host# set security ipsec policy ipsec-policy perfect-forward-secrecy
keys group1
root@host# set security ipsec policy ipsec-policy proposals ike-p2-prop
root@host# set security ipsec vpn ipsec-vpn ike gateway ike-gw
root@host# set security ipsec vpn ipsec-vpn ike ipsec-policy ipsec-policy
root@host# set security ipsec vpn ipsec-vpn bind-interface st0.100
98 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsec
ここまでの設定を図にまとめると、以下のようになります。
vSRX
Client PCge-0/0/0.010.0.200.10
ge-0/0/1.0192.168.200.1
全ての通信
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH
SSH以外
NAT
Untrust Zone Trust Zone
10.0.100.1
10.0.100.10
192.168.100.1
Client PC
Internet
IPsec
10.0.200.1
VPN Zone
全ての通信
99 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
状態確認
以下のコマンドを入力して、IKE SA, IPsec SAが正常に確立していることを確認しますroot@host> show security ike security-associations
Index State Initiator cookie Responder cookie Mode Remote Address
2550585 UP 875c7e3f08b3d751 667f542ea7be5552 Main 10.0.100.10
root@host> show security ipsec security-associations
Total active tunnels: 1
ID Algorithm SPI Life:sec/kb Mon lsys Port Gateway
<131073 ESP:aes-cbc-128/sha1 32347d70 3396/ unlim - root 500 10.0.100.10
>131073 ESP:aes-cbc-128/sha1 3dcc7d4e 3396/ unlim - root 500 10.0.100.10
実際に通信を行った後、st0インターフェイスの状態を確認することで、実際に暗号化されてパケットが転送されていることが確認できます。root@host> show interfaces st0.100
Logical interface st0.100 (Index 73) (SNMP ifIndex 519)
Flags: Point-To-Point SNMP-Traps Encapsulation: Secure-Tunnel
Input packets : 40
Output packets: 19
Security: Zone: vpn
Protocol inet, MTU: 9192
Flags: Sendbcast-pkt-to-re
以上で、IPsec VPNの基本的な設定は完了です。
100 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
まとめ
この章では、以下の手順を紹介しました。
IPsec VPNの設定
101 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定(1/2)
最終的に、以下のような設定で動作しているはずです (一部関係のない記述については省略)set system host-name host
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password "*****"
set system services ssh
set system services dhcp pool 192.168.200.0/24 address-range low 192.168.200.10
set system services dhcp pool 192.168.200.0/24 address-range high 192.168.200.99
set system services dhcp pool 192.168.200.0/24 router 192.168.200.1
set interfaces ge-0/0/0 unit 0 family inet address 10.0.200.10/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.200.1/24
set interfaces st0 unit 100 family inet
set routing-options static route 0.0.0.0/0 next-hop 10.0.200.1
set routing-options static route 192.168.100.0/24 next-hop st0.100
set security ike proposal ike-p1-prop authentication-method pre-shared-keys
set security ike proposal ike-p1-prop dh-group group1
set security ike proposal ike-p1-prop authentication-algorithm md5
set security ike proposal ike-p1-prop encryption-algorithm 3des-cbc
set security ike policy ike-policy mode main
set security ike policy ike-policy proposals ike-p1-prop
set security ike policy ike-policy pre-shared-key ascii-text IPsecVSRX
set security ike gateway ike-gw ike-policy ike-policy
set security ike gateway ike-gw address 10.0.100.10
set security ike gateway ike-gw external-interface ge-0/0/0.0
set security ipsec proposal ike-p2-prop protocol esp
set security ipsec proposal ike-p2-prop authentication-algorithm hmac-sha1-96
set security ipsec proposal ike-p2-prop encryption-algorithm aes-128-cbc
set security ipsec policy ipsec-policy perfect-forward-secrecy keys group1
set security ipsec policy ipsec-policy proposals ike-p2-prop
set security ipsec vpn ipsec-vpn bind-interface st0.100
set security ipsec vpn ipsec-vpn ike gateway ike-gw
set security ipsec vpn ipsec-vpn ike ipsec-policy ipsec-policy
102 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定(2/2)
set security nat source rule-set trust-to-untrust from zone trust
set security nat source rule-set trust-to-untrust to zone untrust
set security nat source rule-set trust-to-untrust rule trust-to-untrust-rule match source-address 0.0.0.0/0
set security nat source rule-set trust-to-untrust rule trust-to-untrust-rule then source-nat interface
set security policies from-zone trust to-zone trust policy default-permit match source-address any
set security policies from-zone trust to-zone trust policy default-permit match destination-address any
set security policies from-zone trust to-zone trust policy default-permit match application any
set security policies from-zone trust to-zone trust policy default-permit then permit
set security policies from-zone trust to-zone untrust policy default-permit match source-address any
set security policies from-zone trust to-zone untrust policy default-permit match destination-address any
set security policies from-zone trust to-zone untrust policy default-permit match application any
set security policies from-zone trust to-zone untrust policy default-permit then permit
set security policies from-zone untrust to-zone trust policy default-deny match source-address any
set security policies from-zone untrust to-zone trust policy default-deny match destination-address any
set security policies from-zone untrust to-zone trust policy default-deny match application any
set security policies from-zone untrust to-zone trust policy default-deny then deny
set security policies from-zone trust to-zone vpn policy permit-all match source-address any
set security policies from-zone trust to-zone vpn policy permit-all match destination-address any
set security policies from-zone trust to-zone vpn policy permit-all match application any
set security policies from-zone trust to-zone vpn policy permit-all then permit
set security policies from-zone vpn to-zone trust policy permit-all match source-address any
set security policies from-zone vpn to-zone trust policy permit-all match destination-address any
set security policies from-zone vpn to-zone trust policy permit-all match application any
set security policies from-zone vpn to-zone trust policy permit-all then permit
set security zones security-zone trust tcp-rst
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services ssh
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services dhcp
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ssh
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ike
set security zones security-zone vpn interfaces st0.100
103 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向機器の設定例
104 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向機器設定例
以下の機器を対向として使用する場合についてのサンプルコンフィグをご紹介します。
Juniper Networks vSRX
NEC UNIVERGE IX2000/3000
Cisco Systems 1812J
なお、これらの設定例についてはあくまで参考情報であり、接続性を保証するものではありません。
105 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向機器設定例(vSRX)set interfaces ge-0/0/0 unit 0 family inet address 10.0.100.10/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.100.1/24
set interfaces st0 unit 200 family inet
set routing-options static route 0.0.0.0/0 next-hop 10.0.100.1
set routing-options static route 192.168.200.0/24 next-hop st0.200
set security ike proposal ike-p1-prop authentication-method pre-shared-keys
set security ike proposal ike-p1-prop dh-group group1
set security ike proposal ike-p1-prop authentication-algorithm md5
set security ike proposal ike-p1-prop encryption-algorithm 3des-cbc
set security ike policy ike-policy mode main
set security ike policy ike-policy proposals ike-p1-prop
set security ike policy ike-policy pre-shared-key ascii-text IPsecVSRX
set security ike gateway ike-gw ike-policy ike-policy
set security ike gateway ike-gw address 10.0.200.10
set security ike gateway ike-gw external-interface ge-0/0/0.0
set security ipsec proposal ike-p2-prop protocol esp
set security ipsec proposal ike-p2-prop authentication-algorithm hmac-sha1-96
set security ipsec proposal ike-p2-prop encryption-algorithm aes-128-cbc
set security ipsec policy ipsec-policy perfect-forward-secrecy keys group1
set security ipsec policy ipsec-policy proposals ike-p2-prop
set security ipsec vpn ipsec-vpn bind-interface st0.200
set security ipsec vpn ipsec-vpn ike gateway ike-gw
set security ipsec vpn ipsec-vpn ike ipsec-policy ipsec-policy
set security nat source rule-set trust-to-untrust from zone trust
set security nat source rule-set trust-to-untrust to zone untrust
set security nat source rule-set trust-to-untrust rule trust-to-untrust-rule match source-address 0.0.0.0/0
set security nat source rule-set trust-to-untrust rule trust-to-untrust-rule then source-nat interface
set security policies from-zone trust to-zone trust policy default-permit match source-address any
set security policies from-zone trust to-zone trust policy default-permit match destination-address any
set security policies from-zone trust to-zone trust policy default-permit match application any
set security policies from-zone trust to-zone trust policy default-permit then permit
set security policies from-zone trust to-zone untrust policy default-permit match source-address any
set security policies from-zone trust to-zone untrust policy default-permit match destination-address any
set security policies from-zone trust to-zone untrust policy default-permit match application any
set security policies from-zone trust to-zone untrust policy default-permit then permit
set security policies from-zone trust to-zone vpn policy permit-all match source-address any
set security policies from-zone trust to-zone vpn policy permit-all match destination-address any
set security policies from-zone trust to-zone vpn policy permit-all match application any
set security policies from-zone trust to-zone vpn policy permit-all then permit
set security policies from-zone vpn to-zone trust policy permit-all match source-address any
set security policies from-zone vpn to-zone trust policy permit-all match destination-address any
set security policies from-zone vpn to-zone trust policy permit-all match application any
set security policies from-zone vpn to-zone trust policy permit-all then permit
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services ssh
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services dhcp
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ssh
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ike
set security zones security-zone vpn interfaces st0.200
106 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向機器設定例(NEC UNIVERGE IX2000/3000)hostname rt100
!
ip ufs-cache max-entries 60000
ip ufs-cache enable
ip route default 10.0.100.1
ip route 192.168.200.0/24 Tunnel100.0
ip access-list permit-all permit ip src any dest any
!
!
!
ike proposal ikeprop-to-200 encryption 3des hash md5
!
ike policy ikepolicy-to-200 peer 10.0.200.10 key IPsecVSRX ikeprop-to-200
!
ipsec autokey-proposal ipsecprop-to-200 esp-aes esp-sha
!
ipsec autokey-map policymap-to-200 permit-all peer 10.0.200.10 ipsecprop-to-200 pfs 768-bit
!
interface FastEthernet0/0.0
ip address 10.0.100.10/24
ip napt enable
no shutdown
!
interface FastEthernet0/1.0
ip address 192.168.100.1/24
no shutdown
!
interface FastEthernet1/0.0
no ip address
shutdown
!
interface Tunnel100.0
tunnel mode ipsec
ip unnumbered FastEthernet0/1.0
ipsec policy tunnel policymap-to-200 out
no shutdown
!
107 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向機器設定例(Cisco 1812J)hostname vpngw-100
!
crypto isakmp policy 200
encr 3des
hash md5
authentication pre-share
lifetime 28800
!
crypto isakmp key IPsecVSRX address 10.0.200.10
!
crypto ipsec transform-set IPsec200 esp-aes esp-sha-hmac
!
crypto ipsec profile VT200
set transform-set IPsec200
set pfs group1
!
interface Tunnel200
ip unnumbered FastEthernet1
tunnel source 10.0.100.10
tunnel mode ipsec ipv4
tunnel destination 10.0.200.10
tunnel protection ipsec profile VT200
!
interface FastEthernet0
ip address 10.0.100.10 255.255.255.0
ip nat outside
duplex auto
speed auto
!
interface FastEthernet1
ip address 192.168.100.1 255.255.255.0
ip nat inside
duplex auto
speed auto
!
ip nat inside source list PAT interface FastEthernet0 overload
ip route 0.0.0.0 0.0.0.0 10.0.100.1
ip route 192.168.200.0 255.255.255.0 Tunnel200
!
ip access-list standard PAT
permit 192.168.100.0 0.0.0.255
!
vSRX on your laptop
ユースケース : JUNOS Router <Static/Dynamic Routing>
Juniper Networks, K.K.
June 2015
109 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この章では以下の手順を紹介します。
ルータとして使用するための設定
Static Route設定
OSPF設定
BGP設定
110 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
想定環境
この資料は、以下のような環境を想定して作成されています。また、「vSRXのインストールと初期設定」を完了していることを前提としています。
ハードウェア
CPU: x86-64/AMD64を搭載したプロセッサ
RAM: 4GB以上
HDD: 空き容量10GB程度
NIC: 2つまたはそれ以上
ソフトウェア
OS: Windows 7
VMM: VMware Player 5.0
vSRX 12.1X47-D20
ネットワーク
対向となるOSPF/BGP機器が存在すること
– 必要に応じて複数のPC/vSRXなどを使用してください
111 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルータとして使用するための設定
112 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの動作モード
vSRX及び、vSRXのベースとなるBranch SRXシリーズでは、パケットの転送方法として以下の二方式が選択できます。
Flow-based forwarding(Default)
Packet-based forwarding
Firewallとして利用する際には、Flow-based forwardingモードを使用しますが、ルータとして使用する際にはPacket-based forwardingモードを使用します。
※Packet-based forwardingモードでは、ステートフルインスペクション等は行われませんので、ステートフルファイアウォール機能や、それに付随するNAT、IPSec、IDPなどのサービスは使用できなくなります。一方で、JUNOS RouterとしてIPv4/v6の各種ダイナミックルーティングプロトコルやMPLS-VPNなどの豊富なルーティング機能を使用していただくことが可能となります。
113 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
動作モードの変更
vSRXはデフォルトでFlow-based forwardingモードで動作しますが、以下の設定コマンドを入力することにより、Packet-basedforwardingモードに移行することができます。
[edit]
root@host# delete security
root@host# set security forwarding-options family mpls mode
packet-based
root@host# set security forwarding-options family inet6 mode
packet-based ←IPv6を使う場合root@host# commit
warning: You have changed mpls flow mode.
You have to reboot the system for your change to take effect.
If you have deployed a cluster, be sure to reboot all nodes.
commit complete
※IPv6ルーティングやMPLSを実際には使用しない場合でも、Packet-based forwardingモードで動作させるためには、上記mode packet-basedのコマンドを入力します。
114 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
再起動
Flow-based forwardingモードからPacket-based forwardingへ移行するためには、vSRXの再起動が必要です。以下のコマンドで再起動します。
[edit]
root@host# exit
Exiting configuration mode
root@host> request system reboot
Reboot the system ? [yes,no] (no) yes
115 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
動作モードの確認
再起動が完了すると、vSRXはPacket-based forwardingモードで動作しているはずです。vSRXがどのモードで動作しているかは、以下のコマンドで確認できます。
root@host> show security flow status
Flow forwarding mode:
Inet forwarding mode: packet based
Inet6 forwarding mode: packet based
MPLS forwarding mode: packet based
ISO forwarding mode: drop
Flow trace status
Flow tracing status: off
Flow session distribution
Distribution mode: RR-based
Flow ipsec performance acceleration: off
Flow packet ordering
Ordering mode: Hardware
116 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
STATIC ROUTEの設定
117 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Static Route
スタティックルートを設定してみましょう。
今回は以下のような構成のネットワークを想定しています。対向Routerの設定はすでに完了しているものとします。(対向デバイスは後のページにSRXでのサンプルConfigを掲載しています。)
Router
vSRX
Client 2Client 1 .1
.10
Internet
.2
.1.1.10
192.168.2.0/24192.168.1.0/24192.168.0.0/24
118 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Interfaceの設定
インターフェースのIPアドレスを以下のように設定します。
ge-0/0/0.0: 192.168.1.2/24
ge-0/0/1.0: 192.168.2.1/24
[edit]
root@host# delete interfaces
root@host# set interfaces ge-0/0/0 unit 0 family inet address
192.168.1.2/24
root@host# set interfaces ge-0/0/1 unit 0 family inet address
192.168.2.1/24
root@host# commit
119 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Static Routeの設定
今回の構成では、すべての通信を上位のルータにルーティングすれば、インターネット及び上位ルータの持つセグメントにアクセスできますので、デフォルトルートとして上位ルータを設定します。
以下のコマンドを入力して、デフォルトルートを設定してみましょう。
[edit]
root@host# set routing-options static route 0/0 next-hop
192.168.1.1
root@host# commit
120 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルーティングテーブルの確認
ルーティングテーブルを確認して、先程追加したデフォルトルートがルーティングテーブルに正常に登録されているか確認してみましょう。
ルーティングテーブルは以下のようにして確認することができます。
root@host> show route
inet.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 00:00:04
> to 192.168.1.1 via ge-0/0/0.0
192.168.1.0/24 *[Direct/0] 00:03:00
> via ge-0/0/0.0
192.168.1.2/32 *[Local/0] 00:03:00
Local via ge-0/0/0.0
192.168.2.0/24 *[Direct/0] 00:00:04
> via ge-0/0/1.0
192.168.2.1/32 *[Local/0] 00:00:04
Local via ge-0/0/1.0
正しくデフォルトルートが設定されていることがわかります。
121 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定
最終的に、以下のような設定で動作しているはずです。(一部関係のない記述については省略)
set system host-name host
set system time-zone Asia/Tokyo
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password
"***"
set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.2/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.2.1/24
set routing-options static route 0.0.0.0/0 next-hop 192.168.1.1
set security forwarding-options family mpls mode packet-based
122 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向ルータ設定
set system host-name Router
set system time-zone Asia/Tokyo
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password
"***"
set interfaces fe-0/0/0 unit 0 family inet address 10.0.0.10/24
set interfaces fe-0/0/1 unit 0 family inet address 192.168.0.1/24
set interfaces fe-0/0/2 unit 0 family inet address 192.168.1.1/24
set routing-options static route 0.0.0.0/0 next-hop 10.0.0.1
set routing-options static route 192.168.2.0/24 next-hop
192.168.1.2
set security forwarding-options family mpls mode packet-based
123 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
OSPFの設定
124 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
OSPF
OSPFを用いた簡単なネットワークを構築してみましょう。
今回は以下のような構成のネットワークを想定しています。なお、対向Routerの設定はすでに完了しているものとします。(対向デバイスは後のページにSRXでのサンプルConfigを掲載しています。)
Router(ASBR)1.1.1.1
vSRX2.2.2.2
Client 2Client 1
Internet
192.168.2.0/24
.1
.10
192.168.1.0/24192.168.0.0/24
.2
.1.1.10
125 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Interfaceの設定
インターフェースのIPアドレスを以下のように設定します。
ge-0/0/0.0: 192.168.1.2/24
ge-0/0/1.0: 192.168.2.1/24
[edit]
root@host# delete interfaces
root@host# delete routing-options
root@host# set interfaces ge-0/0/0 unit 0 family inet address
192.168.1.2/24
root@host# set interfaces ge-0/0/1 unit 0 family inet address
192.168.2.1/24
root@host# commit
また、Router IDとして使用するIPアドレスをlo0.0に設定します。
[edit]
root@host# set interfaces lo0 unit 0 family inet address
2.2.2.2/32
root@host# commit
126 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
OSPFインスタンスの設定
OSPFインスタンスを設定します。
まず、Router IDを設定します。
[edit]
root@host# set routing-options router-id 2.2.2.2
次に、OSPFを動かすインターフェースを以下のように設定します。
Area0
ge-0/0/0.0
ge-0/0/1.0 (passive)
[edit]
root@host# set protocol ospf area 0 interface ge-0/0/0.0
root@host# set protocol ospf area 0 interface ge-0/0/1.0 passive
root@host# commit
127 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
OSPF NeighborとDatabaseの確認
OSPFの設定ができたので、対向のRouterとAdjacencyが確立できているか確認しましょう。確認は以下のコマンドで行えます。
root@host> show ospf neighbor
Address Interface State ID Pri Dead
192.168.1.1 ge-0/0/0.0 Full 1.1.1.1 128 37
また、OSPF Databaseは以下のコマンドで確認することができます。
root@host> show ospf database
OSPF database, Area 0.0.0.0
Type ID Adv Rtr Seq Age Opt Cksum Len
Router 1.1.1.1 1.1.1.1 0x80000002 420 0x22 0x3fc9 48
Router *2.2.2.2 2.2.2.2 0x80000003 424 0x22 0x3aca 48
Network 192.168.1.2 2.2.2.2 0x80000001 424 0x22 0x8ffc 32
OSPF AS SCOPE link state database
Type ID Adv Rtr Seq Age Opt Cksum Len
Extern 0.0.0.0 1.1.1.1 0x80000001 418 0x22 0xee59 36
正しくAdjacencyが確立でき、OSPF Databaseの交換が行われていることがわかります。
128 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルーティングテーブルの確認
それでは、ルーティングテーブルを確認してみましょう。ルーティングテーブルは以下のコマンドで表示することができます。
root@host> show routeinet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[OSPF/150] 00:09:02, metric 0, tag 0> to 192.168.1.1 via ge-0/0/0.0
192.168.0.0/24 *[OSPF/10] 00:09:02, metric 2> to 192.168.1.1 via ge-0/0/0.0
192.168.1.0/24 *[Direct/0] 00:09:18> via ge-0/0/0.0
192.168.1.2/32 *[Local/0] 00:09:18Local via ge-0/0/0.0
192.168.2.0/24 *[Direct/0] 00:09:18> via ge-0/0/1.0
192.168.2.1/32 *[Local/0] 00:09:18Local via ge-0/0/1.0
224.0.0.5/32 *[OSPF/10] 00:10:49, metric 1MultiRecv
OSPFから受け取ったデフォルトルートと192.168.0.0/24宛の経路が、ルーティングテーブルに反映されていることがわかります。
129 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定
最終的に、以下のような設定で動作しているはずです。(一部関係のない記述については省略)set system host-name host
set system time-zone Asia/Tokyo
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password "***"
set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.2/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.2.1/24
set interfaces lo0 unit 0 family inet address 2.2.2.2/32
set routing-options router-id 2.2.2.2
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 passive
set security forwarding-options family mpls mode packet-based
130 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向ルータ設定
set system host-name Router
set system time-zone Asia/Tokyo
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password "***"
set interfaces fe-0/0/0 unit 0 family inet address 10.0.0.10/24
set interfaces fe-0/0/1 unit 0 family inet address 192.168.0.1/24
set interfaces fe-0/0/2 unit 0 family inet address 192.168.1.1/24
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
set routing-options router-id 1.1.1.1
set protocols ospf export export-ospf
set routing-options static route 0.0.0.0/0 next-hop 10.0.0.1
set protocols ospf area 0.0.0.0 interface fe-0/0/1.0 passive
set protocols ospf area 0.0.0.0 interface fe-0/0/2.0
set policy-options policy-statement export-ospf term 1 from route-filter
0.0.0.0/0 exact
set policy-options policy-statement export-ospf term 1 then accept
set policy-options policy-statement export-ospf term 2 then reject
set security forwarding-options family mpls mode packet-based
131 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
BGPの設定
132 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
BGP
BGPのピアを張り、経路を交換してみましょう。
今回は以下のような構成のネットワークを想定しています。なお、Routerの設定はすでに完了しているものとします。(対向デバイスは後のページにSRXでのサンプルConfigを掲載しています。)
Router(AS65001)
vSRX(AS65002)
Client
Internet
192.168.2.0/24
.1
.10
192.168.1.0/24
.2
.1
133 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Interfaceの設定
インターフェースのIPアドレスを以下のように設定します。
ge-0/0/0.0: 192.168.1.2/24
ge-0/0/1.0: 192.168.2.1/24
[edit]
root@host# delete interfaces
root@host# delete routing-options
root@host# delete protocols
root@host# set interfaces ge-0/0/0 unit 0 family inet address
192.168.1.2/24
root@host# set interfaces ge-0/0/1 unit 0 family inet address
192.168.2.1/24
root@host# commit
134 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
BGPの設定
BGPを設定します。
まず、以下のようにして自ルータのAS番号を設定します。
[edit]
root@host# set routing-options autonomous-system 65002
次に、対向ピアを設定し、Commitします。
[edit]
root@host# set protocols bgp group external-peers neighbor
192.168.1.1 peer-as 65001
root@host# commit
これを繰り返すことで、複数のピアを設定することが可能です。(groupは必要に応じて複数作成可能です)
135 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
BGP Neighborの確認
BGPのピアが正常に確立しているか確認してみましょう。
以下のコマンドでBGPピアの一覧をすることができます。
root@host> show bgp summary
Groups: 1 Peers: 1 Down peers: 0
Table Tot Paths Act Paths Suppressed History Damp State
Pending
inet.0 1 1 0 0 0
0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn
State|#Active/Received/Accepted/Damped...
192.168.1.1 65001 29 29 0 0 11:27 1/1/1/0
0/0/0/0
192.168.1.1(AS65001)とピアが確立できていることがわかります。
136 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Export policyの作成と適用
デフォルト状態のJUNOSでは、BGPピアに対して広告する経路は、他のBGPピアから受信した経路情報によるもののみです。したがって現時点では、BGPピアに対して自分が持っている経路を広告していません。
自分が持っている経路を広告するためには、Export policyを作成し、BGPピアグループに適用する必要があります。
192.168.2.0/24の経路をBGPピアグループexternal-peersのピアに対して広告する場合、以下のような設定を行います。
[edit]
root@host# set policy-options policy-statement export-bgp term 1
from route-filter 192.168.2.0/24 exact
root@host# set policy-options policy-statement export-bgp term 1
then accept
root@host# set protocols bgp group external-peers export export-
bgp
root@host# commit
137 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
広告/受信している経路の確認
Export policyを設定したため、対向ASに対して192.168.2.0/24の経路が広告されているはずです。以下のコマンドを使用して、現在自分があるピアに対して広告している経路を調べることができます。
root@host> show route advertising-protocol bgp 192.168.1.1
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
* 192.168.2.0/24 Self I
また、以下のコマンドを使用して、対向ASから受信している経路を調べることができます。
root@host> show route receive-protocol bgp 192.168.1.1
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
* 0.0.0.0/0 192.168.1.1 65001 I
これらの例では、192.168.2.0/24を広告し、0.0.0.0/0を受信していることがわかります。
138 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定
最終的に、以下のような設定で動作しているはずです。(一部関係のない記述については省略)set system host-name host
set system time-zone Asia/Tokyo
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password "***"
set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.2/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.2.1/24
set routing-options autonomous-system 65002
set protocols bgp group external-peers export export-bgp
set protocols bgp group external-peers neighbor 192.168.1.1 peer-as 65001
set policy-options policy-statement export-bgp term 1 from route-filter
192.168.2.0/24 exact
set policy-options policy-statement export-bgp term 1 then accept
set security forwarding-options family mpls mode packet-based
139 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向ルータ設定
set system host-name Router
set system time-zone Asia/Tokyo
set system root-authentication encrypted-password "***"
set system login user user uid 2000
set system login user user class super-user
set system login user user authentication encrypted-password "***"
set interfaces fe-0/0/0 unit 0 family inet address 10.0.0.10/24
set interfaces fe-0/0/1 unit 0 family inet address 192.168.0.1/24
set interfaces fe-0/0/2 unit 0 family inet address 192.168.1.1/24
set routing-options autonomous-system 65001
set routing-options static route 0.0.0.0/0 next-hop 10.0.0.1
set protocols bgp group external-peers export export-bgp
set protocols bgp group external-peers neighbor 192.168.1.2 peer-as 65002
set policy-options policy-statement export-bgp term 1 from route-filter
0.0.0.0/0 exact
set policy-options policy-statement export-bgp term 1 then accept
set security forwarding-options family mpls mode packet-based
140 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Flow-based forwardingへの変更(※参考)
Packet-based forwardingから再度Flow-based forwardingモードへ切り戻すには、以下の手順を実行します。なお、Flow-based forwardingモードに切り戻した場合、別途セキュリティゾーンの設定を行わない限り、すべての通信は遮断されます。(詳しくはユースケース: Firewall をご参照ください。)
設定の切り戻し
[edit]root@host# delete security forwarding-optionsroot@host# commitwarning: You have changed mpls flow mode.You have to reboot the system for your change to take effect.If you have deployed a cluster, be sure to reboot all nodes.commit complete
root@host# exitExiting configuration mode
再起動
root@host> request system rebootReboot the system ? [yes,no] (no) yes
vSRX on your laptop
ユースケース : JUNOS Router <MPLS/VPLS>
Juniper Networks, K.K.
June 2015
142 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
AGENDA
この資料では以下の手順を紹介します。
ルータとして使用するための設定
MPLSの設定
VPLSの設定
143 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
想定環境
この資料は、以下のような環境を想定して作成されています。また、「vSRXのインストールと初期設定」を完了していることを前提としています。
ハードウェア
CPU: x86-64/AMD64を搭載したプロセッサ
RAM: 4GB以上
HDD: 空き容量10GB程度
NIC: 2つまたはそれ以上
ソフトウェア
OS: Windows 7
VMM: VMware Player 5.0
vSRX 12.1X47-D20
ネットワーク
対向となるMPLS/VPLS機器が存在すること
– 必要に応じて複数のPC/vSRXなどを使用してください
144 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルータとして使用するための設定
145 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの動作モード
vSRX及び、vSRXのベースとなるBranch SRXシリーズでは、パケットの転送方法として以下の二方式が選択できます。
Flow-based forwarding(Default)
Packet-based forwarding
Firewallとして利用する際には、Flow-based forwardingモードを使用しますが、ルータとして使用する際にはPacket-based forwardingモードを使用します。
※Packet-based forwardingモードでは、ステートフルインスペクション等は行われませんので、ステートフルファイアウォール機能や、それに付随するNAT、IPSec、IDPなどのサービスは使用できなくなります。一方で、JUNOS RouterとしてIPv4/v6の各種ダイナミックルーティングプロトコルやMPLS-VPNなどの豊富なルーティング機能を使用していただくことが可能となります。
146 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
動作モードの変更
vSRXはデフォルトでFlow-based forwardingモードで動作しますが、以下の設定コマンドを入力することにより、Packet-basedforwardingモードに移行することができます。
[edit]
root@host# delete security
root@host# set security forwarding-options family mpls mode
packet-based
root@host# set security forwarding-options family inet6 mode
packet-based ←IPv6を使う場合root@host# commit
warning: You have changed mpls flow mode.
You have to reboot the system for your change to take effect.
If you have deployed a cluster, be sure to reboot all nodes.
commit complete
※IPv6ルーティングやMPLSを実際には使用しない場合でも、Packet-based forwardingモードで動作させるためには、上記mode packet-basedのコマンドを入力します。
147 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
再起動
Flow-based forwardingモードからPacket-based forwardingへ移行するためには、vSRXの再起動が必要です。以下のコマンドで再起動します。
[edit]
root@host# exit
Exiting configuration mode
root@host> request system reboot
Reboot the system ? [yes,no] (no) yes
148 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
動作モードの確認
再起動が完了すると、vSRXはPacket-based forwardingモードで動作しているはずです。vSRXがどのモードで動作しているかは、以下のコマンドで確認できます。
root@host> show security flow status
Flow forwarding mode:
Inet forwarding mode: packet based
Inet6 forwarding mode: packet based
MPLS forwarding mode: packet based
ISO forwarding mode: drop
Flow trace status
Flow tracing status: off
Flow session distribution
Distribution mode: RR-based
Flow ipsec performance acceleration: off
Flow packet ordering
Ordering mode: Hardware
149 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
MPLSの設定
150 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
MPLSの設定
MPLSネットワークを構成しましょう。
今回は以下のような構成のネットワークを想定しています。対向Routerの設定はすでに完了しているものとします。(対向デバイスは後のページにSRXでのサンプルConfigを掲載しています。)
Router1(LER)Client 1192.168.1.0/24
192.168.0.0/24
.1.1
Router2(LSR)
vSRX(LER)
.1 Client 2
192.168.0.0/24
.10
.10
.1 192.168.10.0/24
192.168.20.0/24 .10
.10
151 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
InterfaceとOSPFの設定
インターフェースのIPアドレスを以下のように設定します。
ge-0/0/0.0: 192.168.1.1/24
lo0.0: 1.1.1.1/32
[edit]
root@host# delete interfaces
root@host# set interfaces ge-0/0/0 unit 0 family inet address
192.168.1.1/24
root@host# set interfaces lo0 unit 0 family inet address 1.1.1.1/32
root@host# commit
作成したインターフェイスにてOSPFの設定を行います。
[edit]
root@host# set routing-options router-id 1.1.1.1
root@host# set protocol ospf area 0 interface ge-0/0/0.0
root@host# set protocol ospf area 0 interface lo0.0
root@host# commit
152 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
MPLSとRSVPの設定
インターフェイスにMPLSプロトコルの設定を行います。
[edit]
root@host# set protocols mpls interface all
root@host# set protocols mpls no-cspf
root@host# set interfaces ge-0/0/0 unit 0 family mpls
root@host# commit
ラベルシグナリングの設定を行います。このサンプルではシグナリングプロトコルにRSVPを使用するため、RSVPを動かすインターフェイスを設定します。
[edit]
root@host# set protocols rsvp interface ge-0/0/0.0
root@host# set protocols rsvp interface lo0.0
root@host# commit
153 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ラベルスイッチパス(LSP)の設定
このサンプルでは以下の様な2つのPathを設定し、LSPの経路冗長を構成します。
Router1(LER)3.3.3.3 192.168.1.0/24
.1
Router2(LSR)2.2.2.2
vSRX(LER)1.1.1.1
.1
.1 192.168.10.0/24
192.168.20.0/24
GREEN (Primary Path)
Orange (Secondary Path)
154 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ラベルスイッチパス(LSP)の設定
以下のようにして、LSPの設定を行います。
[edit]
root@host# set protocols mpls label-switched-path LSP1to3 to
3.3.3.3
root@host# set protocols mpls label-switched-path LSP1to3 primary
GREEN
root@host# set protocols mpls label-switched-path LSP1to3
secondary ORANGE standby
root@host# set protocols mpls path GREEN 2.2.2.2 loose
root@host# set protocols mpls path GREEN 192.168.10.1 strict
root@host# set protocols mpls path ORANGE 2.2.2.2 loose
root@host# set protocols mpls path ORANGE 192.168.20.1 strict
root@host# commit
155 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ラベルスイッチパス(LSP)の確認
以下のコマンドで、LSPが作成されたことを確認しましょう。
root@host# run show mpls lsp
Ingress LSP: 1 sessions
To From State Rt P ActivePath LSPname
3.3.3.3 1.1.1.1 Up 0 * GREEN LSP1to3
Total 1 displayed, Up 1, Down 0
Egress LSP: 2 sessions
To From State Rt Style Labelin Labelout LSPname
1.1.1.1 3.3.3.3 Up 0 1 FF 3 - LSP3to1
1.1.1.1 3.3.3.3 Up 0 1 FF 3 - LSP3to1
Total 2 displayed, Up 2, Down 0
Transit LSP: 0 sessions
Total 0 displayed, Up 0, Down 0
156 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Config (vSRX LER)
最終的に、以下のような設定で動作しているはずです。(一部関係のない記述については省略)set system host-name host
set system root-authentication encrypted-password "***"
set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.1/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
set routing-options router-id 1.1.1.1
set protocols rsvp interface ge-0/0/0.0
set protocols rsvp interface lo0.0
set protocols mpls no-cspf
set protocols mpls label-switched-path LSP1to3 to 3.3.3.3
set protocols mpls label-switched-path LSP1to3 primary GREEN
set protocols mpls label-switched-path LSP1to3 secondary ORANGE standby
set protocols mpls path GREEN 2.2.2.2 loose
set protocols mpls path GREEN 192.168.10.1 strict
set protocols mpls path ORANGE 2.2.2.2 loose
set protocols mpls path ORANGE 192.168.20.1 strict
set protocols mpls interface all
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0
set security forwarding-options family mpls mode packet-based
157 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
R2 Config (SRX LSR)
set system host-name Router2-LSR
set system root-authentication encrypted-password "***"
set interfaces fe-0/0/0 unit 0 family inet address 192.168.10.10/24
set interfaces fe-0/0/0 unit 0 family mpls
set interfaces fe-0/0/1 unit 0 family inet address 192.168.20.10/24
set interfaces fe-0/0/1 unit 0 family mpls
set interfaces fe-0/0/2 unit 0 family inet address 192.168.1.10/24
set interfaces fe-0/0/2 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 2.2.2.2/32
set routing-options router-id 2.2.2.2
set protocols rsvp interface fe-0/0/0.0
set protocols rsvp interface fe-0/0/1.0
set protocols rsvp interface fe-0/0/2.0
set protocols rsvp interface lo0.0
set protocols mpls no-cspf
set protocols mpls interface all
set protocols ospf area 0.0.0.0 interface fe-0/0/0.0
set protocols ospf area 0.0.0.0 interface fe-0/0/1.0
set protocols ospf area 0.0.0.0 interface fe-0/0/2.0
set protocols ospf area 0.0.0.0 interface lo0.0
set security forwarding-options family mpls mode packet-based
158 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
R1 Config (SRX LER)
set system host-name Router1-LER
set system root-authentication encrypted-password "***"
set interfaces fe-0/0/0 unit 0 family inet address 192.168.10.1/24
set interfaces fe-0/0/0 unit 0 family mpls
set interfaces fe-0/0/1 unit 0 family inet address 192.168.20.1/24
set interfaces fe-0/0/1 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 3.3.3.3/32
set routing-options router-id 3.3.3.3
set protocols rsvp interface fe-0/0/0.0
set protocols rsvp interface fe-0/0/1.0
set protocols rsvp interface lo0.0
set protocols mpls no-cspf
set protocols mpls label-switched-path LSP3to1 to 1.1.1.1
set protocols mpls label-switched-path LSP3to1 primary GREEN
set protocols mpls label-switched-path LSP3to1 secondary ORANGE standby
set protocols mpls path GREEN 192.168.10.10 strict
set protocols mpls path GREEN 192.168.1.1 loose
set protocols mpls path ORANGE 192.168.20.10 strict
set protocols mpls path ORANGE 192.168.1.1 loose
set protocols mpls interface all
set protocols ospf area 0.0.0.0 interface fe-0/0/0.0
set protocols ospf area 0.0.0.0 interface fe-0/0/1.0
set protocols ospf area 0.0.0.0 interface lo0.0
set security forwarding-options family mpls mode packet-based
159 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VPLSの設定
160 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VPLSの設定
VPLSを用いたL2VPNネットワークを構築してみましょう。
Client1とClient2がルーティングネットワークを越えて、同一サブネット上でLayer2通信を行えるようになれば完成です。
Router1(LER)Client 1192.168.1.0/24
192.168.0.1/24
.1
Router2(LSR)
vSRX(LER)
.1 Client 2
.10
.1 192.168.10.0/24
192.168.20.0/24 .10
.10
192.168.0.10/24
オーバーレイ・L2スイッチング
161 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VPLSの設定
VPLSシグナリングの設定を行います。このサンプルではプロトコルにLDPを使用するため、LDPを動かすインターフェイスを設定します。
[edit]
root@host# set protocols ldp interface ge-0/0/0.0
root@host# set protocols ldp interface lo0.0
root@host# commit
VPLSを構成するルーティングインスタンスの設定を行います。
[edit]
root@host# set routing-instances VPLS1 instance-type vpls
root@host# set routing-instances VPLS1 interface ge-0/0/1.0
root@host# set routing-instances VPLS1 protocols vpls no-tunnel-
services
root@host# set routing-instances VPLS1 protocols vpls vpls-id 1
root@host# set routing-instances VPLS1 protocols vpls neighbor
3.3.3.3
root@host# commit
162 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VPLSの設定
VPLSインターフェイスの設定を行います。
[edit]
root@host# set interfaces ge-0/0/1 encapsulation ethernet-vpls
root@host# set interfaces ge-0/0/1 unit 0 family vpls
root@host# commit
163 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
MPLS/VPLSの確認
それでは、VPLSコネクションの状態を確認してみましょう。VPLSの状態は以下のコマンドで表示することができます。
root@host# run show vpls connections
Layer-2 VPN connections:
…(中略)…
Instance: VPLS1
VPLS-id: 1
Neighbor Type St Time last up # Up trans
3.3.3.3(vpls-id 1) rmt Up Jan 14 17:03:25 2015 1
Remote PE: 3.3.3.3, Negotiated control-word: No
Incoming label: 262145, Outgoing label: 262145
Negotiated PW status TLV: No
Local interface: lsi.1048576, Status: Up, Encapsulation:
ETHERNET
Description: Intf - vpls VPLS1 neighbor 3.3.3.3 vpls-id 1
164 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
MPLS/VPLSの確認
Connectionの状態がUpになっていれば、同一サブネットのアドレスを設定したClient1とClient2がで通信を行うことができるようになっているはずなので、Pingなどで確認してみてください。(Pingの疎通が正しく行われるには対向ルーターのMPLS/VPLSの設定も正しく行われている必要があります。)
Primary PathであるGREENのラインをダウンさせた際にも、高速にSecondary PathであるORANGEへの迂回が実行され、End to Endの通信が保護されることを確認しましょう。
Router1(LER)Client 1
192.168.0.1/24
Router2(LSR)
vSRX(LER)
Client 2
192.168.0.10/24
オーバーレイ・L2スイッチング
165 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Config (vSRX LER)
最終的に、以下のような設定で動作しているはずです。(一部関係のない記述については省略)set system host-name host
set system root-authentication encrypted-password "***"
set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.1/24
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/1 encapsulation ethernet-vpls
set interfaces ge-0/0/1 unit 0 family vpls
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
set routing-options router-id 1.1.1.1
set protocols rsvp interface ge-0/0/0.0
set protocols rsvp interface lo0.0
set protocols mpls no-cspf
set protocols mpls label-switched-path LSP1to3 to 3.3.3.3
set protocols mpls label-switched-path LSP1to3 primary GREEN
set protocols mpls label-switched-path LSP1to3 secondary ORANGE standby
set protocols mpls path GREEN 2.2.2.2 loose
set protocols mpls path GREEN 192.168.10.1 strict
set protocols mpls path ORANGE 2.2.2.2 loose
set protocols mpls path ORANGE 192.168.20.1 strict
set protocols mpls interface all
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0
set protocols ldp interface ge-0/0/0.0
set protocols ldp interface lo0.0
set security forwarding-options family mpls mode packet-based
set routing-instances VPLS1 instance-type vpls
set routing-instances VPLS1 interface ge-0/0/1.0
set routing-instances VPLS1 protocols vpls no-tunnel-services
set routing-instances VPLS1 protocols vpls vpls-id 1
set routing-instances VPLS1 protocols vpls neighbor 3.3.3.3
166 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
R2 Config (SRX LSR)
set system host-name Router2-LSR
set system root-authentication encrypted-password "***"
set interfaces fe-0/0/0 unit 0 family inet address 192.168.10.10/24
set interfaces fe-0/0/0 unit 0 family mpls
set interfaces fe-0/0/1 unit 0 family inet address 192.168.20.10/24
set interfaces fe-0/0/1 unit 0 family mpls
set interfaces fe-0/0/2 unit 0 family inet address 192.168.1.10/24
set interfaces fe-0/0/2 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 2.2.2.2/32
set routing-options router-id 2.2.2.2
set protocols rsvp interface fe-0/0/0.0
set protocols rsvp interface fe-0/0/1.0
set protocols rsvp interface fe-0/0/2.0
set protocols rsvp interface lo0.0
set protocols mpls no-cspf
set protocols mpls interface all
set protocols ospf area 0.0.0.0 interface fe-0/0/0.0
set protocols ospf area 0.0.0.0 interface fe-0/0/1.0
set protocols ospf area 0.0.0.0 interface fe-0/0/2.0
set protocols ospf area 0.0.0.0 interface lo0.0
set protocols ldp interface fe-0/0/0.0
set protocols ldp interface fe-0/0/1.0
set protocols ldp interface fe-0/0/2.0
set protocols ldp interface lo0.0
set security forwarding-options family mpls mode packet-based
167 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
R1 Config (SRX LER)set system host-name Router1-LER
set system root-authentication encrypted-password "***"
set interfaces fe-0/0/0 unit 0 family inet address 192.168.10.1/24
set interfaces fe-0/0/0 unit 0 family mpls
set interfaces fe-0/0/1 unit 0 family inet address 192.168.20.1/24
set interfaces fe-0/0/1 unit 0 family mpls
set interfaces fe-0/0/2 encapsulation ethernet-vpls
set interfaces fe-0/0/2 unit 0 family vpls
set interfaces lo0 unit 0 family inet address 3.3.3.3/32
set routing-options router-id 3.3.3.3
set protocols rsvp interface fe-0/0/0.0
set protocols rsvp interface fe-0/0/1.0
set protocols rsvp interface lo0.0
set protocols mpls no-cspf
set protocols mpls label-switched-path LSP3to1 to 1.1.1.1
set protocols mpls label-switched-path LSP3to1 primary GREEN
set protocols mpls label-switched-path LSP3to1 secondary ORANGE standby
set protocols mpls path ORANGE 192.168.20.10 strict
set protocols mpls path ORANGE 192.168.1.1 loose
set protocols mpls path GREEN 192.168.10.10 strict
set protocols mpls path GREEN 192.168.1.1 loose
set protocols mpls interface all
set protocols ospf area 0.0.0.0 interface fe-0/0/0.0
set protocols ospf area 0.0.0.0 interface fe-0/0/1.0
set protocols ospf area 0.0.0.0 interface lo0.0
set protocols ldp interface fe-0/0/0.0
set protocols ldp interface fe-0/0/1.0
set protocols ldp interface lo0.0
set security forwarding-options family mpls mode packet-based
set routing-instances VPLS1 instance-type vpls
set routing-instances VPLS1 interface fe-0/0/2.0
set routing-instances VPLS1 protocols vpls no-tunnel-services
set routing-instances VPLS1 protocols vpls vpls-id 1
set routing-instances VPLS1 protocols vpls neighbor 1.1.1.1
168 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Flow-based forwardingへの変更(※参考)
Packet-based forwardingから再度Flow-based forwardingモードへ切り戻すには、以下の手順を実行します。なお、Flow-based forwardingモードに切り戻した場合、別途セキュリティゾーンの設定を行わない限り、すべての通信は遮断されます。(詳しくはユースケース: Firewall をご参照ください。)
設定の切り戻し
[edit]root@host# delete security forwarding-optionsroot@host# commitwarning: You have changed mpls flow mode.You have to reboot the system for your change to take effect.If you have deployed a cluster, be sure to reboot all nodes.commit complete
root@host# exitExiting configuration mode
再起動
root@host> request system rebootReboot the system ? [yes,no] (no) yes
vSRX on your laptop
ユースケース : JUNOS Automation <Event Policy編>
Juniper Networks, K.K.
June 2015
170 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この資料では以の項目について紹介します。
JUNOScriptとEvent Policyの概要
Event Policyのユースケースと設定例
171 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
想定環境
この資料は、以下のような環境を想定して作成されています。また、「vSRXのインストールと初期設定」を完了していることを前提としています。
ハードウェア
CPU: x86-64/AMD64を搭載したプロセッサ
RAM: 4GB以上
HDD: 空き容量10GB程度
NIC: 2つまたはそれ以上
ソフトウェア
OS: Windows 7
VMM: VMware Player 5.0
vSRX 12.1X47-D20
ネットワーク
ユースケース毎のトポロジーに準拠する
172 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
JUNOSCRIPTとは
173 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
JUNOScriptの概要
JUNOScript とはJuniperのネットワーク装置上で動作させることができるスクリプティング機能です。JUNOS自体に手を加える必要がないため、 JUNOSの安定性を損なうことなく、ユーザ個別の自動化に対する要望に対し柔軟かつ速やかに対応することができます。大別すると、運用者が起動するスクリプトである"Commit Script"、"Op Script"とシステムが起動するスクリプトである"Event Policy"、"Event Script"が存在します。
システムが起動するスクリプト(ルーティングなどのイベント)
運用者が起動するスクリプト(CLIやProvisioning System)
Commit ScriptCommit時に起動するスクリプト
Event Policyシステムのイベントにより起動されるポリシー
Event ScriptEvent Policyにより起動されるスクリプト
Op Script運用者が起動するスクリプト
XSLT / SLAXベースのスクリプト
174 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Commit Script
Commit Scriptはネットワーク装置へ設定を反映する段階(Commit)において、ユーザ独自のポリシーを適用することを可能にします。
Commit Scriptはキャンディデートコンフィグを入力とする(commitと同時に処理を開始)
ユーザ独自ポリシーによる設定チェック
•Error / Warningメッセージの生成とCommit の中止(Self-defense)
•自動修正(Self-heal)
ユーザ独自Syntaxによる設定の簡素化
•マクロによる設定の自動生成(Self-define)
CANDIDATEConfiguration
Actions
FINALConfiguration
Script Engine
CommitScripts
Commit Script はキャンディデートコンフィグに変更を加えることが可能
175 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Op Script
Op ScriptはCLIから起動するスクリプトで、オペレーションモードCLIを拡張してユーザ独自のコマンドを作成可能とします。
ユーザ独自のコマンドによりルータの状態を診断(Self-diagnostics)
優秀なエンジニアの知識を運用に反映させることができる
トラブルシューティングに必要な一連の情報を取得
– 複数showコマンドの実施
– 必要な出力のみ抽出
script 実行の結果として、自動的にアクションを実行可能
– コンフィグ変更
CLI実行 Output XML:表示する情報の指示
OpScript(s)
176 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Event Policy/Script
ネットワーク機器上のイベントやタイマーをトリガーとして、コマンドやスクリプトを実行することで、運用の自動化が可能となります。
• イベントをトリガーとしたアクションを実行(Self-monitor)
• ルータ上の特定のイベントをトリガーとして、コマンドやスクリプトを実行
• タイマーをトリガーとしたアクションの実行
• インターバル設定や日時指定に応じて、コマンドやスクリプトを実行
Routing(rpd)
Chassis(chassisd)
Management(mgd)
イベント監視プロセス
eventd
ifthenrules
ルータの各コンポーネントのイベントを監視
ユーザが設定したアクションに応じて運用コマンド、設定変更、ス
クリプトなどを実行
177 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
この資料では
この資料では、最も容易に実行可能なEvent Policyの動作概要、設定方法と使用事例についてご紹介いたします。
178 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
EVENT POLICYの概要
179 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Event Policyの設定例
Event Policyは[edit event-options]の階層で設定を行います。
[edit event-options]
user@R1# show
policy vrrpd {
events vrrpd_new_master;
then {
execute-commands {
commands {
"show vrrp detail";
}
output-filename vrrp-mastership-change;
destination server1;
output-format text;
}
}
}
destinations {
server1 {
archive-sites {
"scp://[email protected]/home/lab/" password
"$9$f5F/CA01Ic/9evLX-d"; ## SECRET-DATA
}
}
}
イベントポリシーの結果として出力をアップロードする宛先
server1という名前で定義されたアーカイブサイト
Event policy
条件となるイベント
アクション
Event Policyで取り得るアクション
イベントを無視
ファイルをアップロード
Junos オペレーションコマンドの実行
Junos コンフィグレーションコマンドの実行
SNMP Trapを送出
Event Script の実行
180 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Event Policyのフォーマット
Event Policyはif/thenステートメントと同様な記載で定義します。
events, within, attributes-match ステートメントがif 部分の一部としてAND条件で評価される
複数列挙されたeventsはOR条件で評価
—同様のロジックはwithin および attributes-match にも適用される
[edit event-options]
user@R1# show
policy interface-up {
events vrrpd_new_master;
within 120 events snmp_trap_link_up;
attributes-match {
snmp_trap_link_up.interface-name equals
vrrpd_new_master.interface-name;
}
then {
ignore;
}
}
"if" 部
VRRPD_NEW_MASTER イベントを観測
過去120秒以内にSNMP_TRAP_LINK_UPイベントを観測
SNMP_TRAP_LINK_UPイベントのinterface-nameアトリビュートとVRRPD_NEW_MASTERイベントのinterface-nameアトリビュートの値が同じ
アクション
181 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
イベントアトリビュートの特定のしかた
help syslogコマンドで必要なイベントを探すことが可能です。instructor@vr-device_hmx1> help syslog | match _UP
…
BFDD_TRAP_STATE_UP bfdd session was established
EVENTD_POLICY_UPLOAD_FAILED eventd could not upload file to configured destination
IDP_SCHEDULED_UPDATE_STARTED Scheduled update has started
MIB2D_SNMP_INDEX_UPDATE_STAT MIB2D could not get the status of SNMP index file
RPD_LAYER2_VC_BFD_UP BFD session for Layer 2 VPN VC came up
RPD_LAYER2_VC_UP Layer 2 VPN VC changed state to up
RPD_LDP_BFD_UP LDP BFD session for FEC came up
RPD_MPLS_LSP_UP MPLS LSP came up
RPD_MPLS_PATH_BFD_UP BFD session for MPLS path came up
RPD_MPLS_PATH_UP MPLS path came up
RPD_MSDP_PEER_UP MSDP peer entered Established state
RPD_RIP_AUTH_UPDATE RIP authentication failed for update message
RPD_RSVP_BYPASS_UP RSVP link-protection bypass was established
SDXD_PID_FILE_UPDATE sdxd could not update PID file
SERVICED_PID_FILE_UPDATE serviced could not write to PID file
SNMP_TRAP_LINK_UP linkUp trap was sent
SPD_PID_FILE_UPDATE spd could not update PID file
instructor@vr-device> help syslog SNMP_TRAP_LINK_UP
Name: SNMP_TRAP_LINK_UP
Message: ifIndex <snmp-interface-index>, ifAdminStatus <admin-status>, ifOperStatus
<operational-status>, ifName <interface-name>
Help: linkUp trap was sent
Description: The SNMP agent process (snmpd) generated a linkUp trap because the indicated
interface changed state to 'up'.
Type: Event: This message reports an event, not an error
Severity: info
Facility: LOG_DAEMON
アトリビュートはアングルブラケットに囲まれてリストされている
182 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
EVENT POLICYのユースケースと設定例
183 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
以降、vSRXは以下のConfigで動作しているものとします。
set system host-name host
set system root-authentication encrypted-password "****"
set system services ssh
set system syslog user * any emergency
set system syslog file messages any any
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set interfaces ge-0/0/0 unit 0 family inet address 192.168.100.1/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.200.1/24
set routing-options static route 0.0.0.0/0 next-hop 192.168.100.254
set routing-options static route 10.0.0.1/32 next-hop 192.168.100.254
set security nat source rule-set NAPT from zone trust
set security nat source rule-set NAPT to zone untrust
set security nat source rule-set NAPT rule NAPT match source-address 0.0.0.0/0
set security nat source rule-set NAPT rule NAPT then source-nat interface
set security policies default-policy permit-all
set security zones security-zone trust tcp-rst
set security zones security-zone trust interfaces ge-0/0/1.0
set security zones security-zone untrust interfaces ge-0/0/0.0
184 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例1:環境変化による自動設定変更
Router1経由の外部接続に障害が発生した際、Router2経由をDefaultGatewayとするよう自動的に設定変更を行う
Internet
Router1
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0192.168. 100.1
ge-0/0/1.0192.168.200.1
Router2
. 100.254. 100.253
10.0.0.1
①10.0.0.1への
到達性がなくなったらデフォルトルートをRouter2に向ける
185 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例1:環境変化による自動設定変更
Step.1:ターゲットに対してRPMで状態の確認するための設定を行います。
set services rpm probe sample1 test s1test probe-type icmp-ping
set services rpm probe sample1 test s1test target address 10.0.0.1
set services rpm probe sample1 test s1test probe-count 5
set services rpm probe sample1 test s1test test-interval 60
set services rpm probe sample1 test s1test thresholds total-loss 2
※上記の設定で、10.0.0.1への疎通に問題が発生すると以下のようなLog Messageが表示されるのでこれをEvent Policyのトリガーに使用します。
Dec 18 13:04:02 host rmopd[10393]: PING_PROBE_FAILED:
pingCtlOwnerIndex = sample1, pingCtlTestName = s1test
186 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例1:環境変化による自動設定変更
Step.2:RPMの結果を表すLogをトリガーとしたEvent Policyを作成します。
set event-options policy sample1 events ping_test_failed
set event-options policy sample1 within 5 trigger on
set event-options policy sample1 within 5 trigger 1
set event-options policy sample1 attributes-match ping_test_failed.test-
name matches s1test
set event-options policy sample1 then change-configuration commands "delete
routing-options static route 0.0.0.0/0 next-hop 192.168.100.254"
set event-options policy sample1 then change-configuration commands "set
routing-options static route 0.0.0.0/0 next-hop 192.168.100.253"
set event-options policy sample1 then change-configuration commit-options
log s1test-log
187 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例1:環境変化による自動設定変更
指定したターゲットへの通信に問題を発生させてみると、以下のようなLogとともに、Default Routeへのターゲットが自動的に設定変更されているのを確認することができます。
Dec 18 13:59:42 host rmopd[10393]: PING_TEST_FAILED: pingCtlOwnerIndex =
sample1, pingCtlTestName = s1test
Dec 18 13:59:44 host file[12010]: UI_JUNOSCRIPT_CMD: User 'root' used
JUNOScript client to run command 'commit-configuration log=s1test-log‘
確認:
[edit]
root@host# show routing-options
static {
route 0.0.0.0/0 next-hop 192.168.100.253;
}
※ターゲットの復旧に伴い自動的に元に戻したいときは、 "ping_test_completed"というイベントを使用しつつ同様の設定を行うことで実現可能です。
188 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例2:時間指定による自動CLI実行と出力のUpload
特定時刻におけるFirewallのセッション数と機器のCPU使用率を自動的に取得して、外部ファイルサーバーへUploadする。
Internet
Router
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0192.168.100.1
ge-0/0/1.0192.168.200.1
FTP Server192.168.200.74
②指定した時刻の状態をFTP
サーバに保存
189 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例2:時間指定による自動CLI実行と出力のUpload
Step.1:CLIを実行したい時間を指定して設定を行います。(ここでは0時から5秒おきに5回コマンドを取得することを想定)set event-options generate-event s2time-000000 time-of-day "00:00:00 +0000"
set event-options generate-event s2time-000005 time-of-day "00:00:05 +0000"
set event-options generate-event s2time-000010 time-of-day "00:00:10 +0000"
set event-options generate-event s2time-000015 time-of-day "00:00:15 +0000"
set event-options generate-event s2time-000020 time-of-day "00:00:20 +0000"
※時間はインターバルで時間指定することも可能(ただし単位は60秒〜)
root@host# set event-options generate-event sample2-time time-interval ?
Possible completions:
<time-interval> Frequency for generating the event (60..2592000 seconds)
190 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例2:時間指定による自動CLI実行と出力のUpload
Step.2:指定した時間に実行したいコマンドを設定します。
set event-options policy sample2 events s2time-000000
set event-options policy sample2 events s2time-000005
set event-options policy sample2 events s2time-000010
set event-options policy sample2 events s2time-000015
set event-options policy sample2 events s2time-000020
set event-options policy sample2 then execute-commands commands "show security
flow session"
set event-options policy sample2 then execute-commands commands "show security
monitoring fpc 0"
191 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例2:時間指定による自動CLI実行と出力のUpload
Step.3:実行するコマンドによる出力のUpload先を指定します。
set event-options policy sample2 then execute-commands output-filename
sample2log
set event-options policy sample2 then execute-commands destination
sample2remote
set event-options policy sample2 then execute-commands output-format text
set event-options destinations sample2remote archive-sites
"ftp://[email protected]/home/vsrx" password "$9$5zn90BEevLApvLxNY25QF"
※アウトプットをローカルディレクトリに保存する場合の設定
set event-options destinations sample2local archive-sites /var/tmp
192 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例2:時間指定による自動CLI実行と出力のUpload
指定した時間になると、あて先を設定したFTPサーバーに以下のようなファイルがUploadされており、CLIのOutputがファイルとして保存されています。
root@file-server> file list /var/home/vsrx
/var/home/vsrx/:
.ssh/
host_sample2log_20150114_000002
host_sample2log_20150114_000007
host_sample2log_20150114_000012
host_sample2log_20150114_000017
host_sample2log_20150114_000022
193 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例2:時間指定による自動CLI実行と出力のUpload
ファイルの中身が時間で指定したCLIのOutputとなっています。
root@file-server> file show /var/home/vsrx/host_sample2log_20150114_000002
root@host> show security flow session
Total sessions: 0
root@host> show security monitoring fpc 0
FPC 0
PIC 0
CPU utilization : 0 %
Memory utilization : 54 %
Current flow session : 5
Current flow session IPv4: 5
Current flow session IPv6: 0
Max flow session : 262144
Total Session Creation Per Second (for last 96 seconds on average): 0
IPv4 Session Creation Per Second (for last 96 seconds on average): 0
IPv6 Session Creation Per Second (for last 96 seconds on average): 0
194 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
vSRXのCPU使用率が指定した閾値を超えて高騰した場合に、自動的に機器の詳細情報を取得し保存する。
Internet
Router1
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0192.168.100.1
ge-0/0/1.0192.168.200.1
③CPU負荷が上昇したら状態を保存
195 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
Step.1:取得したいポイントのMIB-OIDをしらべます。
※この例では、Security Flow処理にかかるCPU使用率をトラックします。
root@host> show security monitoring fpc 0
FPC 0
PIC 0
CPU utilization : 10 %
Memory utilization : 54 %
Current flow session : 1555
Current flow session IPv4: 1555
Current flow session IPv6: 0
Max flow session : 262144
Total Session Creation Per Second (for last 96 seconds on average): 72
IPv4 Session Creation Per Second (for last 96 seconds on average): 72
IPv6 Session Creation Per Second (for last 96 seconds on average): 0
root@host> show snmp mib walk decimal 1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4
jnxJsSPUMonitoringCPUUsage.0 = 10
196 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
Step.2:監視したいOIDを指定してRMONの設定を行います。
set snmp community public authorization read-only
set snmp trap-group public categories rmon-alarm
set snmp trap-group public targets 192.168.200.74
set snmp rmon alarm 1 interval 10
set snmp rmon alarm 1 variable 1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4.0
set snmp rmon alarm 1 sample-type absolute-value
set snmp rmon alarm 1 startup-alarm rising-or-falling-alarm
set snmp rmon alarm 1 rising-threshold 10
set snmp rmon alarm 1 falling-threshold 5
set snmp rmon alarm 1 rising-event-index 1
set snmp rmon alarm 1 falling-event-index 1
set snmp rmon alarm 1 syslog-subtag sample3rmon
set snmp rmon event 1 type log-and-trap
197 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
Step.3:指定したMIBの値がThresholdを越える/下がる、毎に以下のようなLogが表示されるので、これをトリガーにしてEvent Policyを発動させます。
root@host# run show log messages |match RMON
Dec 18 17:23:54 host snmpd[1356]: SNMPD_RMON_EVENTLOG: sample3rmon: Event
1 triggered by Alarm 1, rising threshold (10) crossed, (variable:
jnxJsSPUMonitoringCPUUsage.0, value: 13)
Dec 18 17:24:34 host snmpd[1356]: SNMPD_RMON_EVENTLOG: sample3rmon: Event
1 triggered by Alarm 1, falling threshold (5) crossed, (variable:
jnxJsSPUMonitoringCPUUsage.0, value: 1)
198 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
Step.4:Thresholdの動きに応じて取得したいCLIコマンドをで設定します。set event-options policy sample3 events snmpd_rmon_eventlog
set event-options policy sample3 attributes-match snmpd_rmon_eventlog.syslog-
subtag matches sample3rmon
set event-options policy sample3 then execute-commands commands "show security
monitoring fpc 0"
set event-options policy sample3 then execute-commands commands "show security
flow session summary"
set event-options policy sample3 then execute-commands commands "show security
flow statistics"
set event-options policy sample3 then execute-commands output-filename
sample3log
set event-options policy sample3 then execute-commands destination sample3local
set event-options policy sample3 then execute-commands output-format text
set event-options destinations sample3local archive-sites /var/tmp
199 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
指定した閾値を越えたり、下がったりするたびにEvent Policyが発動され、指定したLocal DirectoryにFileが作成されていることが確認できます。
root@host# run file list /var/tmp
/var/tmp:
…
host_sample3log_20151224_220032
host_sample3log_20150114_123456
…
200 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
使用例3:MIBの閾値による自動CLI実行
Fileの中身を見てみると自動的に取得したCLIコマンドのOutputが確認できます。
root@host# run file show /var/tmp/host_sample3log_20150114_123456
root@host> show security monitoring fpc 0
FPC 0
PIC 0
CPU utilization : 10 %
Memory utilization : 54 %
Current flow session : 1246
Current flow session IPv4: 1246
Current flow session IPv6: 0
Max flow session : 16384
Total Session Creation Per Second (for last 96 seconds on average): 35
IPv4 Session Creation Per Second (for last 96 seconds on average): 35
IPv6 Session Creation Per Second (for last 96 seconds on average): 0
root@host> show security flow session summary
Unicast-sessions: 1312
Multicast-sessions: 0
Failed-sessions: 0
Sessions-in-use: 1912
Valid sessions: 1311
…
(以下略)
201 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定のまとめ
ここまでの設定を図にまとめると、以下のようになります。
Internet
Router1
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0192.168.100.1
ge-0/0/1.0192.168.200.1
Router2
. 100.254. 100.253
10.0.0.1
FTP Server
192.168.200.74
③CPU負荷が上昇したら状態を保存
①10.0.0.1への
到達性がなくなったらデフォルトルートをRouter2に向ける
②指定した時刻の状態をFTP
サーバに保存
202 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
まとめ
この資料では、以下の項目について紹介しました。
JUNOScriptの概要
Event Scriptの概要
Event Scriptのユースケースと設定手順
例1:環境変化による自動設定変更
– Router1経由の外部接続に障害が発生した際、Router2経由をDefault Gatewayとするよう自動的に設定変更を行う
例2: 時間指定による自動CLI実行と出力のUpload
– 特定時刻における、Firewallのセッション数と機器のCPU使用率を自動的に取得して、外部ファイルサーバーへUploadする
例3: MIBの閾値による自動CLI実行
– vSRXのCPU使用率が指定した閾値を超えて高騰した場合に、自動的に機器の詳細情報を取得し保存する。
203 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定(1/2)
最終的に、以下のような設定で動作しているはずです (一部関係のない記述については省略)
set system host-name hostname
set system root-authentication encrypted-password "***"
set system services ssh
set interfaces ge-0/0/0 unit 0 family inet address 192.168.100.1/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.200.1/24
set event-options generate-event s2time-000000 time-of-day "00:00:00 +0000"
set event-options generate-event s2time-000005 time-of-day "00:00:05 +0000"
set event-options generate-event s2time-000010 time-of-day "00:00:10 +0000"
set event-options generate-event s2time-000015 time-of-day "00:00:15 +0000"
set event-options generate-event s2time-000020 time-of-day "00:00:20 +0000"
set event-options policy sample1 events ping_test_failed
set event-options policy sample1 within 5 trigger on
set event-options policy sample1 within 5 trigger 1
set event-options policy sample1 attributes-match ping_test_failed.test-name matches s1test
set event-options policy sample1 then change-configuration commands "delete routing-options static route 0.0.0.0/0 next-hop 192.168.100.254"
set event-options policy sample1 then change-configuration commands "set routing-options static route 0.0.0.0/0 next-hop 192.168.100.253"
set event-options policy sample1 then change-configuration commit-options log s1test-log
set event-options policy sample2 events s2time-000000
set event-options policy sample2 events s2time-000005
set event-options policy sample2 events s2time-000010
set event-options policy sample2 events s2time-000015
set event-options policy sample2 events s2time-000020
set event-options policy sample2 then execute-commands commands "show security flow session"
set event-options policy sample2 then execute-commands commands "show security monitoring fpc 0"
set event-options policy sample2 then execute-commands output-filename sample2log
set event-options policy sample2 then execute-commands destination sample2remote
set event-options policy sample2 then execute-commands output-format text
set event-options policy sample3 events snmpd_rmon_eventlog
set event-options policy sample3 attributes-match snmpd_rmon_eventlog.syslog-subtag matches sample3rmon
set event-options policy sample3 then execute-commands commands "show security monitoring fpc 0"
set event-options policy sample3 then execute-commands commands "show security flow session summary"
set event-options policy sample3 then execute-commands commands "show security flow statistics"
set event-options policy sample3 then execute-commands output-filename sample3log
set event-options policy sample3 then execute-commands destination sample3local
set event-options policy sample3 then execute-commands output-format text
set event-options destinations sample2remote archive-sites "ftp://[email protected]/home/vsrx" password "$9$5zn90BEevLApvLxNY25QF"
set event-options destinations sample3local archive-sites /var/tmp
204 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
設定(2/2)
set snmp community public authorization read-only
set snmp trap-group public categories rmon-alarm
set snmp trap-group public targets 192.168.200.74
set snmp rmon alarm 1 interval 10
set snmp rmon alarm 1 variable 1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4.0
set snmp rmon alarm 1 sample-type absolute-value
set snmp rmon alarm 1 startup-alarm rising-or-falling-alarm
set snmp rmon alarm 1 rising-threshold 10
set snmp rmon alarm 1 falling-threshold 5
set snmp rmon alarm 1 rising-event-index 1
set snmp rmon alarm 1 falling-event-index 1
set snmp rmon alarm 1 syslog-subtag sample3rmon
set snmp rmon event 1 type log-and-trap
set routing-options static route 0.0.0.0/0 next-hop 192.168.100.254
set routing-options static route 10.0.0.1/32 next-hop 192.168.100.254
set security nat source rule-set NAPT from zone trust
set security nat source rule-set NAPT to zone untrust
set security nat source rule-set NAPT rule NAPT match source-address 0.0.0.0/0
set security nat source rule-set NAPT rule NAPT then source-nat interface
set security policies default-policy permit-all
set security zones security-zone trust tcp-rst
set security zones security-zone trust interfaces ge-0/0/1.0
set security zones security-zone untrust interfaces ge-0/0/0.0
set services rpm probe sample1 test s1test probe-type icmp-ping
set services rpm probe sample1 test s1test target address 10.0.0.1
set services rpm probe sample1 test s1test probe-count 5
set services rpm probe sample1 test s1test test-interval 60
set services rpm probe sample1 test s1test thresholds total-loss 2
vSRX on your laptop
ユースケース : Firewall <CW4S SSG/ScreenOS like GUI>
Juniper Networks, K.K.
June 2015
206 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この資料では以下の項目について紹介します。
CW4Sとは
CW4Sの導入
207 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
想定環境
この資料は、以下のような環境を想定して作成されています。また、「vSRXのインストールと初期設定」を完了していることを前提としています。
ハードウェア
CPU: x86-64/AMD64を搭載したプロセッサ
RAM: 4GB以上
HDD: 空き容量10GB程度
NIC: 2つまたはそれ以上
ソフトウェア
OS: Windows 7
VMM: VMware Player 5.0
vSRX 12.1X47-D20
CW4S 0.6.0
208 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sとは
209 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sとは
CW4Sとは、(株)RCA さんと(有)LEFT さんが開発されている、SRXやvSRXをScreenOS(NetScreen/SSG)のような見た目のWeb GUIから操作できるフリーウェアです。
http://cw4s.org/
現在、以下のような設定をサポートしています。
初期設定
基本設定
Firewall
NAT
PPPoE
IPsec VPN
なお、vSRXをCW4Sで操作する場合、vSRX側の制約により、bgroup(Bridge-group)機能を使用することができません。
また、PPPoEについても正式には未サポートとなります。
210 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
211 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
ここでは、CW4Sを使用するまでの手順について紹介します。
想定するネットワークは以下のようなものです。
Internet
Router
vSRX
Untrust Zone Trust Zone
ge-0/0/0.0192.168.100.1
ge-0/0/1.0192.168.200.1
Put a setting via Netconf !!
212 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
CW4Sでは、Netconfと呼ばれる、ネットワーク機器の設定プロトコルを使用します。
vSRXでNetconfを有効にするために、以下の設定コマンドを入力し、commitします。(環境に応じてZoneやInterfaceは置き換えてください)
root@host# set system services netconf ssh
root@host# set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic
system-services netconf
root@host# set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic
system-services netconf
以上で準備は完了です。
213 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
以下のWebサイトから、環境に合ったCW4Sをダウンロードします。
http://cw4s.org/download/
ダウンロードが完了したら、任意のフォルダに展開し、cw4s.exeを実行します。
すると、タスクバーの右側に図のようなアイコンが表示されるので、右クリックしてopenをクリックします。
214 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
以下のような画面が開くので、「Register your device」をクリックします。
215 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
機器の情報を入力する欄が表示されるので、環境に合わせて値を設定し、Registをクリックします。
216 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
先程追加したデバイスがリストに表示されていますので、Homeを押してデバイスの管理画面に入ります。
217 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sの導入
設定が正しく行われている場合、以下のような画面が表示されます。
以上でCW4Sの導入は完了です。
218 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sによる設定変更
CW4SによりvSRXが正しく認識されると、以降NetScreen/SSGと同様のGUI画面からvSRXに設定変更を実施することが可能となります。
219 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sによる設定変更
NAT(MIP)
220 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sによる設定変更
ファイアーウォール ポリシー設定
221 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sによる設定変更
ファイアーウォール ポリシー順序変更
222 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
CW4Sによる設定変更
ただし内部で動作しているOSはあくまでJUNOSなので、vSRXに設定変更を実行する場合にはCommitにて反映を実施します。
224 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
参考資料
Juniper Networks Day One ブックレット(日本語版)
http://www.juniper.net/jp/jp/dm/dayone/
Junos CLIの探究
SRXシリーズ サービスゲートウェイの導入
EIGRPからOSPFへの移行
Junosポリシーおよびファイアウォールフィルタの設定
MPLSの導入