setting up nat

Arun Binaykia arun at binaykia.com
Fri May 19 21:03:51 UTC 2006


Hello,

eth0 is the lan interface, 
eth1 is the wan interface.

substitute eth1 with your ppp interface

This is my script for nat and firewall. It's a part of /etc/rc.local

I've use the following tutorial, iptables are not very difficult.

http://iptables-tutorial.frozentux.net/iptables-tutorial.html#HOWARULEISBUILT

#=====
iptables --flush
iptables --flush -t nat
iptables --append FORWARD --in-interface eth0 -j ACCEPT
iptables -A FORWARD -i eth1 -m state --state NEW,INVALID -j DROP
iptables -t nat -A POSTROUTING  -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -P INPUT DROP
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -i eth1 -p udp -j ACCEPT
#==== if you want just nat stop here
iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 80 -j ACCEPT
#=====

HTH
Arun


On Fri, 2006-05-19 at 21:48 +0200, Antoine wrote:
> Hi,
> I am relatively new to fedora (just done two years of gentoo), and
> quite a bit of googling didn't turn up any easy way to activate nat. I
> have a few machines that I want to be nat'ed through a fc5 box
> connecting via pppoe. I installed firestarter but it won't activate
> nat until I restart my adsl connection (which means sshing into my
> router box and restarting... ok for me but not for the missus!). I
> can't believe there is no standard way to set up nat, so if anyone has
> any pointers I am all ears.
> Cheers
> Antoine
> 
> -- 
> This is where I should put some witty comment.
> 




More information about the fedora-list mailing list