1、开启linux转发功能:

echo 1 > /proc/sys/net/ipv4/ip_forward

vi /etc/sysctl.conf,把net.ipv4.ip_forward设置成1,如:net.ipv4.ip_forward = 1


2、实现转发:

iptables -t nat -A PREROUTING -p tcp --dport 8388 -j DNAT --to-destination SS_VPS_IP:8388

iptables -t nat -A PREROUTING -p udp --dport 8388 -j DNAT --to-destination SS_VPS_IP:8388


iptables -t nat -A POSTROUTING -p tcp -d SS_VPS_IP --dport 8388 -j SNAT --to-source NAT_VPS_IP

iptables -t nat -A POSTROUTING -p udp -d SS_VPS_IP --dport 8388 -j SNAT --to-source NAT_VPS_IP