iptables配置样例

-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
## 将8080端口转发至80端口
COMMIT
# Completed on Thu Jan 12 13:37:26 2012
# Generated by iptables-save v1.4.7 on Thu Jan 12 13:37:26 2012
*filter
:INPUT ACCEPT [6:1658]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [308:474712]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT
COMMIT

你可能感兴趣的:(iptables)