当直连访问速度慢时,可以采用利用NAT中转的方法,实现连接加速
1、开启iptables转发

echo -e "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p
2、转发规则(同端口号)

iptables -t nat -A PREROUTING -p tcp -m tcp --dport 端口号 -j DNAT --to-destination 目标IP:端口号
iptables -t nat -A PREROUTING -p udp -m udp --dport 端口号 -j DNAT --to-destination 目标IP:端口号
iptables -t nat -A POSTROUTING -d 目标IP -p tcp -m tcp --dport 端口号 -j SNAT --to-source NAT内网IP
iptables -t nat -A POSTROUTING -d 目标IP -p udp -m udp --dport 端口号 -j SNAT --to-source NAT内网IP
3、保存规则

service iptables save
出现错误:(原因是用的centOS7系统)

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
用以下办法解决:

systemctl stop firewalld
systemctl mask firewalld
yum install iptables-services
systemctl enable iptables
然后再输入规则,再保存就可以了。
最后重启iptables

service iptables restart
4、用SS的只要把IP改成NAT的IP地址就可以了