Wireguard 伺服器將 HTTP 請求從 Wireguard 用戶端轉送到外部代理

Wireguard 伺服器將 HTTP 請求從 Wireguard 用戶端轉送到外部代理

我設定了一個 Wireguard 伺服器和一些 Wireguard 客戶端。來自客戶端的所有流量都透過伺服器路由。現在我的伺服器的公用 IP 已作為 VPN-IP 列入黑名單,我無法再造訪多個網站。這就是為什麼我想將傳出流量(來自所有wireguard 用戶端的連接埠 80/443 請求)路由到外部可切換 HTTP 代理以混淆 VPN。因為我不是設定 iptables 規則的專家,所​​以我想問是否有人可以幫我設定所需的規則。

我有:

# delete all rules
iptables -F
iptables -X

# deny all incoming
iptables -P INPUT DROP

# deny all forwarding
iptables -P FORWARD DROP

# allow loopback
iptables -A INPUT -i lo -j ACCEPT

# allow established and related
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# allow incoming wireguard connections
iptables -A INPUT -p udp --dport 443 -i eth0 -j ACCEPT

# activate masquerading on postrouting
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# allow wg-clients to local dns
iptables -A INPUT -i wg0 -s 10.8.0.0/24 -d 10.8.0.1 -p udp --dport 53 -j ACCEPT

# allow wg-clients to the world
iptables -A FORWARD -i wg0 -o eth0 -s 10.8.0.0/24 -j ACCEPT

# allow the world to answer wg-clients
iptables -A FORWARD -i eth0 -o wg0 -d 10.8.0.0/24 -m conntrack --ctstate ESTABLISHED -j ACCEPT```

相關內容