Original: Configure Windows Firewall to allow remote access to the database using the TCP/IP protocol
This article applies to: 2005, 2008, 2008r2 all versions
In order to remotely access the SQL Server database through the TCP/IP protocol, the following points are required:
On servers running SQL Server, we must locate the port that SQL Server listens on and then add it to the "Allow inbound" Windows Firewall.
One: The port of SQL Server needs to be added to the firewall's inbound rules.
Two: If you cannot determine the port of the connection string, or if SQL Server is not listening on TCP 1433, add the UDP 1434 port that the SQL Server Browser service listens to in Windows Firewall. This is because:
A) If the TCP port is explicitly specified by the connection string, then a connection provider such as SQL Native client will use this port to connect to SQL Server, so SQL Server is not required at this time Browser service to find the appropriate port that SQL Server listens on.
b), if the port is not explicitly defined by the connection string, then the connection provider sends a UDP packet to port 1434. Therefore, if port 1434 is not turned on in Windows Firewall, the connection provider will not get the appropriate TCP port that SQL Server listens on. The connection provider then connects SQL Server with only 1433来. If SQL Server does not listen on port 1433 at this point, it will return a failure. Therefore, you also need to add the UDP1433 port to the Windows Firewall inbound rules.
In order to find out which port the SQL Server lock listens to, you can use the following steps:
1. Open SQL Server Configuration Manager
2. Under SQL Server Network Configuration node, click the protocol for the corresponding instance name. Double-click tcp/ip→ to switch to the IP Address tab, where you can find all ports that SQL Server listens on for each IP address or ports specified by all IP addresses.
NOTE: If SQL Server listens on a dynamic port, the table will be restarted after each reboot. So, you must find the port it is currently listening on, and then add it to Windows Firewall.
To allow remote access to the database by using the TCP/IP protocol by configuring Windows Firewall