Sometime Windows 10 updates cause dynamic port ranges to get changed, and you end up with issues where the port that you have been using is now taken.
I had the bizarre experience where port
1433 was taken.
How to solve?
There’s well know Windows utility called
netsh that you can use to add, remove or update dynamic port ranges, but first you should make sure that your port
ranges are actually wrong.
int ipv4 show dynamicport tcp
If you port(s) are belong to any of the resulting ranges, that means that you need to fix them, if they are not you might want to stop reading this.
In order to change the dynamic port range run the below command accompanied by values that make sense to your use case:
int ipv4 set dynamicportrange protocol=tcp startport=50000 numberofports=10000
or you can use the command below if you just want to exclude your port for the dynamic port set range:
int ipv4 add excludedportrange protocol=tcp startport=50000 numberofports=10000 store=active
The command below will set the dynamice port range between
60000, which may or may not suite your needs. Arguments are pretty much self explanatory,
but just in case:
- protocol: you can choose between
- startport: the starting port for the dynamic port range
- numberofports: the number of ports that are going to be available for the dynamic assignment
active- temporary set that last until next machine reboot, or
persistent- set is permanently stored, this is the default value
In case you want to double check what’s excluded your can run this:
netsh int ipv4 show excludedportrange protocol=tcp
Note: You can exclude several different ranges using the same technique, for example if you want to exclude 2 ports:
60204, you would run these:
int ipv4 add excludedportrange protocol=tcp startport=53500 numberofports=1 int ipv4 add excludedportrange protocol=tcp startport=60204 numberofports=1
Network Shell or
netsh is a powerful utility where
int ipv4 is just one of the many contexts that are available, you can hit the
docs if you want to learn more.