powershell设置端口转发

netsh interface portproxy add v4tov4 listenport=2222 listenaddress=0.0.0.0 connectport=22 connectaddress=172.28.140.245

增加转发的命令:

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

删除转发的命令:

netsh interface portproxy delete v4tov4 listenport=22 listenaddress=0.0.0.0

使用以下命令列出当前的端口转发规则:

netsh interface portproxy show all

测试连接的命令:

ssh username@ip -p 22