iptables端口转发

  sre

42作为37的代理

iptables -F
iptables -X
iptables -L
iptables -t nat -A PREROUTING -d 192.168.195.42 -p tcp --dport 10911 -j DNAT --to 192.168.195.37:10911
#iptables -t nat -A POSTROUTING -d 192.168.195.37 -p tcp --dport 9876 -j SNAT --to 192.168.195.42:9876
iptables -t nat -A POSTROUTING -d 192.168.195.37 -p tcp --dport 10911 -j MASQUERADE
iptables -A FORWARD -i eth1 -s 192.168.195.37 -p tcp --sport 10911 -m state --state ESTABLISHED -j ACCEPT
iptables -A FORWARD -o eth1 -d 192.168.195.42 -p tcp --dport 10911 -j ACCEPT
service iptables save

One Reply to “iptables端口转发”

  • -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT #允许80端口通过防火墙
    -A INPUT -m state –state NEW -m tcp -p tcp –dport 88888 -j ACCEPT #允许88888端口通过防火墙

LEAVE A COMMENT

Captcha Code