How to Configure Windows Server IPsec Policies for Host-to-Host Encryption

The Internal Threat Vector

In traditional network security, administrators focus almost entirely on the perimeter firewall. They assume that if an attacker breaches the exterior defenses (or if an employee simply plugs a compromised laptop into an office Ethernet jack), the internal network is a “trusted zone.” This is a fatal assumption. If an attacker gains access to the corporate LAN, they can deploy packet sniffing software (like Wireshark) and passively intercept plaintext SQL queries, unencrypted SMB file transfers, and proprietary API payloads flowing between internal servers.

Relying on application-layer encryption (like forcing every internal developer to properly configure TLS certificates for their microservices) is often impossible to enforce at scale.

To mathematically guarantee that all internal server-to-server communication is protected against wiretapping, enterprise architects deploy Windows Server IPsec Policies. By integrating IPsec directly into the Windows Defender Firewall, administrators can force two Windows Servers to autonomously negotiate a cryptographic tunnel at the OSI Network Layer. The applications themselves are completely unaware of the encryption. An insecure, legacy HTTP application running on Server A can talk to Server B, and the Windows kernel will silently encrypt every packet before it hits the physical network cable.

Step 1: The Architectural Concept of Connection Security Rules

In Windows Server, IPsec is not configured as a traditional VPN. It is configured using Connection Security Rules within the Windows Defender Firewall with Advanced Security console.

A Connection Security Rule does not open or close ports. (You still need standard Firewall Inbound/Outbound rules for that). A Connection Security Rule simply states: “If you are going to talk to this specific IP address, you must encrypt the math.”

You can enforce IPsec via Active Directory Group Policy (GPO) to scale it across thousands of servers, but for this guide, we will configure it locally between two standalone servers: WEB-SRV (10.0.5.10) and SQL-SRV (10.0.5.20).

Step 2: Defining the Authentication Method

Before two servers can encrypt their traffic, they must mutually authenticate to prove they are who they claim to be. IPsec supports three primary authentication methods:

  1. Kerberos (Computer): The absolute best method if both servers are joined to the same Active Directory domain. It requires zero configuration.
  2. Certificates (PKI): Requires an internal Certificate Authority to issue computer certificates. Used for cross-domain or workgroup environments.
  3. Pre-Shared Key (PSK): A static password. Highly discouraged for enterprise production, but useful for testing.

Assuming both servers are domain-joined, we will use Kerberos.

Step 3: Creating the Rule on the SQL Server

Log into SQL-SRV (the database server). You want to force any incoming connection to the SQL port (1433) to be encrypted.

  1. Open Windows Defender Firewall with Advanced Security.
  2. In the left pane, right-click Connection Security Rules and select New Rule.
  3. Rule Type: Select Custom.
  4. Endpoints:
    • Endpoint 1 (Which computers does this rule apply to?): Leave as Any IP address (This server).
    • Endpoint 2: Enter the IP address of WEB-SRV (10.0.5.10).
  5. Requirements: This is the critical security toggle. Select Require authentication for inbound and outbound connections. (If you select ‘Request’, the server will try to encrypt, but if it fails, it will fall back to plaintext. ‘Require’ drops the connection if encryption fails).
  6. Authentication Method: Select Computer (Kerberos V5).
  7. Protocol and Ports:
    • Protocol Type: TCP
    • Endpoint 1 Port: Specific Ports -> 1433
  8. Name the rule IPsec_Require_WebToSQL and save it.

Step 4: Creating the Matching Rule on the Web Server

IPsec requires a mathematical handshake. The Web Server must have a mirror-image rule configured, or the connection will fail.

Log into WEB-SRV.

  1. Open Connection Security Rules > New Rule > Custom.
  2. Endpoints:
    • Endpoint 1: Any IP address (This server).
    • Endpoint 2: 10.0.5.20 (The SQL Server).
  3. Requirements: Select Require authentication for inbound and outbound connections.
  4. Authentication Method: Computer (Kerberos V5).
  5. Protocol and Ports:
    • Protocol Type: TCP
    • Endpoint 2 Port: Specific Ports -> 1433
  6. Name the rule IPsec_Require_ToSQL and save it.

Step 5: Validating the Cryptographic Tunnel

With the rules active on both ends, log into WEB-SRV and attempt to open a connection to the SQL server. (Even using a simple Test-NetConnection 10.0.5.20 -Port 1433 in PowerShell will trigger the handshake).

The exact millisecond the connection initiates, the Windows kernel intercepts it, exchanges Kerberos tickets with the SQL server, generates a dynamic symmetric encryption key, and builds the ESP (Encapsulating Security Payload) tunnel.

To mathematically prove the tunnel is active, you do not use standard ping. You must check the IPsec Security Associations (SAs).

On either server, open the Windows Defender Firewall console.

  1. In the left pane, expand Monitoring.
  2. Expand Security Associations.
  3. Click on Main Mode. You will see a live entry showing the two IP addresses mutually authenticated via Kerberos.
  4. Click on Quick Mode. You will see the actual encrypted data tunnel. It will display the specific encryption algorithm being used (e.g., AES-GCM 256-bit) and the cryptographic hashing algorithm (e.g., SHA-256).

If you run a packet capture (Wireshark) on the network switch between the two servers, you will no longer see TCP Port 1433. You will only see the protocol “ESP”. The payload is completely unreadable.

Conclusion

Treating the internal corporate network as a safe zone leaves enterprise databases highly vulnerable to lateral movement and packet sniffing. By enforcing Windows Server IPsec Connection Security Rules, IT administrators push the encryption perimeter down to the host OS. This guarantees that all highly sensitive server-to-server traffic is cryptographically sealed at the kernel level, completely neutralizing internal wiretapping threats without requiring any modifications to the underlying application code.

RELATED POSTS

  • How to Configure Windows Server DNS Scavenging to Remove Stale Records
  • How to Clear the Windows RSAT (Remote Server Administration Tools) Cache via PowerShell
  • How to Setup a RADIUS Server for Wi-Fi Authentication in Windows Server
  • How to Configure Windows Server Update Services (WSUS) with Group Policy
  • How to Deploy Software Packages Using Windows Group Policy
  • Get the best tech tips delivered straight to your inbox.

    Join thousands of readers mastering Apple, Google, Microsoft, and Linux.