我有一个 VPS(在我家网络之外)运行着 WireGuard VPN(PiVPN + Pi-hole+ Unbound),我正在尝试设置端口转发以提高种子下载性能(就像 ProtonVPN 和 AirVPN 等服务提供的那样)。我的 Windows 10 电脑是客户端,它位于路由器后面。
我已经在路由器上配置了端口转发,但无法在 VPS 上正确运行。有人可以提供分步指南,说明如何在 VPS 上设置端口转发以实现此目的吗?
到目前为止,我已经尝试了以下方法,但没有成功
iptables -t nat -A PREROUTING -i enp0s6 -p tcp --dport 32554 -j DNAT --to-destination 10.221.178.2
iptables -t nat -A POSTROUTING -p tcp --dport 32554 -d 10.221.178.2 -j MASQUERADE
附加信息:
OS and Network info:
OS running on VPS: Ubuntu 22.04.4 LTS
OS running on PC: WIndows 10
VPS public ip: 1.2.3.4
WireGuard interface: wg0
IPv4 address for wg0: 10.221.178.1
Network adapter on VPS: enp0s6
IPv4 address for enp0s6: 10.0.0.18
Port used for incoming connections on qbittorrent: 32554
Iptables rules on server: https://rentry.co/pniz3pkn
Wireguard Config:
:::: Server configuration shown below ::::
[Interface]
PrivateKey = server_priv
Address = 10.221.178.1/24,fd11:5ee:bad:c0de::1/64
MTU = 1420
ListenPort = 51820
### begin zephyrus-m ###
[Peer]
PublicKey = zephyrus-m_pub
PresharedKey = zephyrus-m_psk
AllowedIPs = 10.221.178.2/32,fd11:5ee:bad:c0de::2/128
### end zephyrus-m ###
=============================================
:::: Client configuration shown below ::::
[Interface]
PrivateKey = zephyrus-m_priv
Address = 10.221.178.2/24,fd11:5ee:bad:c0de::2/64
DNS = 10.221.178.1
[Peer]
PublicKey = server_pub
PresharedKey = zephyrus-m_psk
Endpoint = REDACTED:51820
AllowedIPs = 0.0.0.0/0, ::0/0