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 07-25-2004, 02:12 PM   #1
dan.patton
LQ Newbie
 
Registered: Jul 2004
Location: Southampton, UK
Distribution: Debian, Fedora
Posts: 2

Rep: Reputation: 0
Linux router/firewall box for shared Internet access from 3 separate LANs?


Hi all,

I'm looking to set up an old box as a router/firewall running Linux in some form. I've looked at Smoothwall but it doesn't seem to do exactly what I want. I want to set up 3 private subnets, all of which will use this box as their gateway for Internet access using NAT, and a basic firewall to prevent uninvited IP traffic entering any of the subnets. So the box will have 4 NICs, with the following IP addresses:

eth0: <public IP> --> Internet (via DSL modem)
eth1: 192.168.1.1 --> subnet #1 (192.168.1.0/24)
eth2: 192.168.2.1 --> subnet #2 (192.168.2.0/24)
eth3: 192.168.3.1 --> subnet #3 (192.168.3.0/24)

However, I don't want any IP traffic at all flowing from one subnet to another (they will be in 3 separate flats in the same building, the occupants of which do not know each other).

Ideally, I'd also like to have a DHCP server running on the box to give out appropriate IP addresses to machines on each subnet.

Smoothwall seems to be geared towards the idea of protecting a single internal LAN (the 'green' interface) from the Internet (the 'red' interface), rather than multiple Internal LANs from the Internet *and* from each other. Does anyone know of a free distro that would allow me to build this sort of setup easily?

Many thanks in advance
 
Old 07-25-2004, 02:34 PM   #2
newpenguin
Member
 
Registered: Sep 2002
Location: lahore pakistan
Distribution: slackware,redhat, FreeBSD,openbsd
Posts: 219

Rep: Reputation: 30
Re: Linux router/firewall box for shared Internet access from 3 separate LANs?

Quote:
Originally posted by dan.patton
Hi all,

I'm looking to set up an old box as a router/firewall running Linux in some form. I've looked at Smoothwall but it doesn't seem to do exactly what I want. I want to set up 3 private subnets, all of which will use this box as their gateway for Internet access using NAT, and a basic firewall to prevent uninvited IP traffic entering any of the subnets. So the box will have 4 NICs, with the following IP addresses:

eth0: <public IP> --> Internet (via DSL modem)
eth1: 192.168.1.1 --> subnet #1 (192.168.1.0/24)
eth2: 192.168.2.1 --> subnet #2 (192.168.2.0/24)
eth3: 192.168.3.1 --> subnet #3 (192.168.3.0/24)
iptables -t nat -A POSTROUTING -i eth1 -s 192.168.1.0/24
-o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -i eth2 -s 192.168.2.0/24
-o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -i eth3 -s 192.168.3.0/24
-o eth0 -j MASQUERADE

Quote:

However, I don't want any IP traffic at all flowing from one subnet to another (they will be in 3 separate flats in the same building, the occupants of which do not know each other).
iptables -A FORWARD -s 192.168.0.0/16 -d 192.168.0.0/16 -j DROP


Quote:

Ideally, I'd also like to have a DHCP server running on the box to give out appropriate IP addresses to machines on each subnet.
read dhcp howto or sample dhcp config files /usr/share/soc

Quote:

Smoothwall seems to be geared towards the idea of protecting a single internal LAN (the 'green' interface) from the Internet (the 'red' interface), rather than multiple Internal LANs from the Internet *and* from each other. Does anyone know of a free distro that would allow me to build this sort of setup easily?
u can use any distribution.


Last edited by newpenguin; 07-25-2004 at 02:37 PM.
 
Old 07-26-2004, 04:34 AM   #3
dan.patton
LQ Newbie
 
Registered: Jul 2004
Location: Southampton, UK
Distribution: Debian, Fedora
Posts: 2

Original Poster
Rep: Reputation: 0
Many thanks newpenguin - as you can probably tell, I'm rather new to all this 'iptables' stuff...
Cheers,

Last edited by dan.patton; 07-26-2004 at 04:37 AM.
 
Old 07-26-2004, 03:27 PM   #4
newpenguin
Member
 
Registered: Sep 2002
Location: lahore pakistan
Distribution: slackware,redhat, FreeBSD,openbsd
Posts: 219

Rep: Reputation: 30
if u asking about distribution then simply use slackware.
 
Old 04-15-2006, 05:37 PM   #5
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Rep: Reputation: 30
iptables -t nat -A POSTROUTING -i eth1 -s 192.168.1.0/24
-o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -i eth2 -s 192.168.2.0/24
-o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -i eth3 -s 192.168.3.0/24
-o eth0 -j MASQUERADE

I have done with 1 postrouting on the main "everybody" out eth0 for all subnets .

iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/16 -j MASQUERADE ...

... just opinion !
 
  


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
shared Internet access, same box, dual boot, win xp and rh9 provri Red Hat 2 06-21-2005 12:36 AM
Trying to set linux box as router firewall that'll boot from floppy only dbiswaswb Linux - Newbie 7 05-09-2004 08:26 AM
how to configure 6 NICs on Red hat 9.0 to make a firewall/router for 5 lans? johnny_boy_2k3 Linux - Hardware 1 05-02-2004 08:28 PM
Howto setup two stage firewall? Linux and router-in-a-box? drdirt Linux - Security 5 01-10-2004 02:51 AM
Access my box from internet ? CISCO + firewall johnecobo Linux - Security 1 12-11-2002 03:59 PM

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

All times are GMT -5. The time now is 02:24 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