yum install iptables-services 安装 iptables echo 1 >/proc/sys/net/ipv4/ip_forward 或者 编辑文件/etc/sysctl.conf,修改net.ipv4.ip_forward = 0为net.ipv4.ip_forward = 1 iptables -t nat -A PREROUTING -p tcp --dport 8000:65535 -j DNAT --to-destination xx.xx.xx.xx iptables -t nat -A POSTROUTING -p tcp -d xx.xx.xx.xx --dport 8000:65535 -j SNAT --to-source xx.xx.xx.xx iptables -I FORWARD -p tcp --dport 8000:65535 -j ACCEPT iptables -I FORWARD -p tcp --sport 8000:65535 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 8000:65535 -j ACCEPT iptables -I INPUT -p udp -m udp --dport 8000:65535 -j ACCEPT service iptables save service iptables restart TCP&UDP转发 iptables -t nat -A PREROUTING -p tcp --dport 45608 -j DNAT --to-destination xx.xx.xx.xx:xx iptables -t nat -A POSTROUTING -p tcp -d xx.xx.xx.xx --dport 443 -j SNAT --to-source yy.yy.yy.yy iptables -t nat -A PREROUTING -p udp --dport 45608 -j DNAT --to-destination xx.xx.xx.xx:xx iptables -t nat -A POSTROUTING -p udp -d xx.xx.xx.xx --dport 443 -j SNAT --to-source yy.yy.yy.yy iptables -I FORWARD -p tcp --dport 80:65535 -j ACCEPT iptables -I FORWARD -p tcp --sport 80:65535 -j ACCEPT iptables -I FORWARD -p udp --dport 80:65535 -j ACCEPT iptables -I FORWARD -p udp --sport 80:65535 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 80:65535 -j ACCEPT iptables -I INPUT -p udp -m udp --dport 80:65535 -j ACCEPT service iptables save service iptables restart 转发本地端口 iptables -t nat -A PREROUTING -p tcp --dport 38650 -j REDIRECT --to-ports 443 iptables -t nat -A PREROUTING -p udp --dport 38650 -j REDIRECT --to-ports 443
我的微信
我的微信
微信扫一扫
评论