今回は、 NAT-Traversalなやつです。 ルーターがespとかudp500とかudp4500を固定的に割り当ててくれなくても大丈夫なやつです。
この構成だと、Side-B 側がかならずinitiatorになります。 Side-Aから接続しにいっても500番ポートとか開いてませんので。
Site-A はグローバルIPアドレスを所持。 Site-B はグローバルIPアドレスを持った機器の配下にぶら下がっている機器がNAPTでインターネットに出られるような構成でSite-A - Site-B のIPSec Tunnelを張ります。
(SecmentA)Site-A[GlobalPv4Address] -- Internet -- [GlobalIPv4Address]Router[LocalIPv4Address] - [LocalIPv4AddressSite-B(SegmentB)
ここで Site-A ===tunnel=== Site-B でトンネルを張ってSegmentAとSegmentBの通信を行います。
(192.168.100.0/24)Site-A[200.0.0.2] -- [200.0.0.1]Router[192.168.10.1/24] - [DHCP]SiteB(192.168.200.0/24)
こんな感じとしましょう。
設定
Route
ip dhcp pool test network 192.168.10.0 255.255.255.0 default-router 192.168.10.1 lease 30 interface GigabitEthernet0/0/0 ip address 192.168.10.1 255.255.255.0 ip nat inside interface GigabitEthernet0/0/1 ip address 200.0.0.1 255.255.255.0 ip nat outside ip nat inside source list 10 interface FastEthernet0/1 overload access-list 10 permit 192.168.10.0 0.0.0.255
Site-A
crypto isakmp policy 1 encr aes authentication pre-share group 2 crypto isakmp key cisco address 200.0.0.1 crypto ipsec transform-set IPSEC-SET esp-aes esp-sha-hmac crypto ipsec profile VTI-PROFILE set transform-set IPSEC-SET set pfs group2 interface Tunnel1 ip unnumbered FastEthernet0/0 ip ospf 1 area 0 tunnel source FastEthernet0/0 tunnel destination 200.0.0.1 tunnel mode ipsec ipv4 tunnel protection ipsec profile VTI-PROFILE interface GigaibitEthernet 0/0/0 ip address 200.0.0.2 255.255.255.0 interface GigabitEthernet 0/0/ ip address 192.168.100.1 255.255.255.0 ip ospf 1 area 0
Site-B
crypto isakmp policy 1 encr aes authentication pre-share group 2 crypto isakmp key cisco address 200.0.0.2 crypto ipsec transform-set IPSEC esp-aes esp-sha-hmac crypto ipsec profile VTI set transform-set IPSEC set pfs group2 interface Tunnel1 ip unnumbered FastEthernet0/0 ip ospf 1 area 0 tunnel source FastEthernet0/0 tunnel destination 200.0.0.2 tunnel mode ipsec ipv4 tunnel protection ipsec profile VTI interface GigabitEthernet0/1 ip address dhcp interface GigabitEthernet0/2 ip address 192.168.200.1 255.255.255.0 ip ospf 1 area 0
実験
上記設定を見ると、Side-A側からみると、Side-B側の対向端末は特定できていないことに気づきます。
例えば下記のような設定を持つSide-B-2 みたいなのを用意したらどうなるのかという問題です。
Side-B-2
crypto isakmp policy 1 encr aes authentication pre-share group 2 crypto isakmp key cisco address 200.0.0.2 crypto ipsec transform-set IPSEC esp-aes esp-sha-hmac crypto ipsec profile VTI set transform-set IPSEC set pfs group2 interface Tunnel1 ip unnumbered FastEthernet0/0 ip ospf 1 area 0 tunnel source FastEthernet0/0 tunnel destination 200.0.0.2 tunnel mode ipsec ipv4 tunnel protection ipsec profile VTI interface GigabitEthernet0/1 ip address dhcp interface GigabitEthernet0/2 ip address 192.168.210.1 255.255.255.0 ip ospf 1 area 0
試しに足してみましょう。
(SecmentA)Site-A[GlobalPv4Address] -- Internet -- [GlobalIPv4Address]Router[LocalIPv4Address] - [LocalIPv4AddressSite-B(SegmentB) - [LocalIPv4AddressSite-B-2(SegmentC)
すると、 Routerでは
#sh ip nat translations Pro Inside global Inside local Outside local Outside global udp 200.0.0.1:1 192.168.10.2:500 200.0.0.2:500 200.0.0.2:500 udp 200.0.0.1:4500 192.168.10.2:4500 200.0.0.2:4500 200.0.0.2:4500 udp 200.0.0.1:1024 192.168.10.3:4500 200.0.0.2:4500 200.0.0.2:4500
例えばこんなnatテーブルが出来上がります。
(10.2=Side-B, 10.3=side-B-2)
Side-A 側では
#sh ip ospf nei Neighbor ID Pri State Dead Time Address Interface 192.168.10.2 0 FULL/ - 00:00:30 192.168.10.2 Tunnel1 #sh ip ospf nei Neighbor ID Pri State Dead Time Address Interface 192.168.10.3 0 FULL/ - 00:00:37 192.168.10.4 Tunnel1
と、ospf のneighborが変わりました。
既にIPSecでつながっている状態でさらに割り込もうとすると、後から接続しにいったほうとIPSecを張り直します。 のでこのようなことに。
どうでもいいこと
ResponderをPaloaltoにしようとすると、Initiator 側のローカルIPアドレスを固定する必要があります。
Live Community - IPSec VPN Tunnel with NAT Traversal - Live Community