IPsec 設定例 2

一方が複数のアドレス、もう一方が1個のアドレスを持つとき


概要

一方のルータが複数のグローバルアドレスを割り当てられていて、 もう一方のルータが1個のグローバルアドレスを割り当てられているときの設定例です。 1個のアドレスしか持っていないルータでは、ルータとすべての端末が、 そのアドレスを共有することになります。NATの設定に注意してください。

構成図

        インターネットへ                              インターネットへ
              |                                             |
              | 1.5Mbit/s専用線                             | 64kbit/s専用線
              |                                             |
              | アドレス: 固定                              | アドレス: 固定
              | 172.16.0.0/24                               | 172.17.0.1
              |                                             |
     +--------+--------+                           +--------+--------+
     |                 | <########  VPN  ########> |                 |
     |     ルータ1     |                           |     ルータ2     |
     |  名前:router1   |    暗号方式: 3DES-CBC     |  名前:router2   |
     |                 |    認証方式: HMAC-SHA1    |                 |
     +--------+--------+                           +--------+--------+
              | 192.168.0.1/24                              | 192.168.1.1/24
              |                                             |
              |                                             |
     ---------+---- 192.168.0.0/24                 ---------+---- 192.168.1.0/24

設定例

Rev.6.02系のファームウェアの設定例です。

[ルータ1の設定例]

#
# WAN line type
#
line type pri1 leased
pri leased channel 1/1 1 24
#
# LAN1 interface
#
ip lan1 address 192.168.0.1/24
#
# PP interface
#
pp select 1
pp bind pri1/1
ip route default gateway pp 1
ppp ccp type none
pp auth accept pap chap
pp auth myname NAME PASSWORD
ip pp address 172.16.0.1
ip pp nat descriptor 1
pp enable 1
#
# IKE
#
ipsec auto refresh on
ipsec ike local address 1 172.16.0.1
ipsec ike remote address 1 172.17.0.1
ipsec ike pre-shared-key 1 text himitsu
ipsec sa policy 101 1 esp 3des-cbc sha-hmac
#
# TUNNEL interface
#
tunnel select 1
ipsec tunnel 101
ip route 192.168.1.0/24 gateway tunnel 1
tunnel enable 1
#
# NAT descriptor
#
nat descriptor type 1 nat-masquerade
nat descriptor address outer 1 172.16.0.2-172.16.0.254
nat descriptor address inner 1 192.168.0.1-192.168.0.254

[ルータ2の設定例]

#
# WAN line type
#
bri line 1 l64
#
# LAN1 interface
#
ip lan1 address 192.168.1.1/24
#
# PP interface
#
pp select 1
pp bind bri1
ip route default gateway pp 1
ppp ccp type none
pp auth accept pap chap
pp auth myname NAME PASSWORD
ip pp address 172.17.0.1
ip pp nat descriptor 1
pp enable 1
#
# IKE
#
ipsec auto refresh on
ipsec ike local address 1 172.17.0.1
ipsec ike remote address 1 172.16.0.1
ipsec ike pre-shared-key 1 text himitsu
ipsec sa policy 101 1 esp 3des-cbc sha-hmac
#
# TUNNEL interface
#
tunnel select 1
ipsec tunnel 101
ip route 192.168.0.0/24 gateway tunnel 1
tunnel enable 1
#
# NAT descriptor
#
nat descriptor type 1 masquerade
nat descriptor address outer 1 172.17.0.1
nat descriptor address inner 1 172.17.0.1 192.168.1.1-192.168.1.254
nat descriptor masquerade static 1 1 172.17.0.1 udp 500
nat descriptor masquerade static 1 2 172.17.0.1 esp *

設定例集のトップページへ