Weitere ähnliche Inhalte
Ähnlich wie vSRX on Your Laptop : PCで始めるvSRX ~JUNOSをさわってみよう!~ (20)
Mehr von Juniper Networks (日本) (20)
vSRX on Your Laptop : PCで始めるvSRX ~JUNOSをさわってみよう!~
- 1. vSRX on your laptop
PCではじめるvSRX
〜JUNOSを触ってみよう!〜
Juniper Networks, K.K.
kazubu
June 2015
- 2. 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. 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. 4 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのインストール
- 5. 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. 6 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのインストール
ダウンロードしたインストーラを実行し、手順に沿ってインストール
を完了します。
インストール中に選択する項目についてはお好みで設定してください。
- 7. 7 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのネットワーク設定
- 8. 8 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VMware Playerのネットワーク設定
VMware Player上にインストールしたvSRXから、PC上の2つのNICを
それぞれ使用するために、VMwareのネットワーク設定を変更します。
PCのOnboard NIC
USB などによる
増設NIC
- 9. 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. 10 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
仮想ネットワークの設定
仮想ネットワークエディタを起動すると以下のような画面が開くので、
「ネットワークの追加」をクリックします。
- 11. 11 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
仮想ネットワークの設定
追加するネットワークを選択する画面が表示されるので、空いている
物の中から任意に選択します。なお、今回はVMnet5を使用します。
追加が完了すると以下のように、仮想ネットワークが作成されます。
- 12. 12 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ブリッジの設定
初期状態ではVMnet0が自動ブリッジとして設定されているため、ま
ずVMnet0のブリッジ先NICを固定します。
仮想ネットワークエディタでVMnet0を選択し、ブリッジ先に上流側
のNICを指定します。
- 13. 13 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ブリッジの設定
同じ手順で、VMnet5のブリッジ先に下流側のNICを指定します。
- 14. 14 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
変更の適用
最後に、仮想ネットワークエディタのOKをクリックし、変更したネッ
トワーク構成を保存します。
- 15. 15 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
- 16. 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. 17 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
VMware Playerを起動します。
VMware Player左上のメニューで、ファイル→開く(O)を選択します。
- 18. 18 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
ファイルを選択する画面が開くので、同梱のovaファイルを選択しま
す。
- 19. 19 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXのデプロイ
仮想マシンの名前と保存先を指定する画面が出てくるので、任意の名
前と保存先を指定し、インポートします。
インポートの開始前に、使用許諾契約(EULA)が表示されるので、内容
を読んだ上で同意します。
- 20. 20 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ネットワーク設定の編集
インポートが完了すると、指定した名前の仮想マシンがVMware
Playerに追加されています。それを選択し、「仮想マシン設定の編
集」を選択します。
- 21. 21 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ネットワーク設定の編集
仮想マシン設定ウィンドウの左ペインに表示されているネットワーク
アダプタを選択し、ブリッジが選択されていることを確認します。
次に、ネットワークアダプタ2を選択し、ネットワーク接続の種類を
カスタムに変更して、先程作成した仮想ネットワーク(VMnet5)を選択
します。
- 22. 22 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの起動
OKを押してVMware Playerのメイン画面に戻り、「仮想マシンの再
生」をクリックすると、vSRXが起動します。
- 23. 23 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
- 24. 24 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
vSRXが起動しているウィンドウをクリックすると、VM内にキーボー
ドで入力を行うことができるようになります。
なお、 CtrlとAltを同時に押すことで、ホストPCの操作に戻ることが
できます。
まず、vSRXにrootでログインします(パスワードなし)。
- 25. 25 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
vSRXの初期設定
ログインに成功すると、root@%といったシェルモードのプロンプト
が表示されるので、「cli」と入力し、オペレーションモードに移行
します。
次に「configure」と入力して、コンフィギュレーションモードに移
行します。
- 26. 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. 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. 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. 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. 30 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
JUNOSの基本オペレーション
- 31. 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. 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. 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. 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. 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. 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. 37 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Syntax errorの通知
コマンドシンタックスエラーがあると
^ マークが「どこ」にエラーがあるかを示します
メッセージは正しいコマンドのヒントを表示します
Example:
root@host# load
^
syntax error, expecting <command>.
[edit]
root@host#
- 38. 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. 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. 40 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
階層間の移動
exit:今までいたレベルに戻ります
topでexitを実行すると,Operationalモードに戻ります
Operationalモードでexitを実行すると,システムからLogoutします
ShellからcliでOperationalモードに入った場合、Shellに戻ります
up:一つ上のレベルに移動します
top:最上位のレベルに移動します
- 41. 41 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Commitベースの設定管理
Commitするまで設定は反映されません
もし設定を間違えたら,rollbackにて前の状態に戻ることが可能です
commit
rollback n
Candidate
configuration
Active
configuration
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. 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. 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. 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. 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. 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. 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
- 48. vSRX on your laptop
ユースケース集
Juniper Networks, K.K.
June 2015
- 49. 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"
- 50. vSRX on your laptop
ユースケース : Firewall <Firewall/NAT>
Juniper Networks, K.K.
June 2015
- 51. 51 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この章では以下の手順を紹介します。
Firewall設定, NAT設定
DHCPサーバ設定
- 52. 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. 53 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
FIREWALLの設定
- 54. 54 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Firewallの設定
ここでは、vSRXをシンプルなファイアウォールとして設定する手順を
紹介します。
想定するネットワークは以下のようなものです。
Internet
Router
vSRX
Clientge-0/0/0 ge-0/0/1
- 55. 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. 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. 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. 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. 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. 60 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
Router
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0
DHCP
ge-0/0/1.0
192.168.200.1
telnet
telnet以外
既存セッションの戻りパケット
既存セッションにないパケット
SSH/DHCP
SSH/DHCP以外
SSH
SSH以外
- 61. 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
- 63. 63 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
Firewall設定が完了しても、上位のルータがクライアントPCの所属す
るIPサブネット(例:192.168.200.0/24)への経路を持っていないため、
まだクライアントPCはインターネットに接続することはできません。
これを解決する方法として以下のようなものがあります。
上位のルータに静的経路を設定する
上位のルータおよびvSRXにルーティングプロトコルを設定する
NATを設定する
ここでは、NATを設定することによってクライアントPCをインター
ネットに接続可能にします。
- 64. 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. 65 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
Router
vSRX
Client PC
ge-0/0/0.0
DHCP
ge-0/0/1.0
192.168.200.1
telnet
telnet以外
既存セッションの戻りパケット
既存セッションにないパケット
SSH
SSH以外
SSH/DHCP
SSH/DHCP以外
N
A
T
Untrust Zone Trust Zone
- 66. 66 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
- 67. 67 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
下流インターフェース配下のクライアントPCにIPアドレスを割り当て
るため、DHCPサーバを設定します。
- 68. 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. 69 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
まとめ
この章では、以下の手順を紹介しました。
Firewallの設定
インターフェースのSecurity Zoneへの割り当て
ポリシーの設定
フローセッションの確認
NATの設定
インターフェースアドレスを用いたSource NATの設定
DHCPサーバの設定
- 70. 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
- 71. vSRX on your laptop
ユースケース : Firewall <IPsec>
Juniper Networks, K.K.
June 2015
- 72. 72 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この資料では以下の項目について紹介します。
Firewall, NAT, DHCPの設定
IPsecの設定
対向機器の設定例
- 73. 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. 74 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
FIREWALLの設定
- 75. 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. 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. 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. 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. 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. 80 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
vSRX
Client PC
Untrust Zone Trust Zone
ge-0/0/0.0
10.0.200.10
ge-0/0/1.0
192.168.200.1
全てのパケット
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH/DHCP
SSH/DHCP以外
- 81. 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
- 83. 83 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
NATの設定
Firewall設定が完了しても、上位のルータがクライアントPCの所属す
るIPサブネット(例:192.168.200.0/24)への経路を持っていないため、
まだクライアントPCはインターネットに接続することはできません。
これを解決する方法として以下のようなものがあります。
上位のルータに静的経路を設定する
上位のルータおよびvSRXにルーティングプロトコルを設定する
NATを設定する
ここでは、NATを設定することによってクライアントPCをインター
ネットに接続可能にします。
- 84. 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. 85 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
vSRX
Client PC
ge-0/0/0.0
10.0.200.10
ge-0/0/1.0
192.168.200.1
全ての通信
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH
SSH以外
N
A
T
Untrust Zone Trust Zone
- 86. 86 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
- 87. 87 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
DHCPサーバの設定
下流インターフェース配下のクライアントPCにIPアドレスを割り当て
るため、DHCPサーバを設定します。
- 88. 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. 89 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ここまでの設定
ここまでの設定を図にまとめると、以下のようになります。
Internet
vSRX
Client PC
ge-0/0/0.0
10.0.200.10
ge-0/0/1.0
192.168.200.1
全ての通信
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH/DHCP
SSH/DHCP以外
N
A
T
Untrust Zone Trust Zone
DHCP
- 90. 90 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsecの設定
- 91. 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. 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. 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. 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. 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. 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. 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. 98 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
IPsec
ここまでの設定を図にまとめると、以下のようになります。
vSRX
Client PC
ge-0/0/0.0
10.0.200.10
ge-0/0/1.0
192.168.200.1
全ての通信
既存セッションの戻りパケット
既存セッションにないパケット
SSH/IKE
SSH/IKE以外
SSH
SSH以外
N
A
T
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. 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. 100 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
まとめ
この章では、以下の手順を紹介しました。
IPsec VPNの設定
- 101. 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. 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
- 104. 104 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
対向機器設定例
以下の機器を対向として使用する場合についてのサンプルコンフィグ
をご紹介します。
Juniper Networks vSRX
NEC UNIVERGE IX2000/3000
Cisco Systems 1812J
なお、これらの設定例についてはあくまで参考情報であり、接続性を
保証するものではありません。
- 105. 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. 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. 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
!
- 108. vSRX on your laptop
ユースケース : JUNOS Router <Static/Dynamic Routing>
Juniper Networks, K.K.
June 2015
- 109. 109 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
Agenda
この章では以下の手順を紹介します。
ルータとして使用するための設定
Static Route設定
OSPF設定
BGP設定
- 110. 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. 111 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルータとして使用するための設定
- 112. 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. 113 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
動作モードの変更
vSRXはデフォルトでFlow-based forwardingモードで動作しますが、
以下の設定コマンドを入力することにより、Packet-based
forwardingモードに移行することができます。
[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. 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. 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. 116 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
STATIC ROUTEの設定
- 117. 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. 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. 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. 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. 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. 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
- 124. 124 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
OSPF
OSPFを用いた簡単なネットワークを構築してみましょう。
今回は以下のような構成のネットワークを想定しています。なお、対
向Routerの設定はすでに完了しているものとします。
(対向デバイスは後のページにSRXでのサンプルConfigを掲載しています。)
Router
(ASBR)
1.1.1.1
vSRX
2.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. 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. 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. 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. 128 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルーティングテーブルの確認
それでは、ルーティングテーブルを確認してみましょう。ルーティング
テーブルは以下のコマンドで表示することができます。
root@host> show route
inet.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:18
Local 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:18
Local via ge-0/0/1.0
224.0.0.5/32 *[OSPF/10] 00:10:49, metric 1
MultiRecv
OSPFから受け取ったデフォルトルートと192.168.0.0/24宛の経路が、
ルーティングテーブルに反映されていることがわかります。
- 129. 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. 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
- 132. 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. 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. 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. 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. 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. 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. 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. 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. 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-options
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
root@host# exit
Exiting configuration mode
再起動
root@host> request system reboot
Reboot the system ? [yes,no] (no) yes
- 141. vSRX on your laptop
ユースケース : JUNOS Router <MPLS/VPLS>
Juniper Networks, K.K.
June 2015
- 142. 142 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
AGENDA
この資料では以下の手順を紹介します。
ルータとして使用するための設定
MPLSの設定
VPLSの設定
- 143. 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. 144 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
ルータとして使用するための設定
- 145. 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. 146 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
動作モードの変更
vSRXはデフォルトでFlow-based forwardingモードで動作しますが、
以下の設定コマンドを入力することにより、Packet-based
forwardingモードに移行することができます。
[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. 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. 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
- 150. 150 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
MPLSの設定
MPLSネットワークを構成しましょう。
今回は以下のような構成のネットワークを想定しています。対向
Routerの設定はすでに完了しているものとします。
(対向デバイスは後のページにSRXでのサンプルConfigを掲載しています。)
Router1(LER)Client 1
192.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. 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. 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. 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. 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. 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. 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. 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. 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
- 160. 160 Copyright © 2015 Juniper Networks, Inc. www.juniper.net
VPLSの設定
VPLSを用いたL2VPNネットワークを構築してみましょう。
Client1とClient2がルーティングネットワークを越えて、同一サブ
ネット上でLayer2通信を行えるようになれば完成です。
Router1(LER)Client 1
192.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. 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. 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. 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. 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. 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. 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