Skip to content

Commit 2b5de5f

Browse files
ipsec: T7594: Change connection-type to trap for all peers and configurations (#1719)
The previous 'connection-type respond' option in IPsec site-to-site peers was misleading - instead of passively waiting for peer initiation, it would initiate negotiation when matching traffic appeared, potentially causing SA duplication and renegotiation loops.
1 parent b9560fe commit 2b5de5f

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

docs/configexamples/azure-vpn-bgp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Vyos configuration
105105
set vpn ipsec site-to-site peer azure authentication local-id '198.51.100.3'
106106
set vpn ipsec site-to-site peer 203.0.113.2 authentication mode 'pre-shared-secret'
107107
set vpn ipsec site-to-site peer 203.0.113.2 authentication remote-id '203.0.113.2'
108-
set vpn ipsec site-to-site peer 203.0.113.2 connection-type 'respond'
108+
set vpn ipsec site-to-site peer 203.0.113.2 connection-type 'initiate'
109109
set vpn ipsec site-to-site peer 203.0.113.2 description 'AZURE PRIMARY TUNNEL'
110110
set vpn ipsec site-to-site peer 203.0.113.2 ike-group 'AZURE'
111111
set vpn ipsec site-to-site peer 203.0.113.2 ikev2-reauth 'inherit'

docs/configexamples/azure-vpn-dual-bgp.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Vyos configuration
110110
set vpn ipsec site-to-site peer azure-primary authentication local-id '198.51.100.3'
111111
set vpn ipsec site-to-site peer azure-primary authentication mode 'pre-shared-secret'
112112
set vpn ipsec site-to-site peer azure-primary authentication remote-id '203.0.113.2'
113-
set vpn ipsec site-to-site peer azure-primary connection-type 'respond'
113+
set vpn ipsec site-to-site peer azure-primary connection-type 'initiate'
114114
set vpn ipsec site-to-site peer azure-primary description 'AZURE PRIMARY TUNNEL'
115115
set vpn ipsec site-to-site peer azure-primary ike-group 'AZURE'
116116
set vpn ipsec site-to-site peer azure-primary ikev2-reauth 'inherit'
@@ -122,7 +122,7 @@ Vyos configuration
122122
set vpn ipsec site-to-site peer azure-secondary authentication local-id '198.51.100.3'
123123
set vpn ipsec site-to-site peer azure-secondary authentication mode 'pre-shared-secret'
124124
set vpn ipsec site-to-site peer azure-secondary authentication remote-id '203.0.113.3'
125-
set vpn ipsec site-to-site peer azure-secondary connection-type 'respond'
125+
set vpn ipsec site-to-site peer azure-secondary connection-type 'initiate'
126126
set vpn ipsec site-to-site peer azure-secondary description 'AZURE secondary TUNNEL'
127127
set vpn ipsec site-to-site peer azure-secondary ike-group 'AZURE'
128128
set vpn ipsec site-to-site peer azure-secondary ikev2-reauth 'inherit'

docs/configexamples/policy-based-ipsec-and-firewall.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ IPSec configuration:
106106
set vpn ipsec ike-group IKE-GROUP proposal 1 hash 'sha256'
107107
set vpn ipsec interface 'eth0'
108108
set vpn ipsec site-to-site peer LEFT authentication mode 'pre-shared-secret'
109-
set vpn ipsec site-to-site peer LEFT connection-type 'respond'
109+
set vpn ipsec site-to-site peer LEFT connection-type 'none'
110110
set vpn ipsec site-to-site peer LEFT default-esp-group 'ESP-GROUP'
111111
set vpn ipsec site-to-site peer LEFT ike-group 'IKE-GROUP'
112112
set vpn ipsec site-to-site peer LEFT local-address '192.0.2.130'

docs/configuration/vpn/ipsec/site2site_ipsec.rst

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,32 @@ Global Peer Configuration Commands
285285
after configuring and after boot. In this mode the connection will
286286
not be restarted in case of disconnection, therefore should be used
287287
only together with DPD or another session tracking methods.
288-
* **respond** - does not try to initiate a connection to a remote
289-
peer. In this mode, the IPsec session will be established only
290-
after initiation from a remote peer. Could be useful when there
291-
is no direct connectivity to the peer due to firewall or NAT in
292-
the middle of the local and remote side.
288+
289+
* **trap** - does not try to initiate a connection to a remote
290+
peer immediately. Instead, it installs a trap policy that will
291+
trigger IKE negotiation and establish the IPsec session when
292+
matching traffic is sent from the local side. This can be useful
293+
when there is no direct connectivity to the peer due to firewall
294+
or NAT in the middle of the local and remote side.
295+
296+
.. warning:: The ``trap`` mode is not needed in most environments
297+
and can lead to connection confusion or unintended tunnel uptime
298+
behavior if used incorrectly. Using this mode requires careful
299+
coordination with parameters such as ``close-action`` and DPD.
300+
For most deployments, use ``initiate`` and ``none`` as described below.
301+
293302
* **none** - loads the connection only, which then can be manually
294303
initiated or used as a responder configuration.
295304

305+
.. note:: For most site-to-site VPNs, configure one peer
306+
with ``connection-type initiate`` (active side) and the other peer
307+
with ``connection-type none`` (passive side) to
308+
ensure stable and predictable tunnel behavior.
309+
When using ``connection-type initiate``, you must also configure
310+
DPD or another session tracking method (such as ``close-action``)
311+
to automatically re-establish the tunnel after a disconnection.
312+
Otherwise, the tunnel will not reconnect automatically if it goes down.
313+
296314
.. cfgcmd:: set vpn ipsec site-to-site peer <name> default-esp-group <name>
297315

298316
Name of ESP group to use by default for traffic encryption.
@@ -566,7 +584,7 @@ Policy-Based VPN Example
566584
set vpn ipsec site-to-site peer PEER1 authentication local-id '10.0.2.2'
567585
set vpn ipsec site-to-site peer PEER1 authentication mode 'pre-shared-secret'
568586
set vpn ipsec site-to-site peer PEER1 authentication remote-id '10.0.1.2'
569-
set vpn ipsec site-to-site peer PEER1 connection-type 'respond'
587+
set vpn ipsec site-to-site peer PEER1 connection-type 'none'
570588
set vpn ipsec site-to-site peer PEER1 default-esp-group 'ESP-GRPOUP'
571589
set vpn ipsec site-to-site peer PEER1 ike-group 'IKE-GROUP'
572590
set vpn ipsec site-to-site peer PEER1 local-address '10.0.2.2'
@@ -696,7 +714,7 @@ Route-Based VPN Example
696714
set vpn ipsec site-to-site peer PEER1 authentication local-id '10.0.2.2'
697715
set vpn ipsec site-to-site peer PEER1 authentication mode 'pre-shared-secret'
698716
set vpn ipsec site-to-site peer PEER1 authentication remote-id '10.0.1.2'
699-
set vpn ipsec site-to-site peer PEER1 connection-type 'respond'
717+
set vpn ipsec site-to-site peer PEER1 connection-type 'none'
700718
set vpn ipsec site-to-site peer PEER1 default-esp-group 'ESP-GRPOUP'
701719
set vpn ipsec site-to-site peer PEER1 ike-group 'IKE-GROUP'
702720
set vpn ipsec site-to-site peer PEER1 local-address '10.0.2.2'

docs/configuration/vpn/rsa-keys.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ On the LEFT (static address):
7777
set vpn ipsec site-to-site peer @RIGHT default-esp-group MyESPGroup
7878
set vpn ipsec site-to-site peer @RIGHT ike-group MyIKEGroup
7979
set vpn ipsec site-to-site peer @RIGHT local-address 192.0.2.10
80-
set vpn ipsec site-to-site peer @RIGHT connection-type respond
80+
set vpn ipsec site-to-site peer @RIGHT connection-type none
8181
set vpn ipsec site-to-site peer @RIGHT tunnel 1 local prefix 192.168.99.1/32 # Additional loopback address on the local
8282
set vpn ipsec site-to-site peer @RIGHT tunnel 1 remote prefix 192.168.99.2/32 # Additional loopback address on the remote
8383

0 commit comments

Comments
 (0)