IPsec設定だが暗号化なし
Ciscoルーターを用いたサイト間VPNにて、IPsec設定を行うのだが、暗号化なしの状況を確認。世の中的には、”Null Encryption”と呼ぶそうだ。
環境
ルーターR1およびR2にてVPN(IPsecトンネル)を作成、ただし暗号化なし。IPsecトンネルを通じて、両端のPCが疎通を行う。
設定
PC
- PC1:192.168.1.1/24, Gateway:192.168.1.254
- PC2:192.168.2.1/24, Gateway:192.168.2.254
ルーターR1およびR2
ここでは、R1の設定を記載(R2もほぼ同じ)。参考のため、暗号化時の設定も一部記載する。
共通設定
非暗号化時および暗号化時でも同じとなる設定を記載(関連する部分のみ)。後述する、暗号化方式設定以外は共通となる。
crypto isakmp key testpwd address 10.1.1.2
!
crypto map To_R2 11 ipsec-isakmp
set peer 10.1.1.2
set transform-set IPSEC-TEST
match address 100
!
interface FastEthernet0/0
ip address 10.1.1.1 255.255.255.0
crypto map To_R2
!
interface FastEthernet1/0
ip address 192.168.1.254 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
!
access-list 100 permit ip any any
設定内容の詳細については、「久しぶりにGNS3(その4:トンネリング:IPsec)」を参照。
暗号化時の設定
参考までに、暗号化時の暗号化方式の設定も記す。
crypto isakmp policy 11
encr aes
authentication pre-share
group 2
crypto ipsec transform-set IPSEC-TEST esp-aes esp-sha-hmac
非暗号化時の設定(ESP利用)
crypto isakmp policy 11
authentication pre-share
group 2
crypto ipsec transform-set IPSEC-TEST esp-null esp-md5-hmac
おそらくであるが、isakmpポリシーでEncryptionを指定しないこと、およびIPsec設定にて”esp-null”を指定することがポイントなのであろう。
非暗号化時の設定(AH利用)
crypto isakmp policy 11
authentication pre-share
group 2
crypto ipsec transform-set IPSEC-TEST ah-md5-hmac
こちは、IPsec設定にて、AHを指定している。
検証
PC2からPC1へping実行する。
PC2> ping 192.168.1.1 -c 10
192.168.1.1 icmp_seq=1 timeout
192.168.1.1 icmp_seq=2 timeout
192.168.1.1 icmp_seq=3 timeout
192.168.1.1 icmp_seq=4 timeout
192.168.1.1 icmp_seq=5 timeout
192.168.1.1 icmp_seq=6 timeout
192.168.1.1 icmp_seq=7 timeout
84 bytes from 192.168.1.1 icmp_seq=8 ttl=62 time=39.773 ms
84 bytes from 192.168.1.1 icmp_seq=9 ttl=63 time=67.051 ms
84 bytes from 192.168.1.1 icmp_seq=10 ttl=63 time=35.534 ms
この時の状況を下記する。
Wiresharkの設定
Wiresharkにて、”Protocol Preferences --> Encapsulating Security Payload”の”Attempt to detect/decode NULL encrypted ESP payloads”をチェックすると、非暗号化パケットもデコードするようだ。
ESP
Wiresharkの状況。ESPパケット内に、ICMPパケットが見える(暗号化されていない)。
Router1でのSAの状況は下記。
R1#show crypto ipsec sa
interface: FastEthernet0/0
Crypto map tag: To_R2, local addr 10.1.1.1
protected vrf: (none)
local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
current_peer 10.1.1.2 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 9, #pkts encrypt: 9, #pkts digest: 9
#pkts decaps: 10, #pkts decrypt: 10, #pkts verify: 10
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 10.1.1.1, remote crypto endpt.: 10.1.1.2
path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/0
current outbound spi: 0x69ED5320(1777160992)
inbound esp sas:
spi: 0xA55F18B3(2774472883)
transform: esp-null esp-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: To_R2
sa timing: remaining key lifetime (k/sec): (4531030/3528)
IV size: 0 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas:
spi: 0x69ED5320(1777160992)
transform: esp-null esp-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: To_R2
sa timing: remaining key lifetime (k/sec): (4531030/3527)
IV size: 0 bytes
replay detection support: Y
Status: ACTIVE
outbound ah sas:
outbound pcp sas:
AH
Wiresharkの状況。ICMPパケットの前に、AHヘッダが見える(暗号化されていない)。
Router1でのSAの状況は下記。
R1#show crypto ipsec sa
interface: FastEthernet0/0
Crypto map tag: To_R2, local addr 10.1.1.1
protected vrf: (none)
local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
current_peer 10.1.1.2 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 3, #pkts encrypt: 3, #pkts digest: 3
#pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 10.1.1.1, remote crypto endpt.: 10.1.1.2
path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/0
current outbound spi: 0x2685778D(646281101)
inbound esp sas:
inbound ah sas:
spi: 0xF53705E1(4114023905)
transform: ah-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: To_R2
sa timing: remaining key lifetime (k/sec): (4462698/3528)
replay detection support: Y
Status: ACTIVE
inbound pcp sas:
outbound esp sas:
outbound ah sas:
spi: 0x2685778D(646281101)
transform: ah-md5-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: To_R2
sa timing: remaining key lifetime (k/sec): (4462698/3527)
replay detection support: Y
Status: ACTIVE
outbound pcp sas:
参考URL
EOF