A site-to-site VPN connects entire networks, such as a data center to a VPC or two offices to each other. The risk many teams ignore is that, once established, the VPN often becomes an open tunnel between the networks, and a compromise on one side spreads to the other. The encrypted tunnel is only the beginning, because VPN security also depends on segmentation, restricted routes and visibility.
The best practices below are for configuring and operating a site-to-site VPN defensively: adequate encryption, control over what can cross the tunnel, key management, logs and availability. The goal is to connect the networks without creating an easy path for lateral movement.
Encryption and key management
Use current encryption parameters in IPsec and stay away from algorithms and groups considered weak. Prefer modern suites and disable legacy ones. If you use pre-shared keys, they must be strong, stored securely and rotated, because a weak or leaked key compromises the entire tunnel.
Document the parameters agreed between the two sides and keep both in sync. Mismatched configurations cause instability and sometimes lead the team to relax the parameters just to get the tunnel up, which weakens security.
The two IKE phases and forward secrecy
An IPsec VPN negotiates in two phases. In the first, the two sides authenticate each other and set up a secure management channel; in the second, they negotiate the keys that actually encrypt the traffic. In each phase you choose the cipher algorithm, the integrity algorithm and the key exchange group. The sensitive point is perfect forward secrecy (PFS). With it enabled, each renegotiation generates new, independent key material, and the compromise of one key exposes neither past nor future traffic. Prefer strong key exchange groups and keep PFS enabled. The profile below sums up what to agree on with the other side.
# Prefer modern suites and keep both gateways alignedPhase 1 (IKE): cipher AES-GCM or AES-CBC 256 integrity SHA-2 (256 or higher) strong key exchange group (avoid legacy groups)Phase 2 (IPsec): ESP with AES-GCM or AES-CBC 256 PFS enabled (new key on every renegotiation) SA lifetime short enough for regular rotationAuthentication: strong, unique pre-shared key, or certificatesTreat the pre-shared key as a high-value secret: generate a long, random key, store it in a secrets vault and do not reuse the same key across different tunnels. When scale justifies it, certificate-based authentication avoids the problem of static shared keys and makes it easier to revoke one side without touching the others.
Segmentation and restricted routes
The most important control, and also the most forgotten, is restricting what can cross the tunnel. Instead of routing entire networks from one side to the other, define routes and rules that allow only the flows that are really needed (a specific set of hosts and ports, for example). That way, even if one side is compromised, access to the other side stays limited.
- Allow only the necessary flows through the tunnel
- Avoid routing entire networks when only a few hosts need to talk
- Apply firewalls on both sides instead of trusting the VPN alone
- Segment to contain lateral movement between the networks
- Periodically review what the tunnel actually allows
Think of the VPN as a connection between different trust zones. It is not a transparent extension of the internal network, which is why the firewalls on both sides are still needed.
From full network access to the smallest possible flow
An overly open VPN gets closed down in stages, from the broad connection to the restricted one. First, find out which applications really need to talk between the two sides; many connections carry the whole network just because it was faster to configure that way. Then write firewall rules that allow only those hosts and ports and close everything else by default. A deny rule as the baseline, with explicit and justified exceptions, takes more work at the start, but it is the opposite of routing everything and hoping nothing goes wrong.
Logs and high availability
Enable logs for the tunnel and for the traffic that passes through it, for detection and investigation. Without that visibility, malicious lateral access through the VPN goes unnoticed. For critical services, plan high availability with redundant tunnels, so that losing one path does not bring down the whole connection.
Monitor tunnel health and raise alerts for drops and abnormal renegotiations. They can indicate either an operational problem or suspicious activity.
Redundancy without a single point of failure
Real high availability requires paths that do not share the same weak point. Two tunnels that leave through the same device, the same internet link or with the same key configuration inherit the same failure. For critical services, spread the paths across different gateways and links and test failover on purpose: take one side down in a controlled window and confirm that traffic moves over as expected. A redundant tunnel that was never exercised tends to fail exactly when it is called on.
Detecting abuse through the tunnel
The VPN encrypts the traffic, but it does not tell you whether what passes through it is legitimate. An attacker who compromises one side uses the tunnel just as an administrator would, so detection has to look at behavior, not just at whether the connection exists. Log the flows that cross the tunnel and compare them with what is expected. A host that suddenly talks to services it never accessed before, a port scan of the other side or an unusual data volume are signs that deserve an alert.
- Connections to hosts or ports outside the authorized set
- Network scans from one side toward the other
- Transfer volume far above the historical pattern
- Tunnel renegotiations at unusual times or frequencies
- Repeated denied access attempts at the edge firewall
Send these events somewhere the team actually watches, such as a SIEM or a channel with an owner and a response deadline. And decide in advance what to do when the alert fires. A compromised tunnel usually requires taking the connection down, rotating the keys and investigating the source side before restoring it, because reconnecting in a hurry hands the path back to whoever was abusing it.
Practical checklist
- Use current IPsec encryption parameters and disable legacy ones
- Keep PFS enabled to renew key material on every renegotiation
- Use strong keys, unique per tunnel, stored in a vault and rotated
- Consider certificate authentication where scale justifies it
- Document and match parameters between the two sides
- Allow only the necessary flows through the tunnel
- Adopt default deny on the firewall, with justified exceptions
- Avoid routing entire networks without need
- Apply firewalls on both sides of the VPN
- Segment to contain lateral movement
- Enable logs for the tunnel and the flows that cross it
- Alert on access to hosts or ports outside the authorized set
- Plan high availability with independent paths
- Test failover on purpose in a controlled window
- Monitor tunnel health, drops and renegotiations
- Have a response procedure for a compromised tunnel
Best practices
- Treat the VPN as a connection between separate zones, not as a single network
- Restrict the tunnel to the strictly necessary flows
- Keep firewalls active on both sides, with default deny
- Prefer modern suites and keep PFS enabled
- Rotate and protect the tunnel keys, without reusing them across connections
- Get visibility with flow logs and behavior alerts
- Plan redundancy over independent paths and test failover
Common mistakes
- Routing entire networks from one side to the other
- It creates a wide corridor for lateral movement between the networks.
- Relaxing encryption to get the tunnel up
- It weakens the protection of traffic between the sites.
- Disabling PFS for convenience
- The compromise of one key now exposes other sessions' traffic.
- A weak, reused or never-rotated pre-shared key
- One compromised key exposes the whole tunnel, and sometimes more than one.
- Trusting the VPN alone, with no firewalls on either side
- A compromised side reaches the other with no additional barrier.
- Redundancy through the same device or link
- The tunnels inherit the same failure and go down together when it happens.
- A tunnel without flow logs
- Malicious lateral access through the VPN goes by without anyone noticing.
Authorship and review
Cesar Gargiulo
CEO and founder of GUARDIASEC. Technical and editorial lead for the content published in this library.
Published on . Found a technical error? Write to [email protected] and we will correct it and keep a record of the change.