All of lore.kernel.org
 help / color / mirror / Atom feed
From: srg <srgqwerty@telefonica.net>
To: spdesai@gnvfc.net, netfilter@lists.netfilter.org
Subject: Re: Linux Router
Date: Mon, 07 Feb 2005 21:43:59 +0100	[thread overview]
Message-ID: <4207D30F.3090102@telefonica.net> (raw)
In-Reply-To: <1107711419.420655bbc259e@mail.gnvfc.net>

Hello:

You have two solutions (one exclude the other):

1. NO nat in the linux machine.
The solution is adding a static route at the router (.65) in the form:
ip route add 192.168.1.0/24 via xxx.xxx.xxx.68
With this solution traffic from your private network is seen by the 
router with the real source address (192.168.1.x).
Of course, if you want this traffic to go to Internet then, the router 
must do source nat (because the source addr will be a private one).

2. nat in the linux machine.
iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -d 0/0 -j 
MASQUERADE
With this solution, traffic originating in your private net will have 
xxx.xxx.xxx.68 source address when the packets leave the linux machine, 
so when the packets arrive to the router (xxx.xxx.xxx.65) will have the 
xxx.xxx.xxx.68 addr (in other words, if you want, those packets can go 
directly to the Internet without the need of another nat in the router)

spdesai@gnvfc.net wrote:

>Hi
>
>I have one linux machine with two NIC cards. One is connected to internet and 
>one is private PC. Below is my IP configuration
>
>eth0: Valid IP: xxx.xxx.xxx.68
>      Mask: 255.255.255.192
>      Gateway: xxx.xxx.xxx.65  
>
>eth1: Invalid IP: 192.168.1.1
>       Mask : 255.255.255.0
>      Gateway: xxx.xxx.xxx.65 
>
>
>Now when i connect eth1 to window machine. i can ping up to eth0 valid ip i.e 
>xxx.xxx.xxx.68 but could not ping xxx.xxx.xxx.65 which is gateway ip of linux.
>
>I have enable ip_forward to 1 in linux machine.
>
>My window machine ip is: 
>IP: 192.168.1.2
>Mask:255.255.255.0
>GW: 192.168.1.1
>
>Pl. give me the solution so i can ping xxx.xxx.xxx.65 from my window machine.
>
>Thanks in advance
>
>suhag.
>
>
>
>-------------------------------------------------
>This mail sent through IMP: http://horde.org/imp/
>
>
>
>  
>



  parent reply	other threads:[~2005-02-07 20:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-06 17:36 Linux Router spdesai
2005-02-06 19:46 ` Jason Opperisano
2005-02-07 20:43 ` srg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-22 23:09 Carlos Narváez
2007-09-23  2:10 ` ben soo
2007-09-23  6:25   ` Jan Engelhardt
2007-09-23  6:39 ` Benny Amorsen
     [not found] <F4D3DB9A18752A4F99FD880ABC5407179D136B@ccdc-exchg.careerco mmunity.com>
2002-05-20 17:49 ` Linux router Ray Olszewski
2002-05-20 10:59 Sridhar J
2002-05-20 20:38 ` Petre Bandac
2002-05-21  0:57 ` Vince Coen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4207D30F.3090102@telefonica.net \
    --to=srgqwerty@telefonica.net \
    --cc=netfilter@lists.netfilter.org \
    --cc=spdesai@gnvfc.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.