Skip to content

Instantly share code, notes, and snippets.

@netnr netnr/netsh
Created Aug 1, 2019

Embed
What would you like to do?
windows使用netsh命令实现端口转发
# 安装IPv6,XP或更低版本要安装,安装后不需要启用,win7及以上不需要
netsh interface ipv6 install
# 添加端口转发 192.168.1.2:1433 => 192.168.1.3:1433
netsh interface portproxy add v4tov4 listenaddress=192.168.1.2 listenport=1433 connectaddress=192.168.1.3 connectport=1433
# 添加端口转发 *:1433 => 192.168.1.3:1433 不设置listenaddress
netsh interface portproxy add v4tov4 listenport=1433 connectaddress=192.168.1.3 connectport=1433
# 删除端口转发 192.168.1.2:1433
netsh interface portproxy delete v4tov4 listenaddress=192.168.1.2 listenport=1433
# 查询端口转发列表
netsh interface portproxy show all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.