routing - Windows 上的数据包重定向

标签 routing network-programming iptables windows-firewall pcap.net

由于软件限制,我们目前在所有机器上都运行 Windows。

然而,在这个过程中,我们需要将进入 IP 和端口的某些数据包重定向到不同的端口(相同的 IP)。我们有软件监听“代理端口”。

这可以通过在 Linux 上使用 IPTables 来实现,方法类似于:

iptables -t nat -I PREROUTING -p udp -d <DSTIP> --dport <DSTPORT> -m u32 --u32 '0>>22&0x3C@8=0xFFFFFFFF && 0>>22&0x3C@12=0x54536F75 && 0>>22&0x3C@16=0x72636520 && 0>>22&0x3C@20=0x456E6769 && 0>>22&0x3C@24=0x6E652051 && 0>>22&0x3C@28=0x75657279' -j REDIRECT --to-port <REDIRECT PORT>

这在 linux 上效果很好,并将某些数据包重定向到我们的代理软件,但是是否有可能在 Windows 上做这样的事情而不必在我们的 Windows 机器前面获得一台专用机器?

我正在考虑用 pcap.net 写一些东西,但我猜这将不得不直接从 NIC 而不是 Windows 读取?

最佳答案

来自 MSDN :

Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running.



您可以使用以下命令将来自任何端口的连接重定向到另一个本地(或远程)端口:
netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport

此外,如 this SO post 所述, netsh 的良好替代品iptabes 在 Windows 上。

关于routing - Windows 上的数据包重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36313417/

相关文章:

linux - busybox 上的 iptables

angular - 如何在 Angular i18n 路由器模块中使用 LOCALE_ID

c# - 如何使用 ASP.NET Web 窗体和路由编写 SEO 友好的图像文件名

.net-4.0 - 任何人都可以在 .NET 4.0/MVC3 中重新创建我在具有 2 个或更多可选参数的路由中遇到的以下错误吗?

ios - 如何在 iOS 中获取所有可用的 wifi 网络名称列表

Linux 每程序防火墙类似于 windows 和 mac 对应物

networking - 172.0.0.1 和 192.168.0.1 到底有什么区别?

Kubernetes:将传入流量路由到特定 Pod

python:如何使用 uwhoisd 代理执行 whois

c - 是否可以使用 libnetfilter_queue 访问 ip 片段