Port Forward and Expose on Windows Server



Expose port, open PowerShell run as administrator

$ New-NetFirewallRule -Name db2port50000 -DisplayName 'db2port50000' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 50000


Check first list avalability, open cmd run as administrator.

$ netsh interface portproxy show all


If there was available active port, kill before re-forward port.

$ netsh interface portproxy delete v4tov4 listenport=50000 listenaddress=0.0.0.0


Re-add previous port.

$ netsh interface portproxy add v4tov4 listenport=50000 listenaddress=0.0.0.0 connectport=50000 connectaddress=127.0.0.1

Comments