Configuring SQL Server to allow remote connections is a common requirement for distributed applications and centralized database management. By default, a fresh installation of Microsoft SQL Server listens only on the local machine, blocking access from other computers for security reasons. This guide walks through the essential steps, from enabling network protocols to adjusting the firewall, ensuring a secure and reliable remote connection setup.
Understanding SQL Server Network Configuration
Before making changes, it is important to understand how SQL Server handles network communication. The Database Engine uses a component called the SQL Server Network Interface, which relies on specific protocols like TCP/IP and Named Pipes. Each protocol must be enabled individually, and the server must be configured to listen on the correct IP addresses and ports. Misconfigurations at this stage are the primary cause of connection failures, so verifying each setting carefully is crucial.
Enabling Protocols via SQL Server Configuration Manager
The SQL Server Configuration Manager is the primary tool for managing network settings. To open it, search for the tool in the Windows Start menu and run it as an administrator. Navigate to SQL Server Network Configuration and then to Protocols for your instance name. Here, you must ensure that TCP/IP is enabled; right-click the protocol and select Enable to allow the server to accept remote network requests.
Configuring TCP/IP Properties
After enabling TCP/IP, double-click the protocol to open its Properties window. The IP Addresses tab contains a series of sections for IPv4 and IPv6 addresses. Key settings to adjust include the IPAll section, where you can specify the TCP Port, typically 1433 for the default instance. Setting the Enabled field to Yes for both IP6 and IP4 ensures the server listens on all available network interfaces, which is necessary for most remote access scenarios.
Adjusting the Windows Firewall
Even with the correct SQL Server configuration, the Windows Firewall may block incoming traffic on the SQL port. To resolve this, you need to create an inbound rule that explicitly allows traffic on port 1433. Open Windows Defender Firewall with Advanced Security, create a new rule for Port, specify TCP and the specific port number, and choose to allow the connection. Assigning the rule to Domain, Private, and Public profiles maximizes compatibility across different network environments.
Verifying the SQL Server Service Startup Account
The service account under which the SQL Server instance runs determines the security context for network operations. It is recommended to use a dedicated domain account with minimal privileges rather than the default local system account. This practice improves security and ensures consistent network authentication. You can verify and change the startup account in SQL Server Configuration Manager under the SQL Server Services section, followed by a service restart to apply the changes.
Testing the Remote Connection
Once the server settings and firewall rules are in place, testing the connection from a client machine is the final verification step. Using SQL Server Management Studio (SSMS) or the sqlcmd utility, attempt to connect using the server's IP address or hostname and the specified port. If the connection fails, tools like Telnet or Test-NetConnection can confirm whether the port is open and reachable, helping to isolate network issues from configuration errors.