vSRXで遊ぶ
Juniper 製 Firewall装置、SRX シリーズ、その評価版イメージが入手できた。 GNS3に入れてみる。
Target Version
主なソフト | Version | 備考 |
---|---|---|
GNS3 | 2.1.19 | 検証時最新版 |
vSRX | 20.3 | 最新評価版 |
GNS3へのDeploy
Portの読み替え
vSRX機器で見た Interface 名と GNS3側から見た Interface名とは微妙に食い違う。
No | vSRX上のIF名 | GNS3上のIF名 | 備考 |
---|---|---|---|
1 | fxp0 | Ethernet0 | 帯域外監視 |
2 | em0 | Ethernet1 | 内部Interface |
3 | ge-0/0/0 | Ethernet2 | |
4 | ge-0/0/1 | Ethernet3 | |
5 | ge-0/0/2 | Ethernet4 | |
6 | ge-0/0/3 | Ethernet5 |
fxp0は Management Port. em0は機器内部接続用 Interface. vSRX間でChassis Clusterを組む時に利用する。vのつかない、アプライアンス版の SRX だと fxp1 となっている、らしい。実機は触ったことがないのでわからない。fxp
や em
が何の略称か少し調べたけど分からなかった。Juniperの公式サイトで見つけられない。うーん。
GNS3での Port名変更
GNS3 の Appliance フォルダにあるjuniper-vsrx.gns3a
を覗いてみると、以下のように定義されている。
{
"name": "vSRX",
"category": "firewall",
(snip)
"usage": "Initial username is root, no password.",
"first_port_name": "fxp0",
"port_name_format": "ge-0/0/{0}",
デフォルトだと最初のPortは fxp0となるように唄われている。でも、実際に構築してみたらこうなってはくれていなかった。また、vSRX の 2Port目は em0 になるわけだが、例えばsecond_port_name
といったOptionがあるわけではない。secondは、thirdはってなるか、あるいはLine Cardを増設するような装置だと整合性が付かなくなるのかもしれない。
ひとまずはDeployした後で整合性を合わせる。
設定例
遊んだ構成
以下を目標にする。
- TrustゾーンとUntrustに分ける
- 2台のvSRXで以てChassis Clusterを組む
- PC3/4間でPingが通るようにする。
物理接続
vSRX1
Port | 対向装置-Port | 備考 |
---|---|---|
em0 | vSRX2-em0 | Routing Engine間 |
ge-0/0/0 | vSRX2-ge-0/0/0 | fab0 用に使用 |
ge-0/0/1 | Switch2 e1 | PC3接続Switchに接続 |
ge-0/0/2 | Switch3 e1 | PC4接続Switchに接続 |
vSRX2
Port | 対向装置-Port | 備考 |
---|---|---|
em0 | vSRX1-em0 | Routing Engine間 |
ge-0/0/0 | vSRX1-ge-0/0/0 | fab0 用に使用 |
ge-0/0/1 | Switch2 e2 | PC3接続Switchに接続 |
ge-0/0/2 | Switch3 e2 | PC4接続Switchに接続 |
論理設定
各ノードに Cluster ID/ Node IDを割り当て
オペレーションモードで、それぞれ下記を実行し、再起動する。最初、Config モードでやってコマンドが入らないと結構悩んだことガガガ。
- Cluster-id
- シャーシ間でクラスタリングするときに割り当てるID. 1-15まで割り当てる。同一ブロードキャストドメイン内で、Cluster-id が重複してはならない。
- Node ID
- Cluster内のメンバを識別するのに使用される。0/1のみ。0-15位の範囲までに増やして欲しい。 Pool 化できると夢は広がるんだけど、セッション同期制御がえっらい大変なことになる。
1台目
root> set chassis cluster cluster-id 1 node 0
2台目
root> set chassis cluster cluster-id 1 node 1
実 Configuration
ホスト名と帯域外監視設定
set groups node0 system host-name vSRX-node0
set groups node0 system backup-router 192.168.1.1 destination 192.168.1.0/24
set groups node0 interfaces fxp0 unit 0 family inet address 192.168.1.150/24 master-only
set groups node0 interfaces fxp0 unit 0 family inet address 192.168.1.151/24
set groups node1 system host-name vSRX-node1
set groups node1 system backup-router 192.168.1.1 destination 192.168.1.0/24
set groups node1 interfaces fxp0 unit 0 family inet address 192.168.1.150/24 master-only
set groups node1 interfaces fxp0 unit 0 family inet address 192.168.1.152/24
set apply-groups "${node}"
-
backup-router
は、SRX の起動時、Routing Protocol Daemonが上がる前に監視系接続させるための設定。 -
set apply-groups "${node}"
は、以上のパラメータのGroup Optionを適用させるためのもの。
Fabricリンク接続
vSRXでは、Node 1の Interfaceがge-0/0/xと、Node 2の Interface ge-7/0/xとなる。
データプレーンでのセッション同期をさせるため、fabricリンクを設定する。
ge-0/0/xとge-7/0/xの任意のPortを指定できる。ここでは、ge-0/0/0
とge-7/0/0
を使用。ここでは単純に物理 Interfaceを使用したが、耐障害性向上を図ってTrunk Port接続にもできる。
Chassis 型のSRXを使用する場合はLine Cardごとに作る必要がある、らしい。そこまでは裏を取っていない。
set interfaces fab0 fabric-options member-interfaces ge-0/0/0
set interfaces fab1 fabric-options member-interfaces ge-7/0/0
Redundancy Groupの定義
Chassis Clusterを作る際、Node 1と2のどちらをPrimary Nodeとするかを指定する。これは、Routing Engine用(0)とデータプレーン用(1)で二つ存在する。Priorityは高いほうがPrimary Nodeとなる。
set chassis cluster redundancy-group 0 node 0 priority 200
set chassis cluster redundancy-group 0 node 1 priority 100
set chassis cluster redundancy-group 1 node 0 priority 200
set chassis cluster redundancy-group 1 node 1 priority 100
実際にどちらが優先されているかは、show chassis cluster redundancy-group X
で調べられる。
root> show chassis cluster status redundancy-group 0
Monitor Failure codes:
CS Cold Sync monitoring FL Fabric Connection monitoring
GR GRES monitoring HW Hardware monitoring
IF Interface monitoring IP IP monitoring
LB Loopback monitoring MB Mbuf monitoring
NH Nexthop monitoring NP NPC monitoring
SP SPU monitoring SM Schedule monitoring
CF Config Sync monitoring RE Relinquish monitoring
IS IRQ storm
Cluster ID: 1
Node Priority Status Preempt Manual Monitor-failures
Redundancy group: 0 , Failover count: 1
node0 200 primary no no None
node1 100 secondary no no None
Redundant Ethernet Interfaceの設定
ここまででChassis Cluster自体は構築できた。SRXへつながるノードに対して外接 Interfaceを定義する必要があるが、これが Redundant Ethernet Interface. 二つの物理インクを一つの論理リンクにマッピングするのに使用される。一つのリンクがDownした際、もう一つのリンクに切り替わる。
VRRP/HSRPとかの 仮想IPを外部へ提供するのと同じようなイメージ。VRRP/HSRPでは仮想IPの他、物理InterfaceごとにIPアドレスを触れるが、Redundant Ethernet Interfaceだと仮想IPのみ、らしい。
システムで動作させる Redundant Ethernet Interface の数は定義する必要がある。
vSRXでは最大64まで。上限値をユーザ側が定められる理由ってのは何だろ?
root@vSRX3a# set chassis cluster reth-count ?
Possible completions:
<reth-count> Number of redundant ethernet interfaces (1..64)
コマンドはこんな感じ。
set chassis cluster reth-count 2
set interfaces ge-0/0/1 gigether-options redundant-parent reth0
set interfaces ge-0/0/2 gigether-options redundant-parent reth1
set interfaces ge-7/0/1 gigether-options redundant-parent reth0
set interfaces ge-7/0/2 gigether-options redundant-parent reth1
set interfaces reth0 redundant-ether-options redundancy-group 1
set interfaces reth0 unit 0 family inet address 1.1.1.254/24
set interfaces reth1 redundant-ether-options redundancy-group 1
set interfaces reth1 unit 0 family inet address 2.2.2.254/24
Security Zone の設定
ここまでで試験端末から見たInterfaceが提供できた。ただ、Pingは通らない。だってSRXだから。
デフォルトでは Interface が Null Zone に紐づかされている。それを、Trust/Untrustのゾーンに分けてあげる。
root> show security zones
Security zone: trust
Send reset for non-SYN session TCP packets: On
Policy configurable: Yes
Interfaces bound: 0
Interfaces:
Advanced-connection-tracking timeout: 1800
Security zone: untrust
Send reset for non-SYN session TCP packets: Off
Policy configurable: Yes
Screen: untrust-screen
Interfaces bound: 0
Interfaces:
Advanced-connection-tracking timeout: 1800
Security zone: junos-host
Send reset for non-SYN session TCP packets: Off
Policy configurable: Yes
Interfaces bound: 0
Interfaces:
Advanced-connection-tracking timeout: 1800
まずは全許可する場合。
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 zones security-zone trust interfaces reth0.0 host-inbound-traffic system-services ping
set security zones security-zone untrust interfaces reth1.0
host-inbound-traffic
はSRXに対する通信をどうするか。疎通確認用でPingくらいは応答させたかったので、これを入れた。
ここまでで、FirewallとしてのSRXでEnd-Endでの疎通確認が取れるようになる。