带有内部端口重定向的 Windows 7,可能吗?

min*_*tux 9 windows-7 nat port-forwarding

我收到了我们的一位开发人员的请求,我在解决问题时遇到了问题。

在办公室,他们使用 linux 桌面,我可以通过 iptables nat 将 localhost:80 转发到 localhost:8080。他们想要的是在 Windows 7 中在家中使用相同的东西。

我得到了我认为的两种解决方法。一种是重新配置 jboss webserver 和所有 webapps url(乱七八糟)。另一个是找到一种将本地主机端口 8080 重定向/nat 到端口 80 的方法。虽然在 Windows 7 中我不确定如何执行此操作。

任何人都知道如何做第二个?

Sco*_*ain 13

是的,windows 确实有一个 iptables 等效项,它是通过工具netsh 和 portproxy interface 实现的

做你想做的命令是

netsh interface portproxy add v4tov4 listenaddress=YOUR_IP_HERE listenport=8080 connectaddress=YOUR_IP_HERE connectport=80 
Run Code Online (Sandbox Code Playgroud)

请注意,这只会执行 IPv4 连接,如果您还想转发 IPv6 连接,则还需要执行

netsh interface portproxy add v6tov6 listenaddress=YOUR_IP_HERE listenport=8080 connectaddress=YOUR_IP_HERE connectport=80
Run Code Online (Sandbox Code Playgroud)


Ali*_*orm 6

AFAIK,Win7 没有 iptables 等价物。编写一个可以执行您想要的操作(侦听端口,将所有内容复制到另一个端口/从另一个端口复制所有内容)的服务器应该很容易。您可以在此 URL 上找到一个:http : //www.quantumg.net/portforward.php(未经测试)。使用反向代理(谷歌是你的朋友)可能适合类似 http 的流量。另请查看此帖子:https : //stackoverflow.com/questions/3721000/port-forwarding-on-windows-7