目次
【Juniper】Policyの設定方法【CLI】
Juniper SRXでPolicyを作成するCLI設定コマンドをまとめていきます。Policyの削除方法やPolicyを無効化する方法は別記事でまとめています。
アドレスブックがないことの確認
作成するアドレスブックがないことを確認します。
show security zones security-zone untrust address-book address google.com
アドレスブックの作成
アドレスブックを作成します。アドレスブック(アドレスオブジェクト)はポリシーに必要な具材です。「untrust」というゾーンに「google.com」というアドレスブックを作成してます。
set security zones security-zone untrust address-book address google.com dns-name google.com ipv4-only
設定が反映されていることを確認します。
jcluser@vSRX1# show security zones security-zone untrust address-book address google.com
dns-name google.com {
ipv4-only;
}
[edit]
作成するポリシーがないことの確認
「trust」というゾーンから「untrust」のゾーンへの通信である「test_policy_for_google」というポリシーを例にします。このポリシーがないことを確認します。
show security policies from-zone trust to-zone untrust policy test_policy_for_google
ポリシーの作成
ポリシー「test_policy_for_google」を作成します。サンプルとして、送信元IPアドレスがany、宛先IPアドレスが「google.com」、アプリケーションがhttpsであった場合、許可するポリシーになります。
デフォルトアプリケーションの確認方法は別記事でまとめています。
set security policies from-zone trust to-zone untrust policy test_policy_for_google match source-address any
set security policies from-zone trust to-zone untrust policy test_policy_for_google match destination-address google.com
set security policies from-zone trust to-zone untrust policy test_policy_for_google match application junos-https
set security policies from-zone trust to-zone untrust policy test_policy_for_google then permit
ポリシーの確認
ポリシーの設定が正しく反映できていることを確認します。必要であればポリシーに引っかかっているかカウンターで確認すると尚良いです。ポリシーカウンターの確認方法は別記事でまとめております。
jcluser@vSRX1# show security policies from-zone trust to-zone untrust policy test_policy_for_google
match {
source-address any;
destination-address google.com;
application junos-https;
}
then {
permit;
}
[edit]
設定の保存
show | compare
commit check
commit and-quit
まとめ
最後にまとめになります!
- ポリシーを作成する前に、必要であればアドレスブック(アドレスオブジェクト)を作成する
以上!