I\'d like to reserve a TCP port, to be bound by a service later, so that Windows doesn\'t inadvertently use the same number when assigning random port numbers. I know this is po
As mentioned by @vahapt you can modify the dynamic port range using netsh
.
However, a better solution may be to use netsh to reserve the ports required by your application, leaving alone the default range of dynamic ports.
To do so:
Stop any processes using the ports to be reserved. If a process is using a port included in the range of ports to be reserved, NETSH will return the following error and the reservation will fail:
The process cannot access the file because it is being used by another process.
Use the following NETSH command to reserve the ports:
netsh int
For example, to reserve ports 55368-55372 for UDPv6, use the command:
netsh int ipv6 add excludedportrange protocol=udp startport=55368 numberofports=5
Notes:
See https://support.microsoft.com/en-us/kb/929851 for more information, including how to view or delete existing port reservations.