How to open the firewall port for SQL Server on Windows Server 2008/R2

🪶 Manual Method (Windows Firewall GUI)

Step 1: Open Control Panel → Windows Firewall → Advanced Settings.

Step 2: Click Inbound Rules → New Rule.

Step 3: Select Port, then choose TCP.

Step 4: Enter 1433 (default SQL Server port).

Step 5: Choose Allow the connection.

Step 6: Apply to Domain, Private, Public profiles as needed.

Step 7: Name the rule SQL Server Port 1433 and finish.

🪶 Automated Method (BAT File)

Save the following as OpenSQLPort.bat and run as Administrator:

@echo off
REM === Open SQL Server port on Windows Firewall ===
set PORT=1433
set RULE_NAME="SQL Server Port %PORT%"

netsh advfirewall firewall add rule name=%RULE_NAME% ^
    dir=in action=allow protocol=TCP localport=%PORT%

pause
    

🪶 How It Works

  • set PORT=1433 → Default SQL Server port (change if needed).
  • netsh advfirewall firewall add rule → Creates inbound rule.
  • protocol=TCP localport=%PORT% → Opens the port for SQL traffic.
  • pause → Keeps window open for confirmation.

🪶 Notes

⚠️ Security Tip: If you want to restrict access, add:

remoteip=192.168.1.100

This limits SQL connections to a specific server IP.

🗑️ To remove the rule later:

netsh advfirewall firewall delete rule name="SQL Server Port 1433"

🔍 Connectivity Test: After opening the port, confirm with:

telnet SERVERNAME 1433

If the connection opens, the firewall rule is working.

Applies to
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2008 Developer
  • Microsoft SQL Server 2008 Enterprise
  • Microsoft SQL Server 2008 Standard
  • Microsoft SQL Server 2008 Web
  • Windows Server 2008 Datacenter without Hyper-V
  • Windows Server 2008 Enterprise without Hyper-V
  • Windows Server 2008 for Itanium-Based Systems
  • Windows Server 2008 Standard without Hyper-V
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Standard
  • Microsoft SQL Server 2008 R2 Developer
  • Microsoft SQL Server 2008 R2 Enterprise
  • Microsoft SQL Server 2008 R2 Standard
  • Microsoft SQL Server 2008 R2 Web
  • SQL Server 2012

source – http://support.microsoft.com/kb/968872

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? Please solve:Captcha