Advertisement

10.16.2004 at 12:02PM PDT, ID: 21171024
[x]
Attachment Details

Simple iptables ruleset with port 80 forwarding to internal lan.

Asked by tagish in Linux Network Security

Tags: iptables, port, forward

Hello,

I am trying to setup an iptables firewall on a slackware 9 box, running the 2.6.4. kernel. I want to upgrade from ipchains on slack 2, running on my old 486 :)
I would like to allow internal traffic out, allow for ssh, ping and ftp on both interfaces, and I would like to my web, ftp and e-mail servers behind the firewall. The firewall will also be doing dhcp for the inside, and nat from the inside to the outside. I am also running dns on the firewall (secondary dns at another location) that needs to be visible to the outside. I have a second web server inside that I would like to be able to make certain areas available to the outside, what do I need in my firewall rules to do this? (I know I will have to configure apache for specific access, and reconfigure my dns once the server is moved inside the firewall)

eth0 is the outside interface, and is connected to dsl (216.126.xxx.xxx) and is using dhcp.
eth1 is the indise interface and is fixed to 192.168.3.60

192.168.3.19 will be webserver/email server 1
192.168.3.17 is webserver 2

Here is what I currently have, I know it is not complete, and does not do any port forwarding, and it does not allow me to connect anything on the internet :(

#- Flush all the rules in filter and nat tables
   iptables --flush
   iptables --table nat --flush
#- Delete all chains that are not in default filter and nat table
   iptables --delete-chain
   iptables --table nat --delete-chain

# Set up IP FORWARDing and Masquerading
   iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
   iptables --append FORWARD --in-interface eth1 -j ACCEPT

#- Enables packet forwarding by kernel
   echo 1 > /proc/sys/net/ipv4/ip_forward

   iptables -P INPUT DROP
   iptables -P FORWARD ACCEPT
   iptables -P OUTPUT ACCEPT

#- Allow self access by loopback interface
iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A OUTPUT -o lo -p all -j ACCEPT

#- Accept established connections
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --tcp-option ! 2 -j REJECT --reject-with tcp-reset

# Allow ping replies on BOTH interface
iptables -A INPUT -p ICMP -i eth0 -j ACCEPT
iptables -A INPUT -p ICMP -i eth1 -j ACCEPT

#- Open ftp port OUTSIDE interface
iptables -A INPUT -p tcp -i eth0 --dport 21 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 21 -j ACCEPT
iptables -A INPUT -p tcp -i eth1 --dport 21 -j ACCEPT
iptables -A INPUT -p udp -i eth1 --dport 21 -j ACCEPT

#- Open secure shell port BOTH Interfaces
iptables -A INPUT -p tcp -i eth0 --dport 22 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -i eth1 --dport 22 -j ACCEPT
iptables -A INPUT -p udp -i eth1 --dport 22 -j ACCEPT

#- Open HTTP port BOTH Interface
iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -i eth1 --dport 80 -j ACCEPT
iptables -A INPUT -p udp -i eth1 --dport 80 -j ACCEPT

# webmin both interfaces
iptables -A INPUT -p tcp -i eth1 --dport 10000 -j ACCEPT
iptables -A INPUT -p udp -i eth1 --dport 10000 -j ACCEPT
iptables -A INPUT -p tcp -i eth0 --dport 10000 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 10000 -j ACCEPT

#OUTPUT ruleset

any suggestions would be great.
ThanksStart Free Trial
 
Keywords: Simple iptables ruleset with port 80 fo…
 
Loading Advertisement...
 
[+][-]10.17.2004 at 02:47AM PDT, ID: 12331627

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 03:59AM PDT, ID: 12331804

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 05:10AM PDT, ID: 12331957

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 08:57AM PDT, ID: 12332951

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 11:16AM PDT, ID: 12333504

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 01:35PM PDT, ID: 12334156

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 01:57PM PDT, ID: 12334239

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 02:04PM PDT, ID: 12334277

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 02:23PM PDT, ID: 12334358

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.17.2004 at 02:25PM PDT, ID: 12334369

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 02:38PM PDT, ID: 12334465

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 02:41PM PDT, ID: 12334481

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 03:09PM PDT, ID: 12334581

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 04:09PM PDT, ID: 12334838

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 04:49PM PDT, ID: 12335070

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.18.2004 at 12:06AM PDT, ID: 12336627

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.18.2004 at 11:26AM PDT, ID: 12340765

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.18.2004 at 02:08PM PDT, ID: 12342171

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.19.2004 at 01:23PM PDT, ID: 12351647

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Linux Network Security
Tags: iptables, port, forward
Sign Up Now!
Solution Provided By: ahoffmann
Participating Experts: 3
Solution Grade: A
 
 
[+][-]10.20.2004 at 10:52AM PDT, ID: 12361055

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.21.2004 at 02:00AM PDT, ID: 12367767

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.22.2004 at 08:12AM PDT, ID: 12381659

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.22.2004 at 09:59AM PDT, ID: 12382841

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32