Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




22910 posts

Uber Geek

Trusted
Subscriber

# 41968 26-Sep-2009 16:37
Send private message

need to get something on my firewall machine that is between my lan and my flatmates.

3 active nics in it now, one to the adsl router, one to my PC's, one to my flatmates lan.

Its the default gateway for my lan, and is natting everything to the adsl router as that is the degault gateway.

I need it to just route between my network and the flatmates, a static route willbe made on his machines to my machine

eth0  - my internal lan
192.168.1.1 255.255.255.0


eth2 - my adsl router
10.20.0.10  255.255.255.0
gateway is 10.20.0.1 (my adsl router)

eth3 - on flatmates lan
10.30.0.10 - 255.255.255.0

no gateway or all my traffic goes on his internet.


I have a file from iptables-save that I pipe to iptables-resore




# Generated by iptables-save v1.2.11 on Tue May 16 22:13:55 2006
*raw
:PREROUTING ACCEPT [67917:13329159]
:OUTPUT ACCEPT [12676:1026290]
COMMIT

*nat
:PREROUTING ACCEPT [3927:262748]
:POSTROUTING ACCEPT [158:10907]
:OUTPUT ACCEPT [158:10907]

(whole heap of portfowards)


-A POSTROUTING -s 192.168.1.0/255.255.255.0 -j MASQUERADE

COMMIT
# Completed on Tue May 16 22:13:55 2006
# Generated by iptables-save v1.2.11 on Tue May 16 22:13:55 2006
*mangle
:PREROUTING ACCEPT [67918:13329251]
:INPUT ACCEPT [12931:2572624]
:FORWARD ACCEPT [54977:10755022]
:OUTPUT ACCEPT [12676:1026290]
:POSTROUTING ACCEPT [67653:11781312]
COMMIT
# Completed on Tue May 16 22:13:55 2006
# Generated by iptables-save v1.2.11 on Tue May 16 22:13:55 2006
*filter
:INPUT ACCEPT [12931:2572624]
:FORWARD ACCEPT [54977:10755022]
:OUTPUT ACCEPT [12676:1026290]
COMMIT
# Completed on Tue May 16 22:13:55 2006




Im assuming that I need to change the line in bold to something else or put something ahead of it to say not to nat stuff to the 10.30.0.0/24 range, but am not sure what exactly.




Richard rich.ms

Create new topic
7 posts

Wannabe Geek


  # 259263 29-Sep-2009 09:01

-A POSTROUTING -s 192.168.1.0/24 -d ! 10.20.0.0/24 -j MASQUERADE -o eth2
-A FORWARD -i eth0 -o eth3 -s 192.168.1.0/24 -d 10.20.0.0/24 -j ACCEPT

I'm far from an expert but does this work? (Replacing the line in bold)

897 posts

Ultimate Geek

Subscriber

  # 259907 30-Sep-2009 22:43
Send private message

How did you go with this? I'm not much of a fan of iptables-save/restore.  Prefer to see rules through iptables -L and setting them up in scripts.

One thing to make sure is you have enabled ip_forwarding otherwise traffic from one lan, destined for another will not be forwarded regardless of rules.

I've made a very basic quick firewall script you may be able to use if you want. Completely untested so your mileage may vary :)

Also if your linux box is the default gateway for all machines on either network, then there is no need for static routes :) as each pc will send data to the linux box as the default gateway which then will forward to the correct network.

 
 
 
 




22910 posts

Uber Geek

Trusted
Subscriber

  # 263179 10-Oct-2009 21:49
Send private message

I finally got around to trying that, it failes on line 63 which is

-A FORWARD -i eth0 -o eth3 -s 192.168.1.0/24 -d 10.20.0.0/24 -j ACCEPT


Seems to be happy with this lot however and it seems to do what I want, havent checked that there is no internet access from the flatmates side yet.

-A PREROUTING -s 10.30.0.1/24 -d ! 192.168.1.0/24 -j DROP
-A POSTROUTING -s 10.30.0.1/24 -d 192.168.1.0/24 -j ACCEPT
-A POSTROUTING -s 192.168.0.1/24 -d 10.30.0.1/24 -j ACCEPT
-A POSTROUTING -s 192.168.1.0/24 -d ! 192.168.1.0/24 -j MASQUERADE






Richard rich.ms

Create new topic



Twitter and LinkedIn »



Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Ring launches indoor-only security camera
Posted 23-Jan-2020 17:26


New report findings will help schools implement the digital technologies curriculum content
Posted 23-Jan-2020 17:25


N4L to upgrade & support wireless internet inside schools
Posted 23-Jan-2020 17:22


Netflix releases 21 Studio Ghibli works
Posted 22-Jan-2020 11:42


Vodafone integrates eSIM into device and wearable roadmap
Posted 17-Jan-2020 09:45


Do you need this camera app? Group investigates privacy implications
Posted 16-Jan-2020 03:30


JBL launches headphones range designed for gaming
Posted 13-Jan-2020 09:59


Withings introduces ScanWatch wearable combining ECG and sleep apnea detection
Posted 9-Jan-2020 18:34


NZ Police releases public app
Posted 8-Jan-2020 11:43


Suunto 7 combine sports and smart features on new smartwatch generation
Posted 7-Jan-2020 16:06


Intel brings innovation with technology spanning the cloud, network, edge and PC
Posted 7-Jan-2020 15:54


AMD announces high performance desktop and ultrathin laptop processors
Posted 7-Jan-2020 15:42


AMD unveils four new desktop and mobile GPUs including AMD Radeon RX 5600
Posted 7-Jan-2020 15:32


Consolidation in video streaming market with Spark selling Lightbox to Sky
Posted 19-Dec-2019 09:09


Intel introduces cryogenic control chip to enable quantum computers
Posted 10-Dec-2019 21:32



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.