[CentOS] Rules for port forwarding

Tue Mar 29 09:24:42 UTC 2011
Indunil Jayasooriya <indunil75 at gmail.com>

Pls try beow lines

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT


echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -p tcp -i eth0 -d externalipaddress --dport 80
-j DNAT --to-destination 192.168.20.1:80

iptables -A FORWARD -p tcp -d 192.168.20.1 --dport 80 -m state --state NEW
-j ACCEPT





On Tue, Mar 29, 2011 at 2:36 PM, admin lewis <adminlewis at gmail.com> wrote:

> Hi,
> does anyone remember the rules for port forwarding ?
> the followings does not work:
> iptables -A FORWARD -i eth0 -o eth1 -p tcp –dport 80 -j ACCEPT
> iptables -A PREROUTING -t nat -p tcp -i eth0 –dport 80 -j DNAT –to
> 192.168.20.1:80
>
> thx lewis
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



-- 
Thank you
Indunil Jayasooriya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20110329/2c454613/attachment-0005.html>