Netsh Features
Windows comes with it, supports IPv4 and IPv6, the command takes effect immediately, and the configuration still exists after restarting the system.
Cons: Does not support UDP
Install Netsh
XP/2003 needs to install IPV6 first, and Win7 or above comes with it.
netsh interface ipv6 install
Common commands
add - Add a configuration item to a table.
delete - deletes a configuration item from a table.
dump - Displays a configure script.
help - Display a list of commands.
reset - resets the port proxy configuration state.
set - Set configuration information.
show - show information
add port forwarding
Order
netsh interface portproxy add v4tov4 - Adds a listening item to connect to for IPv4 and proxy over IPv4. netsh interface portproxy add v4tov6 - Adds a listening item to connect to for IPv4 and proxy over IPv6. netsh interface portproxy add v6tov4 - Adds a listening item to connect to for IPv6 and proxy over IPv4. netsh interface portproxy add v6tov6 - Adds a listening item to connect to for IPv6 and proxy over IPv6.
Liezi
It is also based on netsh interface portproxy add v4tov4
netsh interface portproxy add v4tov4 listenport=8080 connectaddress=192.168.8.108 connectport=8080
Forward data from local port 8080 to port 8080 on 192.168.8.108
netsh interface portproxy add v4tov4 listenport=8080 connectaddress=192.168.8.108 connectport=9090
Forward data from local port 8080 to port 9090 on 192.168.8.108
The above is the method of adding port forwarding to netsh.
show port forwarding
In general, use netsh interface portproxy show all to view, if you set more. The following command is more suitable for you.
netsh interface portproxy show all - Displays all port proxy parameters. netsh interface portproxy show v4tov4 - Displays parameters for IPv4 proxy connections to another IPv4 port. netsh interface portproxy show v4tov6 - Displays parameters for IPv4 proxy connections to IPv6. netsh interface portproxy show v6tov4 - Displays parameters for IPv6 proxy connections to IPv4. netsh interface portproxy show v6tov6 - Displays the parameters of the IPv6 proxy connecting to another IPv6 port.
Modify port forwarding
I won't go into details here. If you learn how to add, the following is to replace the added add with set to modify the command
Order
netsh interface portproxy set v4tov4 - Updates the listening item to connect to for IPv4 and proxy over IPv4. netsh interface portproxy set v4tov6 - Updates the listening item to connect to for IPv4 and proxy over IPv6. netsh interface portproxy set v6tov4 - Updates the listening item to connect to for IPv6 and proxy over IPv4. netsh interface portproxy set v6tov6 - Updates the listening item to connect to for IPv6 and proxy over IPv6.
E.g
netsh interface portproxy set v4tov4 listenport=8080 connectaddress=192.168.8.108 connectport=8090 Change the local port 8080 to port 8090 forwarded to 192.168.8.108.
remove port forwarding
Order
netsh interface portproxy delete v4tov4 - Deletes the listening entry to which IPv4 and proxy over IPv4 is connected. netsh interface portproxy delete v4tov6 - Deletes the listening entry to which IPv4 and proxy over IPv6 is connected. netsh interface portproxy delete v6tov4 - Deletes the listening entry to which the IPv6 and proxy over IPv4 is connected. netsh interface portproxy delete v6tov6 - Deletes the listening entry to which the IPv6 and proxy over IPv6 is connected.
E.g
netsh interface portproxy delete v4tov4 listenport=8080