Back to Article List

Enable remote connections to SQL Server

Enable remote connections to SQL Server - Enable remote connections to SQL Server

Updated and tested 7 October 2026

Almost every "I can't reach SQL Server from my laptop" ticket comes down to one of seven things, and they fail in a predictable order. Walking that order from the top takes five minutes. Guessing takes an afternoon and usually ends with somebody switching the firewall off to see if that helps, discovering that it does, then leaving it off. Let's not do that.

Here's the sequence, then each step with the commands for Linux and for Windows.

The order a SQL Server remote connection fails in

  1. The service is running at all
  2. TCP/IP is enabled as a protocol on the instance
  3. The instance is listening on an address the client can reach
  4. The host firewall allows the port
  5. The provider or cloud firewall allows the port
  6. The name resolves to the address you think it does
  7. The login exists and is allowed to authenticate

Steps one to three are server side and cost nothing to check. Four and five are the network. Six and seven are the ones people check first, and they sit at the bottom for a reason: a DNS or password problem produces a completely different failure from a dropped packet, so proving the path first tells you which half of the problem you are in.

Four and five are interchangeable, so check whichever is quicker to reach from where you are sitting. Neither one tells you anything about the other, and the order between them has never mattered to me once.

Six I skip. I connect by IP address on the first attempt every time, which takes name resolution out of the picture, and I only go back to DNS when the IP works and the hostname does not. That combination is rare and it is never the first thing wrong.

Confirm the service is running and listening

On Linux:

systemctl status mssql-server --no-pager
sudo ss -lntp | grep 1433

Both of those want root before they will show you the process column.

When nothing shows on 1433 at all, rule out a different TCP port before anything else, and on a named instance that is the normal case. Otherwise the ss output tells you what you need. A listener on 0.0.0.0:1433 is bound to every interface. A listener on 127.0.0.1:1433 answers nothing from outside the box no matter how open your firewall is.

On Windows, from an elevated PowerShell prompt:

Get-Service MSSQLSERVER
Get-NetTCPConnection -State Listen -LocalPort 1433

Enable TCP/IP on Windows

Fresh Windows installs of SQL Server frequently have TCP/IP disabled, especially Express. Shared memory works, so local tools connect fine and everything looks healthy from the console. Remote clients get nothing.

Configuration Manager

Run SQLServerManager17.msc (SQL Server 2025) or SQLServerManager16.msc (2022) from C:\Windows\SysWOW64. Expand SQL Server Network Configuration, select Protocols for your instance name, right-click TCP/IP and select Enable. Then select SQL Server Services, right-click SQL Server for that instance and select Restart.

Microsoft's page on enabling a server network protocol makes two points worth carrying with you. The engine has to be stopped and restarted before the change takes effect, and named instances want the SQL Server Browser service restarted as well.

PowerShell with the SqlServer module

The click path doesn't script, so for anything repeatable use the SMO management objects:

Import-Module SqlServer
$wmi = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer
$uri = "ManagedComputer[@Name='SQL01']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol[@Name='Tcp']"
$Tcp = $wmi.GetSmoObject($uri)
$Tcp.IsEnabled = $true
$Tcp.Alter()
Restart-Service -Name MSSQLSERVER -Force

Swap SQL01 for the machine name and MSSQLSERVER for the instance name if it isn't the default. Running $wmi on its own prints the object including the instance names it can see, which is the quickest way to get the string right on a server you didn't build.

That snippet lives in a file I paste from. The rest of the ManagedComputer object is a mystery to me and I have been happy to leave it that way.

Linux network settings in mssql-conf

There's no protocol switch to flip on Linux. TCP is how SQL Server talks there, it's on from the first start and the settings that exist live in /var/opt/mssql/mssql.conf under the network section. network.tcpport sets the TCP port. network.forceencryption takes 0 or 1 and makes TLS mandatory for every client. network.tlscert and network.tlskey take absolute paths to a certificate and its private key. Read the current state with:

sudo cat /var/opt/mssql/mssql.conf

If the file has no network section at all, that's fine and expected. Defaults don't get written out until you set something.

SQL Server firewall ports: open port 1433 on the host

ufw on Ubuntu

sudo ufw allow from 203.0.113.10 to any port 1433 proto tcp
sudo ufw status numbered

Microsoft's Ubuntu quickstart gives no firewall command at all, only prose saying you may need to open TCP 1433, so treat the syntax above as ufw's and not as Microsoft's. And yes, sudo ufw allow 1433/tcp is shorter. It also opens the port to the entire internet, and I've lost count of how many times I've found that rule on a server whose owner believed the database was private. Scope it to the source address you connect from.

firewalld on RHEL

sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

That pair is verbatim from Microsoft's Red Hat quickstart, and it is wide open by design. The scoped version goes through a rich rule:

sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="203.0.113.10/32" port port="1433" protocol="tcp" accept'
sudo firewall-cmd --reload

Windows Defender Firewall

Straight from Microsoft's guidance on configuring the Windows firewall for SQL Server access:

New-NetFirewallRule -DisplayName "SQLServer default instance" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "SQLServer Browser service" -Direction Inbound -LocalPort 1434 -Protocol UDP -Action Allow

Add -RemoteAddress 203.0.113.10 to either line to restrict the source. The same page also offers a netsh one-liner, and this is where a lot of people get stuck:

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

Read the tail of that command. It's scoped to localsubnet and to the DOMAIN profile. Paste it onto a standalone VPS that isn't domain joined, connecting from an address on a different subnet, and the rule is technically present and doing precisely nothing for you. That line gets copied constantly in SQL Server firewall troubleshooting, and it's why so many of the copies don't work.

The provider firewall in front of the server

Host firewall open and still timing out? There's usually a second one. Most providers put a network filter ahead of the instance, so a packet gets dropped before it ever reaches iptables. On LumaDock VPS plans the firewall rules and the private networking both live in the control panel, and what I'd push for is putting the database on the private interface and never giving it a public listener at all. Two rules to write, and the second one is why nobody scans your database.

Test the connection from the client

Test the transport before you test the credentials:

Test-NetConnection 203.0.113.5 -Port 1433
nc -vz 203.0.113.5 1433

Test-NetConnection prints ComputerName, RemoteAddress, RemotePort, InterfaceAlias, SourceAddress and a TcpTestSucceeded boolean, and that boolean is the field you read. nc -vz prints one line per port and exits 0 on success, so it drops into a shell script with no parsing.

Then a real login:

sqlcmd -S 203.0.113.5,1433 -U sa -C -Q "SELECT @@SERVERNAME"

Test-NetConnection is slower than it looks. It resolves the name and pings before it ever tests the port, so on a host that drops ICMP the ping stage sits there for its full timeout before the useful part runs. -InformationLevel Quiet trims the output and not the wait. Different tools, different decades.

Timeout, refused and login failed

Each one points somewhere different, and telling them apart saves you from changing the wrong thing:

  • Hangs then times out (TcpTestSucceeded : False after a long pause). Packets are being dropped before they arrive, which means a firewall on the host or in front of it, and nothing on the server ever saw your connection.
  • Connection refused, immediately. You reached the machine and something actively said no. The service is down, or it's listening on a different port, or it's bound to loopback only.
  • Login failed for user. Congratulations, the network works. You're now in authentication territory, which is error 18456 and its states.

A fourth one shows up with named instances. Error 26, error locating server or instance specified, means the client's UDP request to the Browser went unanswered, and connecting with an explicit port sidesteps it without touching the Browser at all.

Your idea deserves better hosting

24/7 support 30-day money-back guaranteeRefund covers the VPS plan on your first order. Cancel anytime
Billing Cycle

VPS.S1

23.26 zł Save  17 %
19.38 zł Monthly
  • 2 vCPU AMD EPYC
  • 2 GB RAMMEMORY
  • 30 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included

VPS.S3

58.21 zł Save  33 %
38.80 zł Monthly
  • 4 vCPU AMD EPYC
  • 6 GB RAMMEMORY
  • 70 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included

VPS.S4

77.63 zł Save  20 %
62.10 zł Monthly
  • 6 vCPU AMD EPYC
  • 8 GB RAMMEMORY
  • 80 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included

EPYC VPS.P1

34.91 zł Save  22 %
27.15 zł Monthly
  • 2 vCPU AMD EPYC
  • 4 GB RAMMEMORY
  • 40 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

EPYC VPS.P2

65.98 zł Save  24 %
50.45 zł Monthly
  • 2 vCPU AMD EPYC
  • 8 GB RAMMEMORY
  • 80 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

EPYC VPS.P4

116.46 zł Save  23 %
89.28 zł Monthly
  • 4 vCPU AMD EPYC
  • 16 GB RAMMEMORY
  • 160 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

EPYC VPS.P5

155.30 zł Save  25 %
116.46 zł Monthly
  • 8 vCPU AMD EPYC
  • 16 GB RAMMEMORY
  • 180 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

EPYC VPS.P6

232.97 zł Save  25 %
174.72 zł Monthly
  • 8 vCPU AMD EPYC
  • 32 GB RAMMEMORY
  • 200 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

EPYC VPS.P7

271.80 zł Save  29 %
194.13 zł Monthly
  • 16 vCPU AMD EPYC
  • 32 GB RAMMEMORY
  • 240 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

Genoa VPS.G2

97.05 zł Save  20 %
77.63 zł Monthly
  • 2 vCPUAMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture. AMD EPYC G4
  • 4 GB DDR5MEMORY
  • 50 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

Genoa VPS.G4

174.71 zł Save  22 %
135.88 zł Monthly
  • 4 vCPUAMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture. AMD EPYC G4
  • 8 GB DDR5MEMORY
  • 100 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

Genoa VPS.G6

349.47 zł Save  22 %
271.80 zł Monthly
  • 8 vCPUAMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture. AMD EPYC G4
  • 16 GB DDR5MEMORY
  • 200 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

Genoa VPS.G7

621.31 zł Save  22 %
485.39 zł Monthly
  • 8 vCPUAMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture. AMD EPYC G4
  • 32 GB DDR5MEMORY
  • 250 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included
  • Free auto backupsIncludes one backup slot you can set to run daily, weekly or monthly.

AMD Ryzen VPS.R1

65.98 zł Save  18 %
54.33 zł Monthly
  • 1 dedicated CPU AMD Ryzen 9 7950X with 4.5 GHz or similar, on Zen 4 architecture. vCPU
  • 4 GB DDR5MEMORY
  • 50 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • Auto backup included

AMD Ryzen VPS.R2

116.46 zł Save  17 %
97.05 zł Monthly
  • 2 dedicated CPUs AMD Ryzen 9 7950X with 4.5 GHz or similar, on Zen 4 architecture. vCPU
  • 8 GB DDR5MEMORY
  • 100 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • Auto backup included

AMD Ryzen VPS.R4

427.14 zł Save  18 %
349.47 zł Monthly
  • 8 dedicated CPUs AMD Ryzen 9 7950X with 4.5 GHz or similar, on Zen 4 architecture. vCPU
  • 32 GB DDR5MEMORY
  • 400 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • Auto backup included

*VAT excluded.

INCLUDED WITH EVERY PLAN

✓ No setup fees ✓1 Gbps network
✓ Full root access on KVM ✓ Free server monitoring ✓ Firewall management ✓24/7 support

Private networking, VPN and SSH tunnels

TCP 1433 should not be reachable from the public internet. Not on a random high port either. The exposure buys you convenience and costs you a permanent stream of authentication attempts against sa from hosts you will never identify, and I have yet to watch that trade come out well for anybody.

The alternatives are cheap. A private network between your application server and your database server keeps the traffic off the public interface completely. A VPN handles the case where developers need direct access from laptops. For a one-off, an SSH local forward takes about ten seconds:

ssh -N -L 14330:127.0.0.1:1433 [email protected]

Point your client at localhost,14330 and let SSH carry the session. That is most of what anybody needs to connect to SQL Server remotely without leaving a listener on the public interface. I use 14330 on the local side because a developer machine with SQL Server installed already has 1433 taken, and the error you get from the collision is confusing. Works fine with SSMS pointed at the local end of the tunnel too.

Force encryption with a real certificate

Once the connection works, encrypt it. On Linux the certificate and key go in first, then the switch:

sudo /opt/mssql/bin/mssql-conf set network.tlscert /etc/ssl/certs/mssql.pem
sudo /opt/mssql/bin/mssql-conf set network.tlskey /etc/ssl/private/mssql.key
sudo /opt/mssql/bin/mssql-conf set network.forceencryption 1
sudo systemctl restart mssql-server

The mssql user has to be able to read both files, so check ownership before you restart. A permission problem here shows up as a service that won't come back, and not as a clear error. Use a certificate whose subject matches the hostname clients connect with. Skip that and every client falls back to trusting whatever it's handed, which is how TrustServerCertificate=True creeps into production config files and stays there for years.

Once the server has a certificate worth validating, the rest of the job is on the client. Every driver names the same two settings differently in its connection string, which is most of the difficulty.

Questions?

How do I verify that SQL Server is configured to allow remote connections?

Test from another machine, because no single server setting answers it. The "Allow remote connections to this server" box in SSMS server properties belongs to the remote access option, which Microsoft describes as controlling stored procedure execution between servers, a deprecated feature that is on by default. Client connections from other hosts depend on TCP/IP and an open port, so a login from a remote sqlcmd is the real check.

Jörg L. Günther
About the author

Jörg L. Günther

Jörg has spent much of his career in enterprise software, working first with database deployments and customer environments, then in technical training and documentation. Since then he has written for companies working in virtualisation, database tooling and cloud infrastructure. The subjects he takes on often have a large operational component: database migrations, high-availability setups, storage configuration and procedures carried out on live systems. Jörg lives near Frankfurt. He plays piano and cycles for transport as much as for recreation. He's also been doing woodworking for several years - he says most of the furniture in his study is his own work.

Deploy your next project in seconds

Bring your winning ideas online faster, with modern hardware and unmetered bandwidth. Join a European cloud trusted by thousands of developers and businesses worldwide.