Virtual IPs give roadwarrior clients a stable inner address inside the VPN network. Routes on the server side can then point to this address regardless of the client’s actual public IP.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/strongswan/strongswan/llms.txt
Use this file to discover all available pages before exploring further.
IKEv2 uses the Configuration Payload (CP) to exchange virtual IPs. IKEv1 uses Mode Config. Both mechanisms are supported by strongSwan.
How it works
- The client requests a virtual IP by including
0.0.0.0(IPv4) or::(IPv6) in its configuration payload. - The server selects an address from the configured pool and returns it in the CP response.
- The client installs the assigned address on a local interface and uses it as the inner tunnel address.
- Traffic matching the tunnel’s traffic selectors is routed through the VPN using this address.
Pool definition
Define pools in thepools section of swanctl.conf. Each pool has a unique name and an address range.
swanctl.conf
addrs value accepts:
- A CIDR subnet:
10.3.0.0/24 - An explicit range:
10.3.0.1-10.3.0.254 - A subnet with a non-network-ID start (addresses below the start are skipped):
10.3.0.5/24
Pools must be unique and non-overlapping. If you configure multiple pools, each must cover a disjoint address range.
Per-pool DNS and NBNS attributes
Push DNS servers, NBNS/WINS servers, and other attributes alongside the virtual IP:swanctl.conf
dns, nbns, dhcp, netmask, server, subnet, p_cscf, split_include, split_exclude. You can also use numeric attribute identifiers.
Connection configuration
Server side
Reference a pool by name in the connection’spools parameter:
swanctl.conf
remote_ts = dynamic in the child SA causes the traffic selector to be set to the client’s assigned virtual IP, which is the correct behavior for roadwarrior scenarios.
Client side
Setvips in the connection to request a virtual IP from the server:
swanctl.conf (client)
vips value | Behavior |
|---|---|
0.0.0.0 | Request any available IPv4 address |
:: | Request any available IPv6 address |
0.0.0.0, :: | Request both IPv4 and IPv6 addresses |
10.3.0.42 | Request a specific address (server may return a different one) |
Pool management commands
--list-pools:
In-memory vs. SQL-backed pools
- In-memory pools
- SQL-backed pools (attr-sql)
The default pool implementation stores allocations in memory. Leases are lost when the daemon restarts.Suitable for dynamic roadwarrior deployments where clients re-request addresses on reconnect.
swanctl.conf
Complete example
A roadwarrior server assigning IPv4 addresses from a/24 pool with DNS pushed to clients:
swanctl.conf