Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
Discover what is Excluding Ports in Windows
I recently hit an issue on Windows where an application was not able to bind to a specific port (1883 for RabbitMQ MQTT). I followed the normal steps of using Resource Monitor to check for ports that were in use. I also checked WSL with netstat -lntu to see if Linux was using the port. But everything indicated the port was not in use.
Eventually I discovered that though the port was not actively in use it was excluded from use. The full list of port ranges excluded from use can be discovered with the following command:
netsh interface ipv4 show excludedportrange protocol=tcp
It indicated a large number of port ranges that were excluded but not in use. After some searching I stumbled across the following that removed the port I needed from exclusion:
net stop winnat
net start winnat
This resolved my immediate problem, but it is not clear how these ports were excluded in the first place.
Is there a method to determine which application or service is excluding ports from use?
I suspect this will come up again, and would like to know how I can find the source of the problem and remove it, rather than having to react to it every time it happens.

0 comment threads