So, this is only a simple blog post as a notes for me, well, anyone who needs this can also save this post. Long story short, Hyper-V mess up with port configuration on my Windows 10 (On ASUS A43SV). This laptop isn’t my main laptop, but have better quad core CPU, just bulky, I never bring it to work for 2 years. Last Tuesday update suddenly break a lot of local server service like MySQL, MS SQL, PHP, Node, anything that try to listen to well known port.
First I tried to check using netstat -an | findstr 1433
, or any port that is in the netstat, seems nothing pop up… I really frustated, at least MS SQL works with name pipe, so I disabled port listening on the SQL Server Manager (well this is windows, so yeah), at least make me able to work with ASP.NET Core MVC Project. Tbh, I been away from Windows for past 2-3 years, only firing VM for Office or Games. I thinking to clean install the windows, because I think probably there are some Tuesday update that broke this Installation.
Until I tried to browse and search in Bing regarding port forbidden listen using search query “service is forbidden port windows 10”, and a bunch of answer popping up (it’s better than Google result, dunno why, since March 2023 with Chat GPT3, seems Bing result is well tailored than Google). So there are also a blog post that say that Windows 10 port bind is broken because of Hyper-V [1]. I do use Hyper-V for some simple server like Fedora 37 and some WSL2. I tried to set the whole port to be excluded, sadly it doesn’t work. Until I find a registry answer from StackOverflow Comments [2] (what a glorious day to use stackoverflow, eh). So it’s quite simple to disable reserved port by Hyper-V. We can run this command as administrator :
reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f
After that, you can reboot, and try to check using
netsh interface ipv4 show excludedportrange protocol=tcp
If the port still broken, well.. the only option to make it work is disabling NAT, using command as administrator :
net stop winnat
That command will break any WSL and HyperV with NAT network, until restart/starting the NAT service. Hope this helps.
Resource :
[1] https://pomeroy.me/2020/09/solved-windows-10-forbidden-port-bind/#comment-651290
[2] https://stackoverflow.com/questions/48478869/cannot-bind-to-some-ports-due-to-permission-denied#comment103598856_54727281
Leave a Reply. I will come back and maybe we can have some conversation 🙂