strongSwan Configuration for a Single Windows 7 Client

Connection Definitions

# ipsec.conf - strongSwan IPsec configuration file

conn win7
     rightid="C=AU, ST=Queensland, O=QUT, OU=ISI, CN=c," 
  • leftcert=aCert.pem
    The X.509 certificate of the VPN gateway stored per default in the /etc/ipsec.d/certs/ directory.
  • leftsubnet=
    The protected network hidden behind the VPN gateway. The Windows 7 client always sends a traffic selector that is automatically narrowed by the VPN gateway to
    the actual leftsubnet definition. Multiple traffic selectors of the form
    leftsubnet=, are also possible. If all IP traffic is
    to be tunneled, define leftsubnet=
  • right=%any
    Since the IP address of a Windows 7 remote access client is usually assigned dynamically
    by the current ISP, any peer address is accepted.
  • rightsourceip=
    A Windows 7 client always requests a virtual IP address via the IKEv2 configuration payload (CP).
    The VPN gateway automatically assigns the virtual IP address defined by rightsourceip to the peer.
  • rightid="C=AU, ST=Queensland, O=QUT, OU=ISI, CN=c, E="
    Defines the IKEv2 ID of the remote peer. Windows 7 always sends the subject distinguished name contained
    in the Windows 7 machine certificate.
  • keyexchange=ikev2
    Windows 7 uses the IKEv2 protocol to set up the IPsec tunnel. The default value of keyexchange
    is ike, which allows both IKEv1 and IKEv2, but makes charon initiate all connections with IKEv2.
  • auto=add
    The connection win7 is parsed and loaded by the the IKEv2 charon daemon but the VPN gateway will
    act as a responder and passively wait for the Window 7 client to start the IKE negotiation.

Authentication with RSA Private Key

# /etc/ipsec.secrets - strongSwan IPsec secrets file

: RSA aKey.pem "f4Dgs2uY5Ne7KS0E" 

If the RSA private key file stored in the /etc/ipsec.d/private/ directory is protected by
symmetric encryption, then the passphrase must be added as an additional argument.

Assignment of Internal DNS and WINS Servers

# /etc/strongswan.conf - strongSwan configuration file

charon {
  dns1 =
  dns2 =
  nbns1 =
  nbns2 =

Windows 7 requests internal DNS and WINS server information from the strongSwan gateway via the IKEv2 Configuration Payload (CP).
Up to two IPv4 or IPv6 DNS and WINS servers can be defined in the /etc/strongswan.conf configuration file starting with

A better way to configure this is using the Attrplugin or attrsql plugin.