计算机技术

IPTABLES 转发 CNAME端口

出處:https://www.v2ex.com/t/217903#reply10

1 !/bin/sh
2 service iptables restart
3 ddnsip=ping -c1 xxx.ddns.com|awk -F'[(|)]' 'NR==1{print $2}'
4 iptables -t nat -A PREROUTING -p tcp -m tcp --dport 37777 -j DNAT --to-destination $ddnsip:37777

最后没办法还是写了一个 shell 来更新 iptables 中的 IP 地址。方法如上,加入 cronjobs 即可

Related Articles

发表回复

Check Also
Close
Back to top button