Skip Navigation Links
Home
Articles
SQL Server 2012
SQL Server 2014
SQL Server 2016
FAQ
Practice Test
Tip of the Day : Example Uses of the CHOOSE Logical Function
SQL Server 2008

Home > SQL Server 2008 > SQL Server 2008 to Windows Server 2008 Connection Error 1326
SQL Server 2008 to Windows Server 2008 Connection Error 1326

Having installed SQL Server 2008 on a Windows Server 2008 with a firewall, all along I thought it's just a matter of allowing SQL Server's port 1433 in the Windows Firewall to accept incoming connections and everything should be just fine.  But unfortunately, this was not the case because I was not able to connect to SQL Server.

Windows Firewall on Windows Server 2008 helps prevent unauthorized access to computer resources.  However, if the firewall is configured incorrectly, which is the case I am in, attempts to connect to an instance of SQL Server may be blocked.  To access an instance of SQL Server that is behind the firewall, the firewall must be configured on the computer that is running SQL Server.

After adding SQL Server's port 1433 to my firewall to accept incoming network connections, I get the following error message:

Cannot connect to 10.10.10.1

Additional Information

A network-related or instance-specific error occurred while establishing a connection to SQL Server.  The server was not found or was not accessible.  Verify that the instance name is correct and that SQL Server is configured to allow remote connections.  (provider: Named Pipes Provider, error:40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 1326).

Automatically Opening the Firewall Port for SQL Server on Windows Server 2008

To fix the problem automatically, download the fix from the following link: Microsoft Fix it 50169.  Click Run in the File Download dialog box, and then follow the steps in the wizard.  Alternatively, instead of clicking on Run, you may opt to click on Save to save the file locally before running it.  This may be useful so that you can simply copy the file to all your servers that you want to open the firewall port for SQL Server.

The wizard may be in English only; however, the automatic fix also works for other language versions of Windows.

Reference: How do I open the firewall port for SQL Server on Windows Server 2008?

Manually Opening the Firewall Port for SQL Server on Windows Server 2008

The following script and the procedure in executing the script opens the firewall ports for SQL Server.

To create the script, follow these steps:

  1. Start Notepad.
  2. Copy and paste the following code into Notepad:
    @echo =========  SQL Server Ports  ===================
    @echo Enabling SQLServer default instance port 1433
    netsh firewall set portopening TCP 1433 "SQLServer" 
    @echo Enabling Dedicated Admin Connection port 1434
    netsh firewall set portopening TCP 1434 "SQL Admin Connection" 
    @echo Enabling conventional SQL Server Service Broker port 4022  
    netsh firewall set portopening TCP 4022 "SQL Service Broker" 
    @echo Enabling Transact-SQL Debugger/RPC port 135 
    netsh firewall set portopening TCP 135 "SQL Debugger/RPC" 
    @echo =========  Analysis Services Ports  ==============
    @echo Enabling SSAS Default Instance port 2383
    netsh firewall set portopening TCP 2383 "Analysis Services" 
    @echo Enabling SQL Server Browser Service port 2382
    netsh firewall set portopening TCP 2382 "SQL Browser" 
    @echo =========  Misc Applications  ==============
    @echo Enabling HTTP port 80 
    netsh firewall set portopening TCP 80 "HTTP" 
    @echo Enabling SSL port 443
    netsh firewall set portopening TCP 443 "SSL" 
    @echo Enabling port for SQL Server Browser Service's 'Browse' Button
    netsh firewall set portopening UDP 1434 "SQL Browser" 
    @echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
    netsh firewall set multicastbroadcastresponse ENABLE 
    
  3. Save the file as a .txt file by using the following name: OpenSqlServerPort.txt
  4. Rename the OpenSqlServerPort.txt file to the following: OpenSqlServerPort.bat

Copy the OpenSqlServerPort.bat file to the computer which has the firewall that has the SQL Server 2008 installed and run the script on that computer.  To run the script, follow these steps:

  1. Click Start, click Run, type cmd, and then click OK.
  2. At the command prompt, use the cd command to navigate to the folder in which you saved the OpenSqlServerPort.bat file.
  3. To run the script, type OpenSqlServerPort.bat at the command prompt, and then press ENTER.

Reference: How do I open the firewall port for SQL Server on Windows Server 2008?

Related Articles :