小编Geo*_*din的帖子

如何使用 iptables 在接口之间正确转发 TCP 和 UDP 流量?

服务器A

  • eth0 互联网接口
  • wg0 VPN 接口 10.66.66.1

服务器B

  • wg0 VPN 接口 10.66.66.2

如何使用 iptables 将流量从 eth0 转发到 wg0 10.66.66.2?我想将以下 TCP 和 UDP 端口转发到ServerB

TCP: 2302、27015-27030、27036-27037 UDP: 2302、4380、27000-27031、27036

我已经尝试过转发所有短信,但无济于事。

sudo iptables -A FORWARD --in-interface eth0 -j ACCEPT
sudo iptables --table nat -A POSTROUTING --out-interface wg0 -j MASQUERADE
Run Code Online (Sandbox Code Playgroud)

编辑:

iptables -L我需要注意遗留 iptables 和“正常”iptables 之间的歧义吗?

[root@vmd40065 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere …
Run Code Online (Sandbox Code Playgroud)

networking vpn port-forwarding iptables

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

iptables ×1

networking ×1

port-forwarding ×1

vpn ×1