Sql-server – Restrict range of dynamic ports available to SQL Server

dynamic-portssql serversql-server-2008-r2windows

Is there a way to limit the range of dynamic ports available to SQL Server from the database side, or database server side? Our SOP is to use static ports across the network firewall and a vendor is having trouble locking down their ports. Theoretically, if we allowed a range of 1000 ports inside the dynamic range (49152–65535) across the firewall how would I limit SQL Server to only assign a dynamic port inside that range?

Best Answer

As Cougar9000 found out himself the usage of ephemeral (dynamic) ports is not managed by the application but by the operating system. You can only change it for the whole server.

The answer to this question does provide you with the information and links you need.

In short you could do

netsh int ipv4 set dynamicport tcp start=50000 num=1000

Please note that making the range too small may result in TCP/IP Port Exhaustion.