我在 Windows 10 中启用了 hyper-v。当我检查排除的端口时,我得到:
C:\> netsh interface ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
5357 5357
9800 9800
9801 9801
49671 49770
49871 49970
50000 50059 *
61117 61216
61220 61319
61902 62001
* - Administered port exclusions.
Run Code Online (Sandbox Code Playgroud)
为什么 Hyper-V 保留这些端口?
受管端口排除(即范围 50000-50059 )与其他端口排除有何不同?
例如,当我尝试在 golang 中使用 net.Listen() ping 所有这些端口时,除 50000-50059 之外的所有端口都返回错误:
listen tcp 127.0.0.1:9801: bind: An attempt was made to access a socket in a way forbidden by its access …Run Code Online (Sandbox Code Playgroud)