Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

4.6.7. IKEv2 リモートアクセス VPN Libreswan の設定

ロードウォーリアーとは、外出先などで、ノート PC など、動的に IP アドレスが割り当てられたモバイルクライアントを使用するユーザーを指します。これらは証明書を使用して認証されます。古い IKEv1 XAUTH プロトコルを使用する必要がないように、次の例では IKEv2 を使用しています。
サーバーの場合:
conn roadwarriors
    ikev2=insist
    # Support (roaming) MOBIKE clients (RFC 4555)
    mobike=yes
    fragmentation=yes
    left=1.2.3.4
    # if access to the LAN is given, enable this, otherwise use 0.0.0.0/0
    # leftsubnet=10.10.0.0/16
    leftsubnet=0.0.0.0/0
    leftcert=vpn-server.example.com
    leftid=%fromcert
    leftxauthserver=yes
    leftmodecfgserver=yes
    right=%any
    # trust our own Certificate Agency
    rightca=%same
    # pick an IP address pool to assign to remote users
    # 100.64.0.0/16 prevents RFC1918 clashes when remote users are behind NAT
    rightaddresspool=100.64.13.100-100.64.13.254
    # if you want remote clients to use some local DNS zones and servers
    modecfgdns="1.2.3.4, 5.6.7.8"
    modecfgdomains="internal.company.com, corp"
    rightxauthclient=yes
    rightmodecfgclient=yes
    authby=rsasig
    # optionally, run the client X.509 ID through pam to allow/deny client
    # pam-authorize=yes
    # load connection, don't initiate
    auto=add
    # kill vanished roadwarriors
    dpddelay=1m
    dpdtimeout=5m
    dpdaction=%clear
詳細は以下のようになります。
left=1.2.3.4
1.2.3.4 の値は、サーバーの実際の IP アドレスまたはホスト名を指定します。
leftcert=vpn-server.example.com
このオプションは、証明書をインポートする際に使用されたそのフレンドリーネームまたはニックネームを参照する証明書を指定します。通常、名前は .p12 ファイルの形式で PKCS #12 証明書バンドルの一部として生成されます。詳細は、pkcs12(1)pk12util(1) の man ページを参照してください。
ロードウォーリアーのデバイスであるモバイルクライアントでは、上記の設定に多少変更を加えて使用します。
conn to-vpn-server
    ikev2=insist
    # pick up our dynamic IP
    left=%defaultroute
    leftsubnet=0.0.0.0/0
    leftcert=myname.example.com
    leftid=%fromcert
    leftmodecfgclient=yes
    # right can also be a DNS hostname
    right=1.2.3.4
    # if access to the remote LAN is required, enable this, otherwise use 0.0.0.0/0
    # rightsubnet=10.10.0.0/16
    rightsubnet=0.0.0.0/0
    # trust our own Certificate Agency
    rightca=%same
    authby=rsasig
    # allow narrowing to the server’s suggested assigned IP and remote subnet
    narrowing=yes
    # Support (roaming) MOBIKE clients (RFC 4555)
    mobike=yes
    # Initiate connection
    auto=start
詳細は以下のようになります。
auto=start
このオプションを使用すると、ユーザーは、ipsec システムサービスが開始されるたびに VPN に接続することがきます。後で接続を確立する場合は、auto=add に置き換えます。