echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
开启转发
echo "net.ipv4.conf.eth0.route_localnet=1" >> /etc/sysctl.conf
允许内核转发127.0.0.1/8的流量 根据网卡名改 默认为0
iptables -t nat -A PREROUTING -s x.x.x.x/32 -p tcp --dport 1234 -j DNAT --to-destination 127.0.0.1
只转发来源地址是x.x.x.x的目的端口是1234到127.0.0.1:1234