Applies to: Windows Server 2019, Windows Server 2022 and Windows Server 2025, subject to the workload and edition requirements below.
Treat the tunnel as a routed connection between sites
A site-to-site RRAS VPN joins two networks through an encrypted tunnel between gateways. Unlike a remote-user VPN, its main purpose is forwarding traffic for entire approved subnets. A Connected interface proves tunnel establishment, but it does not prove that application packets have correct routes, return paths or firewall permission. Build the addressing and access design before choosing the tunnel settings.
This guide uses an IKEv2 site-to-site interface with machine-certificate authentication and explicit remote IPv4 routes. The peer can be another supported RRAS gateway or an interoperable VPN device whose IKE/IPsec policy matches. It does not configure overlapping networks, high availability or BGP. Those requirements need an expanded design, and adding a default route through the tunnel is not an appropriate shortcut for missing subnet-specific routing.
Agree on both sides of the connection
Create a two-sided configuration record containing each public endpoint, local and remote subnets, authentication identities, certificate authorities, IKE/IPsec algorithms, lifetimes, traffic selectors and expected route metrics. Choose non-overlapping address space. For illustration, the main site is 10.70.0.0/24 and the branch is 10.80.0.0/24; replace them with the actual networks. Include any upstream NAT and the endpoint address the peer really sees.
Define permitted application flows and administrative access separately from tunnel establishment. A tunnel that permits every source and destination can create an unplanned trust relationship between sites. Determine how each LAN router returns traffic to the other site through its local VPN gateway. If hosts do not use RRAS as their default router, add the required routes on their normal router rather than expecting the gateway to discover them.
Verify platform support, current updates, reliable management access and a maintenance window. Microsoft’s Remote Access restriction for Azure VMs applies here too. On other virtual platforms, confirm transit traffic and the necessary IPsec/NAT traversal behaviour are supported by the provider.
Prepare the certificates and RRAS gateway function
Install the appropriate Remote Access VPN and Routing components on each Windows gateway and configure the intended site-to-site routing function. Preserve existing RRAS configuration first. Ensure UDP 500 and 4500 are permitted between the known endpoints as required by the topology, and account for ESP where a non-NAT IPsec path uses it. Scope controls to the peer where its address is fixed.
Each gateway needs the appropriate local machine certificate and private key, and each side must trust and validate the other side’s chain and identity. Confirm intended purposes, validity, private-key access and revocation reachability before tunnel testing. Do not use expired lab certificates or disable validation to compensate for an unreachable CRL. Certificate renewal must preserve or deliberately update the peer identity mapping.
Get-WindowsFeature DirectAccess-VPN,Routing
Get-Service RemoteAccess
Get-ChildItem Cert:\LocalMachine\My |
Select-Object Subject,Thumbprint,NotAfter,HasPrivateKey
Get-VpnS2SInterface
Create the interface with an explicit remote route
The following example runs on the main-site gateway after its local certificate has been selected and validated. The destination is the branch’s reachable public endpoint. The interface name must be chosen according to the certificate identity and incoming-connection mapping, not merely as an arbitrary friendly label: RRAS certificate-authenticated incoming interfaces are matched against the peer certificate subject identity.
$thumbprint = 'REPLACE_WITH_APPROVED_LOCAL_CERTIFICATE_THUMBPRINT'
$cert = Get-Item ('Cert:\LocalMachine\My\' + $thumbprint) -ErrorAction Stop
if (-not $cert.HasPrivateKey) { throw 'The local gateway certificate has no private key.' }
Add-VpnS2SInterface -Name 'branch01.corp.example' `
-Protocol IKEv2 -Destination 'vpn-branch.corp.example' `
-AuthenticationMethod MachineCertificates -Certificate $cert `
-IPv4Subnet '10.80.0.0/24:100' -Persistent -AdminStatus $true
Get-VpnS2SInterface -Name 'branch01.corp.example' | Format-List *The subnet suffix :100 is a route metric, not a port. Configure the branch’s complementary local certificate, identity mapping and route to 10.70.0.0/24. Do not copy the main-site remote subnet onto both ends. If the peer requires policy-based selectors or different authentication, adapt the design using the documented parameters and verify interoperability rather than assuming this example is universal.
Align initiator and responder IPsec policy
RRAS distinguishes per-interface settings from server-side responder policy. With machine-certificate authentication, interface custom settings govern the initiating side, while incoming responder behaviour uses the server configuration. Configuring only one interface’s custom policy may therefore produce a tunnel that works in one initiation direction but fails in the other. Review both sides of negotiation before declaring the cryptographic settings complete.
Choose approved modern algorithms and matching lifetimes supported by both gateways. If a custom policy is required, document each IKE and IPsec transform, integrity method, DH/PFS group and rekey interval. Configure the corresponding Set-VpnS2SInterface and server policy settings through a reviewed procedure. Do not weaken the policy to an obsolete group merely because the peer offers it by default.
For pre-shared-key designs, the cmdlet has different interface-matching and per-destination restrictions. Do not switch authentication methods casually during troubleshooting. A strong secret still needs secure storage, rotation and peer-specific management, and it should never appear in a saved public command transcript. Certificate authentication avoids embedding such a shared secret in this example.
Connect and verify routes before application access
Initiate the connection through the RRAS console or Connect-VpnS2SInterface and observe interface state and recent errors. Then inspect the route table. The remote prefix should use the intended tunnel path with an appropriate metric, while management and Internet routes should retain their planned paths.
Connect-VpnS2SInterface -Name 'branch01.corp.example'
Get-VpnS2SInterface -Name 'branch01.corp.example'
Get-NetRoute -AddressFamily IPv4 | Where-Object DestinationPrefix -eq '10.80.0.0/24'
# From an authorized main-site client, test a permitted branch service:
Test-NetConnection -ComputerName '10.80.0.20' -Port 443Use a real LAN client at each site, not only the gateways. Test permitted traffic in both directions and confirm a deliberately prohibited flow remains blocked. Check DNS resolution through the intended cross-site resolver path if applications use names. A ping result is supporting evidence; application-port tests and firewall records better establish the required service path. Record the source network and exact destination for every test.
Diagnose negotiation and data-plane faults separately
If the tunnel never establishes, inspect endpoint resolution and reachability, UDP/IPsec filtering, certificate trust and identity, revocation access and transform compatibility. Correlate both gateways’ timestamps and error messages. If only one direction initiates successfully, inspect responder policy and the peer-to-interface matching rules before changing routes.
If the tunnel is Connected but traffic fails, examine local routes, remote return routes, selectors, host firewalls, LAN-router policy and NAT exemptions where applicable. Overlapping networks can cause local delivery instead of tunnel forwarding. Larger transfers failing while small probes work can indicate MTU or fragmentation issues. Collect targeted packet or event evidence for the failing flow rather than repeatedly tearing down a working tunnel.
Rollback without stranding site traffic
Before disconnecting or removing the interface, identify every subnet and service that relies on it and arrange the alternate route or outage window. Restore only the routes and policies changed for this connection. Removing a tunnel while a preferred route remains can create a black hole, while removing the wrong route can redirect sensitive traffic outside the intended path.
Preserve interface configuration, certificates, event logs and the peer’s settings before cleanup. Do not uninstall RRAS if other VPN clients, NAT users or sites depend on it. Document recovery ownership, certificate renewal, routing metrics, allowed flows and monitoring thresholds. Test reconnect and rekey behaviour in a planned exercise so the site-to-site service remains predictable through network interruptions and certificate lifecycle changes.
Related guidance and official references
Install Remote Access and RRAS; Configure an IKEv2 remote-user VPN; Manage static routes.