例:ES PIC IKE DYNAMIC SA 設定
図 1 は、ES PIC マニュアル SA の例と同じ IPSec トポロジーを示しています。ただし、今回の構成では、ルーター 2 とルーター 3 が IKE ダイナミック SA、拡張認証、およびより強力な暗号化を使用して IPSec トンネルを確立する必要があります。ルーター 1 とルーター 4 は引き続き基本的な接続を提供し、IPSec トンネルが動作していることを確認するために使用されます。
ルーター 1 で、ルーター 2 への基本的な OSPF 接続を提供します。
ルーター1
[edit]
interfaces {
so-0/0/0 {
description "To R2 so-0/0/0";
unit 0 {
family inet {
address 10.1.12.2/30;
}
}
}
lo0 {
unit 0 {
family inet {
address 10.0.0.1/32;
}
}
}
}
routing-options {
router-id 10.0.0.1;
}
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0.0;
interface lo0.0;
}
}
}
ルーター2では、ルーター1および3に接続するための基盤となるルーティングプロトコルとしてOSPFを有効にします。[edit security ipsec security-association]階層レベルで、sa-dynamic と呼ばれる双方向 IKE ダイナミック SA を設定します。IKEポリシーとプロポーザルでは、認証方法に事前共有鍵、認証アルゴリズムにSHA-1、暗号化に3DES-CBC、Diffie-Hellmanグループにはグループ2、メインモード、ライフタイムは3600秒、初期IKEネゴシエーションにはジュニパーの事前共有鍵を使用します。IPSec ポリシーとプロポーザルでは、プロトコルに ESP、認証に HMAC-SHA1-96、暗号化に 3DES-CBC、有効期間に 28800 秒、PFS グループにグループ 2 を使用します。
トラフィックを ES PIC および IPSec トンネルに転送するには、2 つのファイアウォール フィルタを作成します。 es-traffic フィルターは、ルーター 1 からのルーター 4 宛てのインバウンド トラフィックに一致し、 es-return フィルターは、ルーター 4 からルーター 1 へのリターン パスに一致します。 es-traffic フィルターを so-0/0/0 インターフェイスに適用してから、 es-return フィルターと sa-dynamic SA の両方を es-0/3/0 インターフェイスに適用します。
ルーター2
[edit]
interfaces {
so-0/0/0 {
description "To R1 so-0/0/0";
unit 0 {
family inet {
filter {
input es-traffic; # Apply a filter that sends traffic to the IPSec tunnel here.
}
address 10.1.12.1/30;
}
}
}
so-0/0/1 {
description "To R3 so-0/0/1";
unit 0 {
family inet {
address 10.1.15.1/30;
}
}
}
es-0/3/0 {
unit 0 {
tunnel { # Specify the IPSec tunnel endpoints here.
source 10.1.15.1;
destination 10.1.15.2;
}
family inet {
ipsec-sa sa-dynamic; # Apply the dynamic SA here.
filter {
input es-return; # Apply the filter that matches return IPSec traffic here.
}
}
}
}
lo0 {
unit 0 {
family inet {
address 10.0.0.2/32;
}
}
}
}
routing-options {
router-id 10.0.0.2;
}
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0.0;
interface so-0/0/1.0;
interface lo0.0;
}
}
}
security {
ipsec {
proposal es-ipsec-proposal { # Define your IPSec proposal specifications here.
protocol esp;
authentication-algorithm hmac-sha1-96;
encryption-algorithm 3des-cbc;
lifetime-seconds 28800;
}
policy es-ipsec-policy { # Define your IPSec policy specifications here.
perfect-forward-secrecy {
keys group2;
}
proposals es-ipsec-proposal; # Reference the IPSec proposal here.
}
security-association sa-dynamic { # Define your dynamic SA here.
mode tunnel;
dynamic {
ipsec-policy es-ipsec-policy; # Reference the IPSec policy here.
}
}
}
ike {
proposal es-ike-proposal { # Define your IKE proposal specifications here.
authentication-method pre-shared-keys;
dh-group group2;
authentication-algorithm sha1;
encryption-algorithm 3des-cbc;
lifetime-seconds 3600;
}
policy 10.1.15.2 { # Define your IKE policy specifications here.
mode main;
proposals es-ike-proposal; # Reference the IKE proposal here.
pre-shared-key ascii-text "$ABC123";
## The unencrypted preshared key for this example is juniper.
}
}
}
firewall {
filter es-traffic { # Define a filter that sends traffic to the IPSec tunnel here.
term to-es {
from {
source-address {
10.1.12.0/24;
}
destination-address {
10.1.56.0/24;
}
}
then {
count ipsec-tunnel;
ipsec-sa sa-dynamic;
}
}
term other {
then accept;
}
}
filter es-return { # Define a filter that matches return IPSec traffic here.
term return {
from {
source-address {
10.1.56.0/24;
}
destination-address {
10.1.12.0/24;
}
}
then accept;
}
}
}
ルーター3では、ルーター2および4に接続するための基盤となるルーティングプロトコルとしてOSPFを有効にします。[edit security ipsec security-association]階層レベルで、sa-dynamic と呼ばれる双方向 IKE ダイナミック SA を設定します。ルーター 2 で使用したものと同じポリシーとプロポーザルを使用します。
IKEポリシーとプロポーザルでは、認証方法に事前共有鍵、認証アルゴリズムにSHA-1、暗号化に3DES-CBC、Diffie-Hellmanグループにはグループ2、メインモード、ライフタイムは3600秒、初期IKEネゴシエーションには ジュニパー の事前共有鍵を使用します。IPSec ポリシーとプロポーザルでは、プロトコルに ESP、認証に HMAC-SHA1-96、暗号化に 3DES-CBC、有効期間に 28800 秒、PFS グループにグループ 2 を使用します。
トラフィックを ES PIC および IPSec トンネルに転送するには、2 つのファイアウォール フィルタを作成します。 es-traffic フィルターは、ルーター 4 からのルーター 1 へのインバウンド トラフィックに一致し、 es-return フィルターは、ルーター 1 からルーター 4 へのリターン パスに一致します。 esトラフィック フィルターを so-0/0/0インターフェイス に適用します。次に、 es-return フィルターと sa-dynamic SA の両方を es-0/3/0 インターフェイスに適用します。
ルーター3
[edit]
interfaces {
so-0/0/0 {
description "To R4 so-0/0/0";
unit 0 {
family inet {
filter {
input es-traffic; # Apply a filter that sends traffic to the IPSec tunnel here.
}
address 10.1.56.1/30;
}
}
}
so-0/0/1 {
description "To R2 so-0/0/1";
unit 0 {
family inet {
address 10.1.15.2/30;
}
}
}
es-0/3/0 {
unit 0 {
tunnel { # Specify the IPSec tunnel endpoints here.
source 10.1.15.2;
destination 10.1.15.1;
}
family inet {
ipsec-sa sa-dynamic; # Apply the dynamic SA here.
filter {
input es-return; # Apply the filter that matches return IPSec traffic here.
}
}
}
}
lo0 {
unit 0 {
family inet {
address 10.0.0.3/32;
}
}
}
}
routing-options {
router-id 10.0.0.3;
}
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0.0;
interface so-0/0/1.0;
interface lo0.0;
}
}
}
security {
ipsec {
proposal es-ipsec-proposal { # Define your IPSec proposal specifications here.
protocol esp;
authentication-algorithm hmac-sha1-96;
encryption-algorithm 3des-cbc;
lifetime-seconds 28800;
}
policy es-ipsec-policy { # Define your IPSec policy specifications here.
perfect-forward-secrecy {
keys group2;
}
proposals es-ipsec-proposal; # Reference the IPSec proposal here.
}
security-association sa-dynamic { # Define your dynamic SA here.
mode tunnel;
dynamic {
ipsec-policy es-ipsec-policy; # Reference the IPSec policy here.
}
}
}
ike {
proposal es-ike-proposal { # Define your IKE proposal specifications here.
authentication-method pre-shared-keys;
dh-group group2;
authentication-algorithm sha1;
encryption-algorithm 3des-cbc;
lifetime-seconds 3600;
}
policy 10.1.15.1 { # Define your IKE policy specifications here.
mode main;
proposals es-ike-proposal; # Reference the IKE proposal here.
pre-shared-key ascii-text "$ABC123";
## The unencrypted preshared key for this example is juniper.
}
}
}
firewall {
filter es-traffic { # Define a filter that sends traffic to the IPSec tunnel here.
term to-es {
from {
source-address {
10.1.56.0/24;
}
destination-address {
10.1.12.0/24;
}
}
then {
count ipsec-tunnel;
ipsec-sa sa-dynamic;
}
}
term other {
then accept;
}
}
filter es-return { # Define a filter that matches return IPSec traffic here.
term return {
from {
source-address {
10.1.12.0/24;
}
destination-address {
10.1.56.0/24;
}
}
then accept;
}
}
}
ルーター 4 で、ルーター 3 への基本的な OSPF 接続を提供します。
ルーター4
[edit]
interfaces {
so-0/0/0 {
description "To R3 so-0/0/0";
unit 0 {
family inet {
address 10.1.56.2/30;
}
}
}
lo0 {
unit 0 {
family inet {
address 10.0.0.4/32;
}
}
}
}
routing-options {
router-id 10.0.0.4;
}
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0.0;
interface lo0.0;
}
}
}
機能の検証
ES PICでIKEベースの動的SAが正しく動作していることを確認するには、次のコマンドを使用します。
-
ピン
-
show ike security-associations (detail) -
show ipsec security-associations (detail) -
トレースルート
以下のセクションでは、設定例で使用されるこれらのコマンドの出力を示します。
ルーター1
ルーター1で、ルーター4のso-0/0/0インターフェイスにpingコマンドを発行し、IPsecトンネルを介してトラフィックを送信します。
user@R1> ping 10.1.56.2 PING 10.1.56.2 (10.1.56.2): 56 data bytes 64 bytes from 10.1.56.2: icmp_seq=0 ttl=253 time=0.917 ms 64 bytes from 10.1.56.2: icmp_seq=1 ttl=253 time=0.881 ms 64 bytes from 10.1.56.2: icmp_seq=2 ttl=253 time=0.897 ms 64 bytes from 10.1.56.2: icmp_seq=3 ttl=253 time=0.871 ms 64 bytes from 10.1.56.2: icmp_seq=4 ttl=253 time=0.890 ms 64 bytes from 10.1.56.2: icmp_seq=5 ttl=253 time=0.858 ms 64 bytes from 10.1.56.2: icmp_seq=6 ttl=253 time=0.904 ms ^C --- 10.1.56.2 ping statistics --- 7 packets transmitted, 7 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.858/0.888/0.917/0.019 ms
また、 traceroute コマンドを発行して、 10.1.56.2 へのトラフィックがルーター 2 とルーター 3 の間の IPsec トンネルを通過することを確認することもできます。2番目のホップは、ルーター3の物理インターフェイスである 10.1.15.2を参照していないことに注意してください。代わりに、ルーター 3 のループバック アドレス 10.0.0.3 が 2 番目のホップとして表示されます。これは、IPSec トンネルが正常に動作していることを示します。
user@R1> traceroute 10.1.56.2 traceroute to 10.1.56.2 (10.1.56.2), 30 hops max, 40 byte packets 1 10.1.12.1 (10.1.12.1) 0.655 ms 0.549 ms 0.508 ms 2 10.0.0.3 (10.0.0.3) 0.833 ms 0.786 ms 0.757 ms
3 10.1.56.2 (10.1.56.2) 0.808 ミリ秒 0.741 ミリ秒 0.716 ミリ秒
ルーター2
一致したトラフィックが双方向IPsecトンネルに迂回されていることを確認するには、ファイアウォール フィルター カウンターを表示する方法があります。ルーター1から ping コマンド(7パケット)を発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R2> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 588 7
ルーター1(7パケット)とルーター4(5パケット)の両方から ping コマンドを発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R2> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 1008 12
ルーター 2 とルータ 3 間の IKE SA ネゴシエーションが成功したことを確認するには、 show ike security-associations detail コマンドを発行します。SA には、認証アルゴリズムの SHA-1、暗号化アルゴリズムの 3DES-CBC など、指定した設定が含まれていることに注意してください。
user@R2> show ike security-associations detail IKE peer 10.1.15.2 Role: Initiator, State: Matured Initiator cookie: b5dbdfe2f9000000, Responder cookie: a24c868410000041 Exchange type: Main, Authentication method: Pre-shared-keys Local: 10.1.15.1:500, Remote: 10.1.15.2:500 Lifetime: Expires in 401 seconds Algorithms: Authentication : sha1 Encryption : 3des-cbc Pseudo random function: hmac-sha1 Traffic statistics: Input bytes : 1736 Output bytes : 2652 Input packets: 9 Output packets: 15 Flags: Caller notification sent IPSec security associations: 3 created, 0 deleted Phase 2 negotiations in progress: 0
IPsecセキュリティアソシエーションがアクティブであることを確認するには、 show ipsec security-associations detail コマンドを発行します。SA には、プロトコルの ESP、認証アルゴリズムの HMAC-SHA1-96、暗号化アルゴリズムの 3DES-CBC など、指定した設定が含まれていることに注意してください。
user@R2> show ipsec security-associations detail
Security association: sa-dynamic, Interface family: Up
Local gateway: 10.1.15.1, Remote gateway: 10.1.15.2
Local identity: ipv4_subnet(any:0,[0..7]=10.1.12.0/24)
Remote identity: ipv4_subnet(any:0,[0..7]=10.1.56.0/24)
Direction: inbound, SPI: 2133029543, AUX-SPI: 0
Mode: tunnel, Type: dynamic, State: Installed
Protocol: ESP, Authentication: hmac-sha1-96, Encryption: 3des-cbc
Soft lifetime: Expires in 26212 seconds
Hard lifetime: Expires in 26347 seconds
Anti-replay service: Disabled
Direction: outbound, SPI: 1759450863, AUX-SPI: 0
Mode: tunnel, Type: dynamic, State: Installed
Protocol: ESP, Authentication: hmac-sha1-96, Encryption: 3des-cbc
Soft lifetime: Expires in 26212 seconds
Hard lifetime: Expires in 26347 seconds
Anti-replay service: Disabled
ルーター3
ファイアウォール フィルター カウンターを表示して、一致したトラフィックが双方向 IPsec トンネルに迂回されていることの確認を続けます。ルーター1から ping コマンド(7パケット)を発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R3> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 588 7
ルーター1(7パケット)とルーター4(5パケット)の両方から ping コマンドを発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R3> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 1008 12
IKEセキュリティアソシエーションの成功を確認するには、 show ike security-associations detail コマンドを発行します。ルーター 3 の SA には、ルーター 2 で指定したものと同じ設定が含まれていることに注意してください。
user@R3> show ike security-associations detail IKE peer 10.1.15.1 Role: Responder, State: Matured Initiator cookie: b5dbdfe2f9000000, Responder cookie: a24c868410000041 Exchange type: Main, Authentication method: Pre-shared-keys Local: 10.1.15.2:500, Remote: 10.1.15.1:500 Lifetime: Expires in 564 seconds Algorithms: Authentication : sha1 Encryption : 3des-cbc Pseudo random function: hmac-sha1 Traffic statistics: Input bytes : 2652 Output bytes : 1856 Input packets: 15 Output packets: 10 Flags: Caller notification sent IPSec security associations: 3 created, 4 deleted Phase 2 negotiations in progress: 0
IPsecセキュリティアソシエーションがアクティブであることを確認するには、 show ipsec security-associations detail コマンドを発行します。ルーター 3 の SA には、ルーター 2 で指定したものと同じ設定が含まれていることに注意してください。
user@R3> show ipsec security-associations detail
Security association: sa-dynamic, Interface family: Up
Local gateway: 10.1.15.2, Remote gateway: 10.1.15.1
Local identity: ipv4_subnet(any:0,[0..7]=10.1.56.0/24)
Remote identity: ipv4_subnet(any:0,[0..7]=10.1.12.0/24)
Direction: inbound, SPI: 1759450863, AUX-SPI: 0
Mode: tunnel, Type: dynamic, State: Installed
Protocol: ESP, Authentication: hmac-sha1-96, Encryption: 3des-cbc
Soft lifetime: Expires in 26427 seconds
Hard lifetime: Expires in 26517 seconds
Anti-replay service: Disabled
Direction: outbound, SPI: 2133029543, AUX-SPI: 0
Mode: tunnel, Type: dynamic, State: Installed
Protocol: ESP, Authentication: hmac-sha1-96, Encryption: 3des-cbc
Soft lifetime: Expires in 26427 seconds
Hard lifetime: Expires in 26517 seconds
Anti-replay service: Disabled
ルーター4
ルーター4では、ルーター1のso-0/0/0インターフェイスにpingコマンドを発行して、IPsecトンネルを介してトラフィックを送信します。
user@R4> ping 10.1.12.2 user@R4> ping 10.1.12.2 PING 10.1.12.2 (10.1.12.2): 56 data bytes 64 bytes from 10.1.12.2: icmp_seq=0 ttl=253 time=13.528 ms 64 bytes from 10.1.12.2: icmp_seq=1 ttl=253 time=0.873 ms 64 bytes from 10.1.12.2: icmp_seq=2 ttl=253 time=32.145 ms 64 bytes from 10.1.12.2: icmp_seq=3 ttl=253 time=0.921 ms 64 bytes from 10.1.12.2: icmp_seq=4 ttl=253 time=0.899 ms ^C --- 10.1.12.2 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.873/9.673/32.145/12.255 ms
また、 traceroute コマンドを発行して、 10.1.12.2 へのトラフィックがルーター 3 とルーター 2 の間の IPsec トンネルを通過することを確認することもできます。2番目のホップは 10.1.15.1(ルーター2の物理インターフェイス)を参照していないことに注意してください。代わりに、ルーター 2 のループバック アドレス 10.0.0.2 が 2 番目のホップとして表示されます。これは、IPSec トンネルが正常に動作していることを示します。
user@R4> traceroute 10.1.12.2 traceroute to 10.1.12.2 (10.1.12.2), 30 hops max, 40 byte packets 1 10.1.56.1 (10.1.56.1) 0.681 ms 0.624 ms 0.547 ms 2 10.0.0.2 (10.0.0.2) 0.800 ms 0.770 ms 0.737 ms 3 10.1.12.2 (10.1.12.2) 0.793 ms 0.742 ms 0.716 ms