Skip to content

Instantly share code, notes, and snippets.

@alirezanet
Last active October 5, 2024 00:01
Show Gist options
  • Save alirezanet/6994199a56194a23fa31916857726878 to your computer and use it in GitHub Desktop.
Save alirezanet/6994199a56194a23fa31916857726878 to your computer and use it in GitHub Desktop.
netsh ip/port forwarding sample
add forwarding interface:
netsh interface portproxy add v4tov4 listenport={srcPort} listenaddress={srcIp} connectport={DesPort} connectaddress={DesIp}
show interface:
netsh interface portproxy show v4tov4
delete interface:
netsh interface portproxy delete v4tov4 listenport={srcPort} listenaddress={srcIp}
-----------------------------
add firewall rule:
netsh advfirewall firewall add rule name="{ruleName}" protocol=TCP dir=in localip={srcIp} localport={srcPort} action=allow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment