VPS 全端口转发

By | 1 2 月, 2025

在 /etc/sysctl.conf 中添加:

net.ipv4.ip_forward = 1

之后执行:

sysctl -p

假设 VPS 公网 IP 为 A,目标 VPS 公网 IP 为 B:

iptables -t nat -A PREROUTING -p tcp -d A -m tcp ! --dport 22 -j DNAT --to-destination B
iptables -t nat -A POSTROUTING -p tcp -d B -j MASQUERADE
iptables -t nat -A PREROUTING -p udp -d A -j DNAT --to-destination B
iptables -t nat -A POSTROUTING -p udp -d B -j MASQUERADE

这样可以把除 TCP 22 端口的请求权端口转发到 B。

12 thoughts on “VPS 全端口转发

  1. Pingback: cheap androxal price in us

  2. Pingback: ordering rifaximin generic is good

  3. Pingback: meilleur prix kamagra

  4. Pingback: Non perscription cheap enclomiphene

  5. Pingback: discount dutasteride lowest cost pharmacy

  6. Pingback: How to get flexeril cyclobenzaprine perscription

  7. Pingback: buying gabapentin cost per tablet

  8. Pingback: buy fildena buy in london

  9. Pingback: buy itraconazole online france

  10. Pingback: buy avodart cheap melbourne

  11. Pingback: how to order xifaxan cheap no prescription

  12. Pingback: obecný kamagra v jižní africe

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注