Skip to content

Instantly share code, notes, and snippets.

@valmayaki
Forked from alirezanet/netsh.txt
Created March 5, 2025 16:21
Show Gist options
  • Save valmayaki/46407da7dc33b10d2412ab6aa6e20ec8 to your computer and use it in GitHub Desktop.
Save valmayaki/46407da7dc33b10d2412ab6aa6e20ec8 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