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 11-07-2007, 02:49 AM   #1
jimbo7
LQ Newbie
 
Registered: Jun 2006
Posts: 19

Rep: Reputation: 0
Do I need NAT??


I have a two subnet configuration at my house.

The first subnet (192.168.1.0/24) includes my broadband modem/router.

My second subnet (192.168.2.0/24) contains all of my client computers - desktops, xbox, laptops, etc

Sitting on both these networks is my debian box (acting as a router) - it has two interfaces:
eth1 192.168.1.2 (first subnet)
eth0 192.168.2.2 (second subnet)


Now in order for my client computers to access the net I configured the Debian box to NAT using the command:
Code:
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
(I have a script that sets up a bunch of other iptables rules as well as enabling ip forwarding)

So Now the questions!
1. Is it inefficient to have my packets being NAT'ed twice - once at the modem and once at my debian box ??
2. Should I get rid of NAT and just have the packets forwarded on to the first subnet from the second?
3. Does anyone know how would I should go about doing this?

let me know if you want me to post my full IPTABLES script.

Last edited by jimbo7; 11-07-2007 at 02:52 AM.
 
Old 11-07-2007, 08:16 AM   #2
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
natting twice is redundant and not necessary. You should only need to nat at the internet connection, and if this is being done by your broadband modem, you shouldn't need to do it again in your Linux router.
 
Old 11-08-2007, 01:21 AM   #3
jimbo7
LQ Newbie
 
Registered: Jun 2006
Posts: 19

Original Poster
Rep: Reputation: 0
OK to remove the duplication of NAT, I just commented out the POSTROUTING iptables rule, then created a static route on my adsl modem/router pointing back at my second subnet.

static route settings:
Code:
Destination 192.168.2.0
Netmask     255.255.255.0
Gateway     192.168.1.2
Interface   iplan

Last edited by jimbo7; 11-08-2007 at 01:22 AM.
 
  


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
Nat help please Brujah-99 Linux - Networking 3 07-23-2005 11:07 AM
I configure NAT and use "services ..." to save it but when I reboot there is no nat bruack Linux - Software 4 09-01-2004 02:38 AM
Susefirewall2 Nat Problem / nat 1:1 trubi Linux - Distributions 0 07-20-2004 05:50 AM
NAT....Tell me about it alaios Linux - Networking 2 03-25-2004 01:37 AM
What's the difference between Linux-NAT and Sygate-NAT? yuzuohong Linux - Networking 0 08-07-2002 04:07 AM

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

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