例:ES PIC マニュアル SA 設定
図 1 は、4 台のルーターのグループを含む IPSec トポロジを示しています。ルーター 2 および 3 は、ES PIC と手動 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-manual と呼ばれる双方向手動 SA を設定します。プロトコルにはAH、SPI には 400、認証には HMAC-MD5-96、MD5 認証キーには 32 ビットの 16 進認証キーを使用します。(キーの長さの詳細については、「認証と暗号化キーの長さ」を参照してください)。AH を使用しているため、暗号化を構成する必要はありません。
トラフィックを ES PIC および IPSec トンネルに転送するには、2 つのファイアウォール フィルタを作成します。 es-traffic フィルターは、ルーター 1 からのルーター 4 宛てのインバウンド トラフィックに一致し、 es-return フィルターは、ルーター 4 からルーター 1 へのリターン パスに一致します。 esトラフィック フィルターを so-0/0/0インターフェイス に適用します。次に、 es-return フィルターと sa-manual 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-manual; # Apply the manual 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 {
security-association sa-manual { # Define the manual SA specifications here.
mode tunnel;
manual {
direction bidirectional {
protocol ah;
spi 400;
authentication {
algorithm hmac-md5-96;
key hexadecimal "$ABC123”;
}
}
}
}
}
}
# The 32-bit unencrypted hexadecimal key is abcdef01abcdef01abcdef01abcdef01.
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-manual;
}
}
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-manualと呼ばれる双方向手動SAを設定します。ルーター 2 の SA に使用したのとまったく同じ仕様を使用します。プロトコルに AH、SPI に 400、認証に HMAC-MD5-96、MD5 認証キーに abcdef01abcdef01abcdef01 の 32 ビット 16 進認証キーを使用します。(認証キーの長さの詳細については、「認証と暗号化キーの長さ」を参照してください)。AH を使用しているため、暗号化アルゴリズムを設定する必要はありません。
トラフィックを ES PIC および IPSec トンネルに転送するには、2 つのファイアウォール フィルタを作成します。 es-traffic フィルターは、ルーター 4 からのルーター 1 へのインバウンド トラフィックに一致し、 es-return フィルターは、ルーター 1 からルーター 4 へのリターン パスに一致します。 esトラフィック フィルターを so-0/0/0インターフェイス に適用します。次に、 es-return フィルターと sa-manual 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-manual; # Apply the manual 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 {
security-association sa-manual { # Define the manual SA specifications here.
mode tunnel;
manual {
direction bidirectional {
protocol ah;
spi 400;
authentication {
algorithm hmac-md5-96;
key hexadecimal "$ABC123”;
}
}
}
}
}
}
## The 32-bit unencrypted hexadecimal key is abcdef01abcdef01abcdef01abcdef01.
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-manual;
}
}
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.ping
}
}
}
機能の検証
ES PIC で手動 IPSec SA が正しく動作していることを確認するには、次のコマンドを使用します。
-
ピン
-
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.939 ms 64 bytes from 10.1.56.2: icmp_seq=1 ttl=253 time=0.886 ms 64 bytes from 10.1.56.2: icmp_seq=2 ttl=253 time=0.826 ms ^C --- 10.1.56.2 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.826/0.884/0.939/0.046 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 ms 0.741 ms 0.716 ms
ルーター2
一致したトラフィックが双方向IPsecトンネルに迂回されていることを確認するには、ファイアウォール フィルター カウンターを表示する方法があります。ルーター1から ping コマンド(3パケット)を発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R2> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 252 3
ルーター1(3パケット)とルーター4(2パケット)の両方から ping コマンドを発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R2> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 420 5
IPsecセキュリティアソシエーションがアクティブであることを確認するには、 show ipsec security-associations detail コマンドを発行します。SA には、プロトコルの AH や認証アルゴリズムの HMAC-MD5-96 など、指定した設定が含まれていることに注意してください。
user@R2> show ipsec security-associations detail
Security association: sa-manual, Interface family: Up
Local gateway: 10.1.15.1, Remote gateway: 10.1.15.2
Local identity: ipv4_subnet(any:0,[0..7]=0.0.0.0/0)
Remote identity: ipv4_subnet(any:0,[0..7]=0.0.0.0/0)
Direction: inbound, SPI: 400, AUX-SPI: 0
Mode: tunnel, Type: manual, State: Installed
Protocol: AH, Authentication: hmac-md5-96, Encryption: None
Anti-replay service: Disabled
Direction: outbound, SPI: 400, AUX-SPI: 0
Mode: tunnel, Type: manual, State: Installed
Protocol: AH, Authentication: hmac-md5-96, Encryption: None
Anti-replay service: Disabled
ルーター3
ファイアウォール フィルター カウンターを表示して、一致したトラフィックが双方向 IPsec トンネルに迂回されていることの確認を続けます。ルーター1から ping コマンド(3パケット)を発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R3> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 252 3
ルーター1(3パケット)とルーター4(2パケット)の両方から ping コマンドを発行すると、 es-traffic ファイアウォールフィルターカウンターは次のようになります。
user@R3> show firewall filter es-traffic Filter: es-traffic Counters: Name Bytes Packets ipsec-tunnel 420 5
IPsecセキュリティアソシエーションがアクティブであることを確認するには、 show ipsec security-associations detail コマンドを発行します。ルーター 3 の SA には、ルーター 2 で指定したものと同じ設定が含まれていることに注意してください。
user@R3> show ipsec security-associations detail
Security association: sa-manual, Interface family: Up
Local gateway: 10.1.15.2, Remote gateway: 10.1.15.1
Local identity: ipv4_subnet(any:0,[0..7]=0.0.0.0/0)
Remote identity: ipv4_subnet(any:0,[0..7]=0.0.0.0/0)
Direction: inbound, SPI: 400, AUX-SPI: 0
Mode: tunnel, Type: manual, State: Installed
Protocol: AH, Authentication: hmac-md5-96, Encryption: None
Anti-replay service: Disabled
Direction: outbound, SPI: 400, AUX-SPI: 0
Mode: tunnel, Type: manual, State: Installed
Protocol: AH, Authentication: hmac-md5-96, Encryption: None
Anti-replay service: Disabled
ルーター4
ルーター4では、ルーター1のso-0/0/0インターフェイスにpingコマンドを発行して、IPsecトンネルを介してトラフィックを送信します。
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=0.937 ms 64 bytes from 10.1.12.2: icmp_seq=1 ttl=253 time=0.872 ms ^C --- 10.1.12.2 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.872/0.905/0.937/0.032 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.670 ms 0.589 ms 0.548 ms 2 10.0.0.2 (10.0.0.2) 0.815 ms 0.791 ms 0.763 ms 3 10.1.12.2 (10.1.12.2) 0.798 ms 0.741 ms 0.714 ms