demand

The delay between A and D is very high. It is necessary to reduce the delay between A and B and improve the access speed.

achieve purpose

Use C server to forward A’s traffic to B, and access D through B

path

Access terminal A - C server - B server - D target server

environment

CB server CentOS 7.6 64bit

iptables command

编辑"/etc/sysctl.conf",将net.ipv4.ip_forward改成1
sysctl -p
iptables -t nat -A PREROUTING -p tcp --dport 源端口 -j DNAT --to-destination 目标地址:目标端口
iptables -t nat -A POSTROUTING -j MASQUERADE
Reference:

https://www.zhangguangtong.cn/2016/03/%E7%94%A8iptables%E5%B0%86%E6%B5%81%E9%87%8F%E8%BD%AC%E5%8F%91%E5%88%B0%E5%8F%A6%E5%A4%96%E4%B8%80%E5%8F%B0%E6%9C%BA%E5%99%A8/