Return to Level1Techs.com

Stubborn Windows Firewall?

I’ve installed MS SQL in a VPS, and set it up to allow remote connections so that I can connect to it using SQL Server Management Studio on a local machine.

With Windows Firewall turned OFF in the VPS, I am able to connect to this from a local machine. When Windows Firewall is turned ON in the VPS, I am not able to connect.

MS SQL Server is using port 1433. In SQL Server Management Studio the port is specified to be 1433 when I connect. I’ve added inbound rule in Windows Firewall to allow connections on port 1433.

Any have any ideas? :frowning:

Have you allowed the port on the correct profile?

1 Like

Currently the Profile shows as ‘All’ in the list (Domain, Private, and Public is checked when looking at the properties of the rule.)

Ok, I guess I just solved the problem. face palm

The short answer is, at one point I had updated the rule so that not only did I have “Local port” set to 1433, but also changed “Remote port” to specify 1433 instead of the default ‘All ports’. Once I changed that back to the default, it let me connect.

Now, why did I change that in the first place? Well, originally I had misconfigured the MS SQL Server in regards to allowing remote connections. So, while troubleshooting during that time I made the Remote ports change in Windows Firewall mentioned above and forgot about it.

When you asked if I had chose the correct profile, I noticed that while digging around again.

Thanks. :slight_smile:

2 Likes

Since im learning PowerShell I found this command Get-NetFirewallRule

Which you can in turn run as so (at least one way)

Get-NetFirewallRule | where {$_.DisplayName -eq '<name of rule>'}
2 Likes

Another useful PowerShell command is Test-NetConnection

e.g.

Test-NetConnection -port 1433 -computername SQLServerA

The best bit about this command is that it checks the port, if that fail it tries to ping the server, so it quickly tells you if you may have a firewall issue regarding that port.

People should also watch out if using dynamic ports and the SQL Browser service listening UDP 1434 with only that and the default TCP 1433 port open in the firewall. That one can really send admins new to SQL Server in circles :smiley:

2 Likes