Troubleshooting Guide: SQL Server Error 1418 — “The server network address cannot be reached or does not exist”
Why This Error Happens
This error typically occurs during database mirroring or Always On Availability Group configuration when SQL Server cannot establish a connection to the specified endpoint address of the partner or mirror server. The root cause is usually an incorrect or unreachable network address in the ENDPOINT definition, a blocked or misconfigured port (default 5022) in the Windows Firewall, or a DNS resolution failure preventing the server name from being translated to an IP address. Additionally, mismatched service accounts without proper CONNECT permissions on the mirroring endpoint can trigger this same error even when network connectivity is otherwise healthy.
Step-by-Step Resolution Guide
Step 1: Verify Network Connectivity and DNS Resolution
- Open Command Prompt on both the principal and mirror/secondary servers.
- Run
ping <servername>andnslookup <servername>to confirm the FQDN resolves to the correct IP address. - If DNS fails, manually test connectivity using
Test-NetConnection -ComputerName <servername> -Port 5022in PowerShell. - Correct any stale DNS entries in the Windows Server 2025 DNS Manager or add a static entry in the
hostsfile as a temporary workaround.
Step 2: Confirm the Endpoint Configuration in SQL Server
- Open SQL Server Management Studio (SSMS) and connect to the instance.
- Run the following query to inspect the endpoint status and port:
SELECT name, type_desc, state_desc, port
FROM sys.tcp_endpoints;
- Ensure the
state_descshowsSTARTED. If it showsSTOPPED, restart it using:
ALTER ENDPOINT [Mirroring] STATE = STARTED;
- Verify the
ENDPOINTdefinition uses the correct listener port (default5022) and that the server address specified in the mirroring/AG setup matches the actual hostname or IP.
Step 3: Check Windows Firewall and Port Accessibility
- Navigate to Windows Defender Firewall with Advanced Security on both Windows Server 2025 instances.
- Create or verify an Inbound Rule allowing TCP traffic on port
5022(or your custom mirroring port). - Run
netstat -ano | findstr 5022on the hosting server to confirm SQL Server is actively listening on that port. - If using a cloud VM or NSG (Network Security Group), confirm the corresponding inbound rule is open at the network layer as well.
Step 4: Validate Service Account Permissions on the Endpoint
- Confirm the SQL Server service account has
CONNECTpermission on the mirroring endpoint by running:
GRANT CONNECT ON ENDPOINT::[Mirroring] TO [DOMAIN\ServiceAccount];
- Ensure certificates (if using certificate-based authentication instead of Windows Authentication) are valid and not expired on both partner instances.
Step 5: Re-test the Mirroring or Availability Group Connection
- Re-run the
ALTER DATABASEmirroring command or re-establish the Availability Group replica connection via SSMS. - Monitor the SQL Server Error Log and Windows Event Viewer (Application log) for confirmation that Error 1418 no longer appears.
Alternative or Verification Steps
- Use
SELECT * FROM sys.dm_hadr_availability_replica_states;(for Always On) or check the Database Mirroring Monitor in SSMS to confirm the partner server shows a Connected status instead of Disconnected. - If the issue persists after verifying network and endpoint settings, try temporarily disabling the firewall on both servers (lab/test environments only) to isolate whether the issue is strictly port-blocking related, then re-enable it with a properly scoped rule.