Which ports to open for Microsoft SQL Server?
Asked By: dnolan
Originally Asked On: 2009-08-29 21:19:15
Asked Via: superuser
Having searched the internet a few times on the best way to open up SQL Server connectivity through windows firewall i’ve yet to find a best way of doing it. Does anyone have a guaranteed way of finding which ports SQL is running on so you can open them in windows firewall?
He received 4 answers
eventually accepting:
David Spillett’s answer to
Which ports to open for Microsoft SQL Server?
If you only have one instances of SQL Server running, and it has the TCP/IP transport enabled for non-local connections, then chances are it will be listening in the default TCP port: 1433.
If you have multiple instances, or any other complications above “a single, default, instance”, then things may be more complicated. You will need to set the ports for each instance (by default they are semi-random which is not generally helpful for firewall configuration) and will need to open the SQL Browser Service too (which usually listens on TCP port 1434, though this too can be reconfigured).
There is a fairly detailed set of notes on SQL Server and firewalls at http://msdn.microsoft.com/en-us/library/cc646023.aspx
The answer with the highest score with 4 points was:
Robert Gannon’s answer to
Which ports to open for Microsoft SQL Server?
You will need to start browser service to resolve non-default instances. Additionally, opening UDP 1434 will allow resolution of the named instances by name instead of port, so you will not need to use the ports. If you are uncomfortable opening UDP 1434 long-term, or you have a DBA who is on-site and can connect locally, you may ask them to connect via SQL Server Mgmt Studio OR SQLCMD and specifiy the server connection as follows:
tcp:servername\instancename
prefixing with tcp will force a tcp connection. Once this is done, you may connect to your named instance and query sys.dm_exec_connections to find the port the non-default instance is running on like so:
SELECT local_tcp_port FROM sys.dm_exec_connections WHERE session_id = @@SPID
If the selected answer did not help you out, the other answers might!
All Answers For: Which ports to open for Microsoft SQL Server?
Brad’s answer to
Which ports to open for Microsoft SQL Server?
The Default port for SQL Server is 1433
David Spillett’s answer to
Which ports to open for Microsoft SQL Server?
If you only have one instances of SQL Server running, and it has the TCP/IP transport enabled for non-local connections, then chances are it will be listening in the default TCP port: 1433.
If you have multiple instances, or any other complications above “a single, default, instance”, then things may be more complicated. You will need to set the ports for each instance (by default they are semi-random which is not generally helpful for firewall configuration) and will need to open the SQL Browser Service too (which usually listens on TCP port 1434, though this too can be reconfigured).
There is a fairly detailed set of notes on SQL Server and firewalls at http://msdn.microsoft.com/en-us/library/cc646023.aspx
Robert Gannon’s answer to
Which ports to open for Microsoft SQL Server?
You will need to start browser service to resolve non-default instances. Additionally, opening UDP 1434 will allow resolution of the named instances by name instead of port, so you will not need to use the ports. If you are uncomfortable opening UDP 1434 long-term, or you have a DBA who is on-site and can connect locally, you may ask them to connect via SQL Server Mgmt Studio OR SQLCMD and specifiy the server connection as follows:
tcp:servername\instancename
prefixing with tcp will force a tcp connection. Once this is done, you may connect to your named instance and query sys.dm_exec_connections to find the port the non-default instance is running on like so:
SELECT local_tcp_port FROM sys.dm_exec_connections WHERE session_id = @@SPID
Arshia’s answer to
Which ports to open for Microsoft SQL Server?
Maybe it is useful to change the default port of your instance
Have you seen http://blogs.msdn.com/b/dataaccesstechnologies/archive/2010/03/03/running-sql-server-default-instance-on-a-non-default-or-non-standard-tcp-port-tips-for-making-application-connectivity-work.aspx?
Of course, you should really check out the original question.
The post Which ports to open for Microsoft SQL Server? [ANSWERED] appeared first on Tech ABC to XYZ.