LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-01-2013, 08:02 AM   #1
Annielover
Member
 
Registered: May 2011
Location: Belgium
Distribution: Ubuntu Server Edition, Fedora 16
Posts: 90

Rep: Reputation: 8
Confused about NAT / masquerading


Hi all,

I'm a bit confused, my home network is divided into two subnets: 192.168.100.0 and 192.168.1.0.
I've configured my Linux server to act as a router.

IP forwarding is on:
Code:
cat /proc/sys/net/ipv4/ip_forward
1
The 192.168.1.0 network is able to access the internet, but the 192.168.100.0 network is not.
However, from a pc with IP address 192.168.100.21 i can ping the web interface of my local ISP router (192.168.1.1), so I guess the routing is setup correctly...

Here is my routing table:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
and my interface config:

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

auto eth1
iface eth1 inet static
        address 192.168.100.1
        netmask 255.255.255.0
        network 192.168.100.0
        broadcast 192.168.100.255
eth1 doesn't have a gateway set, is that correct?

Some people advise me to use NAT, but 192.168.100.0 and 192.168.1.0 are both internal networks, so I don't think NAT is needed... or does it?

Should I consider using masquerading instead? As I said, I'm a bit confused...

I do find it very strange that i.e. IP address 192.168.1.21 CAN access the internet, but IP address 192.168.100.21 CANNOT... while they can ping each other...

What am I doing wrong of what do I misunderstand about NAT?

Thanks!!
 
Old 04-01-2013, 08:33 AM   #2
netnix99
Member
 
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 99
The two networks can ping each other because the router (Linux Server) knows where both networks are located. The 192.168.100.x network cannot access the internet because there is no gateway set for that network. You will need to set a gateway for the 192.168.100.0 network in order to access the internet.

This is not a good example of where to use NAT (masquerading is just another name for NAT).
http://en.wikipedia.org/wiki/Network...ss_translation
 
  


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
iptables: NAT/masquerading functions, DNS lookups fail cdean Linux - Networking 8 04-08-2007 03:24 AM
NAT - I think the NIC's get confused... ninjaz Linux - Networking 12 08-23-2005 05:20 PM
IPfiltering, NAT, Masquerading, Packet Rewriting to disguise internal systems exabrial Linux - Networking 2 07-11-2005 06:22 PM
NAT and Masquerading monohouse Linux - Software 3 12-05-2004 03:27 AM
NAT or Masquerading xviddivxoggmp3 Slackware 2 03-04-2004 11:55 AM

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

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