Sql-server – Configuring SQL Server 2016 to allow remote connections

sql serversql-server-2016windows-server

I have SQL Server 2016 installed on Windows Server 2016 Core. Locally, it seems to be working. I can connect using SQLCMD.exe and do some basic selects and what not.

From remote, I cannot connect. Using SQLCMD.exe on a remote machine:

sqlcmd -S boldiq_db3
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Named Pipes 
    Provider: Could not open a connection to SQL Server [53]. .
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout 
    expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : A network-related
    or instance-specific error has occurred while establishing a connection 
    to SQL Server. Server is not found or not accessible. Check if instance 
    name is correct and if SQL Server is configured to allow remote 
    connections. For more information see SQL Server Books Online..

And from SQL Server Management Studio:

enter image description here

In the installation INI I installed from, I have:

TCPENABLED=1

So, I believe TCP is enabled. It might be a Firewall issue, but I've run:

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN

Which appears to have completed successfully. Are there any other steps to diagnose where the problem is happening? Thanks!

Best Answer

Figured it out! Since the server is running on a remote VMWare ESXi instance, the subnets are completely different. I changed:

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN

To:

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = any profile = DOMAIN

And everything immediately started working. Ugh, firewalls.