I would like to setup my Debian Lenny server as a router for my home network using iptables, but so far have been unsuccessful. Below is a diagram of the desired network architecture
INTERNET - (eth0) Debian server + router (eth1) -- Netgear 5 port gigabit switch -- Clients
I have a DHCP server and a DNS server running for the internal network but I am having difficulty setting up iptables. I need port 80 and 22 open from outside (I can add the open others later) and full access to the server from inside.
Any help would be very greatly appreciated, Thanks, RayQuang
Here is a setup I've used with great success in an almost identical situation to yours. I understand your circumstances to be as follows (please correct me if I'm wrong):
10.10.10.0/24
. Modify the script below as needed to use your actual address.First, ensure that IP forwarding is turned on. In
/etc/sysctl.conf
, you should have this:Then, create your netfilter rules as per the following script:
This should be enough of a framework to build upon.
You need a set of rules like the following:
Please, note that these rules might not be the complete list. However, it will help you get started. Also, don't forget to enable IP forwarding!