LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-04-2004, 09:30 AM   #1
palanisaravanan
Member
 
Registered: Oct 2003
Location: India
Distribution: Debian
Posts: 95

Rep: Reputation: 15
Firewall setup in my newtwork


I have four machines A,B,C,D
A and B are in one network(192.168.1.0 mask 255.255.255.0)

C and D are in another network(192.168.0.0 mask 255.255.255.0)
For A pc B is the gateway.
\\-ly for C pc D is the gateway.
I want to connect from machine A to aother network(i.e C and D) using B as the gateway.
||=ly I want to connect from machine D to aother network(i.e A and B) using C as the gateway.
what i did was I enabled ipforwarding in Both my gateways B and C.

The I create a Static route in machine C for machine B

In machine C the routing entry is
route add 192.168.1.1 dev eth0
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1


In machine B the routing entry is
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0

Both my machine A and D are using B and C as default gateways respectivley.
i am able to ping and ssh form both the sides.

Now i planned to setup a firewall in my Gateways using iptables.Here only i have a problem.After i sets up the firewall my Client machines can not access the other network.But gateways can access to each other.They too can not access the other side clinets.

My Firewall rules are

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



iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p udp --dport 5000 -j ACCEPT

iptables -A INPUT -p icmp -j ACCEPT

iptables -A FORWARD -s 192.168.1.0/24 -d 192.168.0.0/24 -j ACCEPT

Similary in my other gateway i have a rule.
Both the sides i enabled ip forwarding.
I guess something wrong in my firewall rules.But i don't know where it is going wrong.I am totally new to this area.Can any one help me?
 
Old 04-04-2004, 10:44 AM   #2
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Quote:
iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
Sets the policy to allow outgoing traffic by default. That means only traffic originating from the gateways. Drop all other traffic not explicitly allowed.

Quote:
iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p udp --dport 5000 -j ACCEPT
Allow traffic originating from the other gateway, not forwarder traffic from the clients on the other side.

Quote:
iptables -A INPUT -p icmp -j ACCEPT
Accept ICMP traffic to the gateways

Quote:
iptables -A FORWARD -s 192.168.1.0/24 -d 192.168.0.0/24 -j ACCEPT
Allow traffic from the backbone, the network the gateways share, to enter one of the leaf networks, AB or the CD network.

You realize that this setup contains three networks, that need three separate network addresses?

Net I - Net II - Net III

Net I: Computer A and B
Net II: Computer B and C, let's call them GW1 and GW2
Net III: Computer C and D

The firewall on GW1 and GW2 need to be different in the forwarding rules.
The GW1 FORWARD chain need to accept traffic from Net III headed for Net I
The GW2 FORWARD chain need to accept traffic from Net I headed for Net III.
They are eachothers mirror.

In addition to this you will have to set up rules for the Net II on both GW1 and GW2. This is something like what you have done so far with the INPUT chain.

A quick look at http://iptables-tutorial.frozentux.n...-tutorial.html may help figuring out how the tables and chains are traversed for different packets.
 
  


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
Newtwork eth0 not loading in Evil Entity jburford Linux - Newbie 0 11-13-2004 07:09 PM
Is a firewall necessary in this setup? cerrayon Linux - Security 4 06-27-2004 07:34 PM
help with client side NFS-firewall setup and server side NIS-firewall setup niverson Linux - Networking 3 02-02-2004 08:52 AM
Firewall setup heartagram Debian 5 08-29-2003 01:02 PM
Firewall Setup Golem Linux - Newbie 2 01-31-2002 06:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:36 AM.

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