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?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
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
Please note that making the range too small may result in TCP/IP Port Exhaustion.
Here's the start of a PowerShell solution as I mentioned in the comments:
I'm not sure if this is going to be appropriate for the exact situation, but it might help someone out there.
I have not found a way to do this, and am going to assume you can't. So, official answer is no, you cannot restrict the range on the SQL side. If any body finds a way to do it or a work around on the server side that works please share.