From: Joel Newkirk <netfilter@newkirk.us>
To: Miguel Manso <mmanso@yahoo.com>, netfilter@lists.netfilter.org
Subject: Re: Linux routing scenario - is this possible?
Date: Mon, 17 Mar 2003 01:34:47 -0500 [thread overview]
Message-ID: <200303170134.47476.netfilter@newkirk.us> (raw)
In-Reply-To: <20030317002939.53637.qmail@web11505.mail.yahoo.com>
On Sunday 16 March 2003 07:29 pm, Miguel Manso wrote:
> Hi there,
>
> First of all, thanks for the answer.
:^)
> The private IP I must assign to eth0 and eth2 (I was thinking about
> 192.168.1.254 and 192.168.2.254) will be used like gateways in both
> comapnies, no? If so, how do I say on the linux machine (router) that
> connections from 192.168.1.254 should leave with IP 123.123.123.100
> and connections from 192.168.2.254 with IP 123.123.123.101?
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.1.0/24 \
-j SNAT --to 123.123.123.100
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.2.0/24 \
-j SNAT --to 123.123.123.101
OR
iptables -t nat -A POSTROUTING -i eth0 -j SNAT --to 123.123.123.100
iptables -t nat -A POSTROUTING -i eth2 -j SNAT --to 123.123.123.101
> Don't know if I'm expressing myself correctly.
You seem clear to me.
Your first priority needs to be determining if you can use the two IPs
and distinguish between them on your box. If the NAT from local IPs to
public and back is all handled by the modem then netfilter on a machine
connected to that modem probably can't do a thing. If this is what is
happening, you need to see if you can reconfigure the modem to pass
things through unchanged.
I'm not sure what your DSL setup is like. For me, I use a Westell White
modem, and even though it connects via ethernet to my gateway, it works
like a 'normal' modem, where the gateway itself has the IPs via PPPoE,
not the modem. The modem itself is transparent - for all intents and
purposes my gateway connects 'directly' to the upstream gateway at my
ISP.
> Well, the modem IP is 192.168.0.1 (can be configured on the modem via
> a http interface) and I've just assigned on the linux box (acting as a
> router) the 192.168.0.5 IP to the ethernet where I connect the modem
> to. On this machine I've defined the modem IP 192.168.0.1 as being the
> gateway.
OK, but when the incoming traffic reaches your netfilter box, what is its
destination IP? If it no longer has the 123.123.123.100 and
123.123.123.101 IPs at that point, then you can't DNAT on the iptables
box. (well, of course you CAN, but telling the two streams of traffic
apart is the problem) If you don't know, try setting a LOG rule:
iptables -t nat -I PREROUTING 1 -i eth1 -p icmp -j LOG --log-prefix
"ICMP:"
for instance. With this rule in place, have someone at a machine outside
your network ping your public IPs through the internet, and see what the
log shows for DestinationIP of the incoming Pings. After they try the
ping (even if it doesn't get through) try "cat /var/log/messages | grep
ICMP". (BTW, the "-I ... 1" means insert as rule #1 in the chain)
> > Also, be aware that if you redirect all incoming 123.123.123.100 to
> > one company, and all 123.123.123.101 to the other, that leaves
> > nothing incoming to you.
> Yes, but that's not a problem since one of the companies is my own.
> We've one 1024 kbits DSL line and we're trying to "split" the costs
> between our and other companies.
OK.
> Any information about the subject will be appreciated. I'm a newbie on
> the subject needing some direction points.
First resource oughtta be http://iptables-tutorial.frozentux.net
j
next prev parent reply other threads:[~2003-03-17 6:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-16 21:25 Linux routing scenario - is this possible? Miguel Manso
2003-03-16 22:00 ` Joel Newkirk
2003-03-17 0:29 ` Miguel Manso
2003-03-17 6:34 ` Joel Newkirk [this message]
2003-03-18 19:18 ` Miguel Manso
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=200303170134.47476.netfilter@newkirk.us \
--to=netfilter@newkirk.us \
--cc=mmanso@yahoo.com \
--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