From: Christian Fassina Costa <atros@atros.org>
To: netfilter@lists.netfilter.org
Subject: nat throught different gateways
Date: Mon, 25 Oct 2004 23:27:48 -0300 [thread overview]
Message-ID: <1098757668.4899.17.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
Hi ppl,
I have the following scenario:
A internal network 10.1.0.0/24
A gateway with 3 interfaces
eth0 adsl provided ip address
eth1 10.1.0.1 (internal network)
ppp0 192.168.0.234 (vpn to a foreign computer)
The host in the other end is doing NAT with iptables for all addresses.
What I'd like to do:
Since I have several computer in my LAN I'd like one of them to use ppp0
as output interface. I added a route to my internal network in the other
end of my vpn (route add -net 10.1.0.0/24 gw 192.168.0.234).
If I add a static route, for instance: route add -host www.google.com gw
192.168.0.1, it works fine.
I tried adding an iptables rule as it follows:
iptables -t nat -A POSTROUTING -s 10.1.0.0/24 -o ppp0 -j MASQUERADE
I can successfully ping 192.168.0.1 but I figured out that the NAT is
not working as I expected (traffic going out via ppp0).
I even tried setting up an alias for my eth1 with a different network
10.2.0.1
then I set up my computer with the address 10.1.0.2 with default gw
10.2.0.1.
If I use the following rule:
iptables -t nat -A POSTROUTING -s 0/0 -o eth0 -j MASQUERADE
it works fine for me and the other computers in the 10.1.0.0 network.
Then I tried
iptables -t nat -A POSTROUTING -s 10.1.0.0/24 -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.2.0.0/24 -o ppp0 -j MASQUERADE
I worked fine for the 10.1.0.0 network but no for the 10.2.0.0 network.
Does anyone know how to solve this issue? I also read some ip route
documentation but did not find anything suitable to solve this problem.
Regards,
Christian
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2004-10-26 2:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-26 2:27 Christian Fassina Costa [this message]
2004-10-26 3:43 ` nat throught different gateways Jason Opperisano
2004-10-26 9:20 ` Christian Fassina Costa
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=1098757668.4899.17.camel@localhost \
--to=atros@atros.org \
--cc=netfilter@lists.netfilter.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox