Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:

How to configure Fedora Core 1 as a gateway

by Thomas M. Andersen on Feburary 14, 2004

Everything below is done as the root user.

Edit the file /etc/sysctl.conf and on the line net.ipv4.ip_forward = 0, change 0 to 1.

	net.ipv4.ip_forward = 1
IP forwarding and Masquerading:
To flush old rules type this at the command line:
	$ iptables -F INPUT
$ iptables -F OUTPUT
$ iptables -F FORWARD
$ iptables -t nat -F
The following commands will create new rules for your system.
	$ iptables -P INPUT ACCEPT
$ iptables -P OUTPUT ACCEPT
$ iptables -P FORWARD DROP
$ iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
$ iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
$ iptables -A FORWARD -j LOG
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
You may have to switch eth0 and eth1 depending on your setup.

Save the iptables modifications by typing:
	$ service iptables save.