Tietämyskanta

Windows Server: How to Open Ports for Microsoft SQL Server in Windows Firewall



Article Summary: This article provides information about opening Windows Firewall ports for Microsoft SQL Server.


Typically, the Microsoft SQL Server installer will open the appropriate ports in Windows Firewall when the application is installed. In some situations, however - for example, if the firewall is disabled when SQL Server is installed - it may be necessary to manually open the required ports. The following text includes the netsh commands used to open Windows Firewall ports for SQL Server. The text can be copied into a text editor such as Notepad and saved with a .bat extension to create a batch file that will quickly open the ports.

Note that the text below is divided into two sections. This is because the preferred Netsh.exe context for managing Windows Firewall changed from netsh firewall in Windows Server 2003 to netsh advfirewall in Windows Server 2008 and later, and the corresponding commands changed accordingly. The top section should be used in Windows Server 2003, while the bottom section should be used in later versions.

Windows Server 2003:

@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

Windows Server 2008 and Later Versions:

@echo ========= SQL Server Ports ===================
@echo Enabling SQLServer default instance port 1433
netsh advfirewall firewall add rule name="SQLServer" dir=in action=allow protocol=tcp localport=1433
@echo Enabling Dedicated Admin Connection port 1434
netsh advfirewall firewall add rule name="SQL Admin Connection" dir=in action=allow protocol=tcp localport=1434
@echo Enabling conventional SQL Server Service Broker port 4022
netsh advfirewall firewall add rule name="SQL Service Broker" dir=in action=allow protocol=tcp localport=4022
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh advfirewall firewall add rule name="SQL Debugger/RPC" dir=in action=allow protocol=tcp localport=135
@echo ========= Analysis Services Ports ==============
@echo Enabling SSAS Default Instance port 2383
netsh advfirewall firewall add rule name="Analysis Services" dir=in action=allow protocol=tcp localport=2383
@echo Enabling SQL Server Browser Service port 2382
netsh advfirewall firewall add rule name="SQL Browser" dir=in action=allow protocol=tcp localport=2382
@echo ========= Misc Applications ==============
@echo Enabling HTTP port 80
netsh advfirewall firewall add rule name="HTTP" dir=in action=allow protocol=tcp localport=80
@echo Enabling SSL port 443
netsh advfirewall firewall add rule name="SSL" dir=in action=allow protocol=tcp localport=443
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh advfirewall firewall add rule name="SQL Browser Browse Button" dir=in action=allow protocol=udp localport=1434
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh advfirewall set currentprofile settings unicastresponsetomulticast enable




Quick Tips content is self-published by the Dell Support Professionals who resolve issues daily. In order to achieve a speedy publication, Quick Tips may represent only partial solutions or work-arounds that are still in development or pending further proof of successfully resolving an issue. As such Quick Tips have not been reviewed, validated or approved by Dell and should be used with appropriate caution. Dell shall not be liable for any loss, including but not limited to loss of data, loss of profit or loss of revenue, which customers may incur by following any procedure or advice set out in the Quick Tips.

Artikkelin tunnus: SLN163304

Muokattu viimeksi: 09/24/2014 02:50 PM


Arvostele tämä artikkeli

Tarkka
Hyödyllinen
Helppo hahmottaa
Oliko tästä artikkelista hyötyä?
Kyllä Ei
Lähetä meille palautetta
Kommenteissa ei voi olla seuraavia erikoismerkkejä: <>()\
Pahoittelumme, palautejärjestelmä ei ole nyt käytettävissä. Yritä myöhemmin uudelleen.

Kiitos palautteestasi.