LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-22-2003, 06:33 PM   #1
lumux
LQ Newbie
 
Registered: Aug 2003
Posts: 17

Rep: Reputation: 0
iptables


hi all, I am very close to finishing a little router/firewall project I am running, but just need a little help.

I have set up a RH 9 machine with two NIC's one configured on our public "real-ip" network and one on our secure netork.

Now, I have configured a DHCP server for the private network...that is fine.......I found a post describing how to set up iptables to route all traffic through from the secure network out onto the internet, but it is wide open. What I want to know is how do I set up iptables to allow users on the secure network to access the web (ristricted access if possible) and lock down the linux machine with the possible execption of the SSH and HTTP ports (for example).

If anyone good help I would be very greatful

Cheers

Lumux
 
Old 08-22-2003, 06:35 PM   #2
lumux
LQ Newbie
 
Registered: Aug 2003
Posts: 17

Original Poster
Rep: Reputation: 0
if it helps here is my current iptables config file:

# Generated by iptables-save v1.2.7a on Fri Aug 22 23:41:26 2003
*nat
:PREROUTING ACCEPT [42:2649]
:POSTROUTING ACCEPT [61:3724]
:OUTPUT ACCEPT [61:3724]
-A POSTROUTING -o eth1 -j MASQUERADE
COMMIT
# Completed on Fri Aug 22 23:41:26 2003
# Generated by iptables-save v1.2.7a on Fri Aug 22 23:41:26 2003
*filter
:INPUT ACCEPT [1927:140402]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2564:188043]
:RH-Lokkit-0-50-INPUT - [0:0]
-A FORWARD -s 192.168.0.0/255.255.255.0 -j ACCEPT
-A FORWARD -d 192.168.0.0/255.255.255.0 -j ACCEPT
-A FORWARD -s ! 192.168.0.0/255.255.255.0 -j DROP
COMMIT
# Completed on Fri Aug 22 23:41:26 2003
 
Old 08-22-2003, 07:57 PM   #3
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
iptables allows you to block ports and track connection.

First of all, you should set the FORWARD chain to drop
Code:
iptables -P FORWARD DROP
and use the following rules to allow related connection.
Code:
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
Also, you should not use Lokkit (RedHat's GUI tool), it is not very good.
Instead, you can learn more about iptables from the documentation and tutorials from netfilter.
http://www.netfilter.org/

Or these GUI tools
http://firestarter.sourceforge.net/
http://www.shorewall.net/
http://www.ipcop.org/
http://www.fwbuilder.org/
 
Old 08-23-2003, 05:39 AM   #4
lumux
LQ Newbie
 
Registered: Aug 2003
Posts: 17

Original Poster
Rep: Reputation: 0
So all I need to accoplish everything I wrote in my first post can be done with just those three lines?? I find that hard to believe
 
Old 08-23-2003, 11:30 AM   #5
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
An alternate method is to use squid proxy.
 
Old 08-23-2003, 07:53 PM   #6
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
Quote:
So all I need to accoplish everything I wrote in my first post can be done with just those three lines?
No.
If you want to block ports, you will need to add more rules.
 
Old 08-23-2003, 08:28 PM   #7
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
No offence dude but I gringe when I see the default policy's of aceppt as so many here probably do too.

Mathieu gave you a setup for masquerading which can be added to already dubious rules and ppuru gave you a hint towards access control. Everyone one would love to help you and in the blink of an eye could give you the exact procedures to do what you want to do, but you'll only be back five minutes later asking something else becauses you don't know why what you did works.

As we can see it starts off with how can I share a connection, someone says how to, cool that works, next question how do I open ports etc. and so on....

The old adage Rome wasn't built in a day rings true, no personal slight to you but I've observed so many people demanding without any effort on their own part - relax which so many people forget to do, take one task at a time and before you know it you'll be telling people how to do this and that. The best way to do something right is to do it wrong in the first place.

It's no personal observation on yourself particularly, just a general one, so please don't take offence
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration