【Cisco/VyOS】Windows11 L2TP/IPsec を使用した VPN リモートアクセス (User/Password 認証)

接続構成

Windows 11 端末から NAT 配下のサーバにアクセスするため、L2TP/IPsec を用いて同一の LAN セグメントに接続する。各パラメータは Windows 11 標準の VPN クライアントで利用可能なものを使用する。

IKE バージョンIKEv1
IKE ネゴシエーションMain Mode
暗号アルゴリズムAES256-CBC
鍵交換アルゴリズムDiffie-Hellman Group 14 (MODP 2048)
認証アルゴリズムHMAC-SHA1-96
認証方式Pre-Shared Key
キープアライブ (DPD)Disabled
NAT TraversalIKE セッションが NAT されないため該当しない
ライフタイム28800 (8時間)
MTU1400
IKE ネゴシエーション (IKE Phase1)
暗号アルゴリズムAES128-CBC
認証アルゴリズムHMAC-SHA1-96
暗号プロトコルESP
通信モードTransport Mode
PFS (鍵交換アルゴリズム)無効
ライフタイム3600 (1時間)
IPsec ネゴシエーション (IKE Phase2)
通信プロトコルPPP
認証プロトコルMS-CHAPv2
払い出し IP 範囲 (IPCP)192.168.0.1 – 192.168.0.31
L2TP トンネル(IPsec内部)
IKE 暗号スイートIKE:AES_CBC_256/HMAC_SHA1_96/PRF_HMAC_SHA1/ECP_384
IKE:AES_CBC_128/HMAC_SHA1_96/PRF_HMAC_SHA1/ECP_256
IKE:AES_CBC_256/HMAC_SHA1_96/PRF_HMAC_SHA1/MODP_2048
IKE:3DES_CBC/HMAC_SHA1_96/PRF_HMAC_SHA1/MODP_2048
IKE:3DES_CBC/HMAC_SHA1_96/PRF_HMAC_SHA1/MODP_1024
IKE ライフタイム28800 (8時間)
ESP 暗号スイートESP:AES_CBC_128/HMAC_SHA1_96/NO_EXT_SEQ
ESP:3DES_CBC/HMAC_SHA1_96/NO_EXT_SEQ
ESP:DES_CBC/HMAC_SHA1_96/NO_EXT_SEQ
ESP ライフタイム3600 (1時間)
MTU1400
Windows 11 端末側情報

VyOS (1.5 系)のコンフィグ例

【enable-proxy-arp】を忘れると同セグメント間通信ができない事に注意。

interfaces {
    ethernet eth0 {
        address 10.0.0.254/24
    }
    ethernet eth1 {
        address 192.168.0.254/24
        ip {
            enable-proxy-arp
        }
    }
}
nat {
    source {
        rule 1 {
            outbound-interface eth0
            source {
                address 192.168.0.0/24
            }
            translation {
                address masquerade
            }
        }
    }
}
vpn {
    ipsec {
        esp-group esp-01 {
            mode transport
            pfs disable
        }
        ike-group ike-01 {
            proposal 1 {
                dh-group 14
                encryption 256
            }
        }
        interface eth0
    }
    l2tp {
        remote-access {
            authentication {
                local-users {
                    username user-01 {
                        password password123
                    }
                }
                protocols mschap-v2
            }
            client-ip-pool pool-01 {
                range 192.168.0.1-192.168.0.31
            }
            default-pool pool-01
            gateway-address 192.168.0.254
            ipsec-settings {
                authentication {
                    mode pre-shared-secret
                    pre-shared-secret secret123
                }
                esp-group esp-01
                ike-group ike-01
            }
            mtu 1400
            outside-address 10.0.0.254
        }
    }
}

Cisco IOS 15.3 ルータのコンフィグ例

Cisco はデフォルトで【ip proxy-arp】が有効。上記の同等の構成での設定例。
※ IOS のバージョンによって【Virtual-Template 1】のタイプが Tunnel 固定になっているため、 【Virtual-Template 2 type serial】を使用する。

aaa new-model
aaa authentication ppp ppp-auth local
vpdn enable
!
vpdn-group ppp-dial
 accept-dialin
  protocol l2tp
  virtual-template 2
 no l2tp tunnel authentication
!
username user-01 password 0 password123
!
crypto isakmp policy 1
 encr aes 256
 authentication pre-share
 group 14
 lifetime 28800
crypto isakmp key secret123 address 0.0.0.0 no-xauth
!
crypto ipsec transform-set l2tp-ts esp-aes esp-sha-hmac 
 mode transport
!
crypto dynamic-map l2tp-dmap 1
 set transform-set l2tp-ts
!
crypto map l2tp-cmap 1 ipsec-isakmp dynamic l2tp-dmap
!
interface Ethernet0
 ip address 10.0.0.254 255.255.255.0
 ip nat outside
 crypto map l2tp-cmap
!
interface Ethernet1
 ip address 192.168.0.254 255.255.255.0
 ip nat inside
!
interface Virtual-Template2 type serial
 mtu 1400
 ip unnumbered Ethernet1
 ip nat inside
 peer default ip address pool ppp-pool
 ppp authentication ms-chap-v2 ppp-auth
!
ip local pool ppp-pool 192.168.0.1 192.168.0.31
ip nat inside source list 1 interface Ethernet0 overload
access-list 1 permit 192.168.0.0 0.0.0.255

Windows 11 の VPN クライアント設定

Windows の設定から以下の VPN 接続を追加する。

接続プロバイダーWindows (ビルトイン)
サーバ名またはアドレス10.0.0.254
VPN の種類事前共有キーを使った L2TP/IPsec
サインイン情報の種類ユーザ名とパスワード
VPN の接続設定

VPN の接続を作成後、ネットワークアダプタが追加されているため、プロパティから設定を変更する。

セキュリティタブデータ暗号化暗号化が必要(サーバが拒否する場合は切断します)
セキュリティタブ認証●次のプロトコルを許可する
☑Microsoft CHAP Version 2 (MS-CHAP v2)
ネットワークタブインターネット プロトコル
バージョン 4
詳細設定
☐リモートネットワークでデフォルトゲートウェイを使う ※チェックを外す
ネットワークアダプタの設定

設定情報

PS > Get-VpnConnection
Name                  : vpn-01_l2tp
ServerAddress         : 10.0.0.254
AllUserConnection     : False
Guid                  : {********-****-****-****-************}
TunnelType            : L2tp
AuthenticationMethod  : {MsChapv2}
EncryptionLevel       : Required
L2tpIPsecAuth         : Psk
UseWinlogonCredential : False
EapConfigXmlStream    :
ConnectionStatus      : Disconnected
RememberCredential    : True
SplitTunneling        : True
DnsSuffix             :
IdleDisconnectSeconds : 0

接続時の状態

PS > Get-NetIPsecMainModeSA
Name                                : 55
LocalEndpoint                       : 10.0.0.1
RemoteEndpoint                      : 10.0.0.254
LocalFirstId.Identity               :
LocalFirstId.ImpersonationType      : None
LocalFirstId.AuthenticationMethod   : PresharedKey
LocalFirstId.Flags                  : None
RemoteFirstId.Identity              :
RemoteFirstId.ImpersonationType     : None
RemoteFirstId.AuthenticationMethod  : PresharedKey
RemoteFirstId.Flags                 : None
LocalSecondId.Identity              :
LocalSecondId.ImpersonationType     :
LocalSecondId.AuthenticationMethod  :
LocalSecondId.Flags                 :
RemoteSecondId.Identity             :
RemoteSecondId.ImpersonationType    :
RemoteSecondId.AuthenticationMethod :
RemoteSecondId.Flags                :
CipherAlgorithm                     : AES256
HashAlgorithm                       : SHA1
GroupId                             : DH14
KeyModule                           : IkeV1
MaxQMSAs                            : 0
LifetimeSeconds                     : 28800
LocalUdpEncapsulationPort           :
RemoteUdpEncapsulationPort          :
ExtendedFilterId                    : 0
PS > Get-NetIPsecQuickModeSA
Name                       : 62
LocalEndpoint              : 10.0.0.1
RemoteEndpoint             : 10.0.0.254
TransportLayerFilterName   : L2TP Client Specific Filter
EncapsulationMode          : Transport
Direction                  : Inbound
LocalPort                  : 1701
RemotePort                 : 1701
IpProtocol                 : 17
InterfaceAlias             : USB-LAN
RealIfProfileId            : 0
LocalUdpEncapsulationPort  :
RemoteUdpEncapsulationPort :
SPI                        : 2750161482
FirstTransformType         : EspAuthAndCipher
FirstIntegrityAlgorithm    : SHA1
FirstCipherAlgorithm       : AES128
SecondSpi                  :
SecondTransformType        : None
SecondIntegrityAlgorithm   : None
SecondCipherAlgorithm      : None
Flags                      : NoExplicitCredMatch, AllowNullTargetNameMatch
MmSaId                     : 55
PfsGroupId                 : None
PeerV4PrivateAddress       : 0.0.0.0
QuickModeFilterid          : 91482
LifetimeSeconds            : 3600
LifetimeKilobytes          : 250000
LifetimePackets            : 2147483647
IdleDurationSeconds        : 300
NdAllowClearTimeoutSeconds : 0
NapContext                 : 0
QmSaId                     : 1518189948
VirtualIfTunnelId          : 0
TrafficSelectorId          : 0
MmTargetName               :
EmTargetName               :
ExplicitCredentials        :

Name                       : 62
LocalEndpoint              : 10.0.0.1
RemoteEndpoint             : 10.0.0.254
TransportLayerFilterName   : L2TP Client Specific Filter
EncapsulationMode          : Transport
Direction                  : Outbound
LocalPort                  : 1701
RemotePort                 : 1701
IpProtocol                 : 17
InterfaceAlias             : 0
RealIfProfileId            : 0
LocalUdpEncapsulationPort  :
RemoteUdpEncapsulationPort :
SPI                        : 3265221243
FirstTransformType         : EspAuthAndCipher
FirstIntegrityAlgorithm    : SHA1
FirstCipherAlgorithm       : AES128
SecondSpi                  :
SecondTransformType        : None
SecondIntegrityAlgorithm   : None
SecondCipherAlgorithm      : None
Flags                      : NoExplicitCredMatch, AllowNullTargetNameMatch
MmSaId                     : 55
PfsGroupId                 : None
PeerV4PrivateAddress       : 0.0.0.0
QuickModeFilterid          : 91482
LifetimeSeconds            : 3600
LifetimeKilobytes          : 250000
LifetimePackets            : 2147483647
IdleDurationSeconds        : 300
NdAllowClearTimeoutSeconds : 0
NapContext                 : 0
QmSaId                     : 1518189948
VirtualIfTunnelId          : 0
TrafficSelectorId          : 0
MmTargetName               :
EmTargetName               :
ExplicitCredentials        :

PS > Get-NetIPInterface -ifIndex 47 | Format-List
InterfaceIndex                  : 47
InterfaceAlias                  : vpn-01_l2tp
CompartmentId                   : 1
AddressFamily                   : IPv4
Forwarding                      : Disabled
ClampMss                        : Disabled
Advertising                     : Disabled
NlMtu(Bytes)                    : 1400
AutomaticMetric                 : Enabled
InterfaceMetric                 : 25
NeighborDiscoverySupported      : No
NeighborUnreachabilityDetection : Disabled
BaseReachableTime(ms)           : 30000
ReachableTime(ms)               : 19000
RetransmitTime(ms)              : 1000
DadTransmits                    : 0
DadRetransmitTime(ms)           : 1000
RouterDiscovery                 : ControlledByDHCP
ManagedAddressConfiguration     : Enabled
OtherStatefulConfiguration      : Enabled
WeakHostSend                    : Disabled
WeakHostReceive                 : Disabled
IgnoreDefaultRoutes             : Disabled
AdvertisedRouterLifetime        : 00:30:00
AdvertiseDefaultRoute           : Disabled
CurrentHopLimit                 : 0
ForceArpNdWolPattern            : Disabled
DirectedMacWolPattern           : Disabled
EcnMarking                      : AppDecide
Dhcp                            : Disabled
ConnectionState                 : Connected
PolicyStore                     : ActiveStore

【参考URL】
IPsec IKEv1プロトコルについて
Default encryption settings for the Microsoft L2TP/IPSec VPN Client
ニフティクラウド上に VyOS を構築して L2TP/IPsec を使って Mac から VPN 接続してみた
Cisco L2TPv2/IPsecのコンフィグ
Cisco 841MのL2TP/IPsecスループット
VPNクライアントとの接続(L2TP/IPsec, Windows 10)
【Windows10】L2TP/IPSecでリモート接続するVPN接続設定
Change the default maximum transmission unit (MTU) size settings for PPP connections or for VPN connections
VPNの仕組みを探る(1/2)