Project

General

Profile

Virtual IP » History » Version 11

Version 10 (Tobias Brunner, 20.09.2012 08:42) → Version 11/24 (Tobias Brunner, 04.10.2012 19:57)

h1. Virtual IP

{{>toc}}



IKEv1 and IKEv2 both know the concept of _virtual IPs_. This means that the initiator requests an additional IP address from the peer to use as inner IPsec tunnel address.

In IKEv1, virtual IPs are exchanged using the _mode config_ extension. IKEv2 has full support for virtual IPs in the core standard using _configuration payloads_.

h2. IKEv1


The feature set is similar to that in IKEv2, but not all features are supported. If the virtual IP is not assigned by the responder with _rightsourceip_ you may need to use the _rightsubnetwithin_ directive (see "this example":http://www.strongswan.org/uml/testresults/ikev1/virtual-ip/).

h2. IKEv2

strongSwan currently implements one scenario with configuration payloads, where an IP address is assigned to the initiator (since [[5.0.1]] multiple addresses can be assigned from multiple pools). initiator. The opposite is possible by the protocol, but is an uncommon setup and therefore not supported.

h2. h3. Initiator Configuration

The client needs an additional parameter called _leftsourceip_.

<pre>
leftsourceip=%config
</pre>


_%config_ means to request an address from the responder and is an alias for the IKEv1 specific _%modecfg_. But you may specify an address explicitly by setting:
<pre>
leftsourceip=10.3.0.5
</pre>


This will include _10.3.0.5_ into the configuration payload request. However, the responder may return a different address, or may not return one at all.

Since [[5.0.1]] a The client can't request other attributes, but it may request multiple IP addresses by listing a comma-separated combination process the DNS attributes. Received DNS servers are written to the beginning of _%config4_, _%config6_ _/etc/resolv.conf_, or fixed IP addresses in _leftsourceip_. Configuring _%config_ (or one of its aliases) will request an address of other file specified with the tunnel address family.
The main use case is for dualstack hosts to request a virtual IP of each address family:
_--with-resolve-conf_ configure directive.

<pre>
leftsourceip=%config4,%config6
</pre> This is also illustrated in the {{tc(ikev2/ip-two-pools-v4v6)}} test scenario.

The @leftsubnet@ option
You should not be included when requesting a virtual IP, include the _leftsubnet_ option, as the subnet may not match the your received address. virtual IP. Without the _leftsubnet_ option, the subnet is narrowed to the your assigned virtual IP automatically.



h3. DNS servers

Before [[5.0.1]] the client couldn't explicitly request other attributes, but it may still have processed the DNS attribute. With current releases DNS servers may explicitly be requested with the _leftdns_ option. Received DNS servers are handled, for instance, by the [[resolveplugin|resolve plugin]] which writes them to _/etc/resolv.conf_, or an other file specified with the _--with-resolve-conf_ configure directive.

h2.
Responder Configuration

The responder configuration uses the _rightsourceip_ option:
<pre>
rightsourceip=10.3.0.6
</pre>


This will serve the IP _10.3.0.6_ to the client, even if the initiator requested another address. Additionally, the responder may define:
<pre>
rightsourceip=%config
</pre>


to let the client choose an address. This is not recommended if you do not trust the client completely.

The IKEv2 daemon charon supports address pools since version 4.2.1; the IKEv1 daemon pluto added support in 4.4.0. You may define an address pool in CIDR notation, e.g.
<pre>
rightsourceip=10.3.0.0/24
</pre>
to serve addresses from that pool.

You may also use an external pool implemented as a plugin where you can specify a pool name to select addresses from. The definition
<pre>
rightsourceip=%poolname
</pre>


queries registered plugins for an IP from a pool named _poolname_. This can also be the name of another connection in [[IpsecConf|ipsec.conf]] which defines a pool in CIDR notation with _rightsourceip_, as a pool with that connection's name is created implicitly. Since [[5.0.1]] multiple connections (i.e. [[ConnSection|conn sections]]) can share the same pool implicitly if they use the same definition in _rightsourceip_ (previously each connection would use it's own copy and the same virtual IP may have been handed out to different clients).

Multiple pools can be listed in _rightsourceip_ since [[5.0.1]], e.g.
<pre>
rightsourceip=10.3.0.0/28,fec3::/120
</pre>

As used in the {{tc(ikev2/ip-two-pools-v4v6)}} test scenario.

h3. DNS servers

DNS servers and other attributes can be assigned by plugins (e.g. the [[AttrPlugin|attr plugin]]) or since [[5.0.1]] directly in [[ipsec.conf]] by use of the _rightdns_ option.

h3. Database backend



The [[IpsecPool|ipsec pool]] utility allows to easily manage IP address pools and other attributes, like DNS servers, stored in an SQL database using (using the [[attrsql|attr-sql plugin]]. [[attrsql|attr-sql]] plugin).

h3. DHCP backend

With the [[DHCPPlugin|dhcp plugin]] the responder can request virtual IP addresses for clients from a DHCP server using broadcasts, or a designated server.

DNS/WINS server information is additionally served to clients if the DHCP server provides such information.

The plugin is used in [[ipsec.conf]] ipsec.conf configurations by setting
<pre>
rightsourceip=%dhcp
</pre>

The [[FARPPlugin|farp plugin]] might also be of use when using the [[DHCPPlugin|dhcp plugin]]. It allows the responder to fake ARP responses for
virtual IP addresses handed out to clients. This lets a road-warrior act as a client on the local LAN of the responder.

h2. Versions before 5.0.0

The description above covers the features of the charon daemon, which handled only IKEv2 connections in earlier releases. The pluto daemon that handled IKEv1 connections provided a similar feature set but not everything was supported (for instance, the dhcp and farp plugins).

The pluto daemon did not request virtual IP addresses from the responder if they were explicitly configured with _leftsourceip_. In that case, that is, if the virtual IP was not assigned by the responder with _rightsourceip_ one may had to use the _rightsubnetwithin_ directive (refer to "this example":http://www.strongswan.org/uml/testresults4/ikev1/virtual-ip/).

The IKEv2 daemon charon supports address pools since version [[4.2.1]], the IKEv1 daemon pluto gained support for this in [[4.4.0]].