* SNAT from multiple interfaces with the same IP?
@ 2005-12-04 12:30 Carl-Daniel Hailfinger
2005-12-04 15:31 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Carl-Daniel Hailfinger @ 2005-12-04 12:30 UTC (permalink / raw)
To: Netfilter Development Mailinglist
Hi,
some time ago, I read that netfilter is unable to perform SNAT
for identical ranges on different interfaces.
Scenario:
eth0: 192.168.0.1/16
eth1: 192.168.0.1/16
eth2: 10.2.0.1/8
iptables -t nat -A POSTROUTING -i eth0 -s 192.168.0.0/16 -j SNAT --to-source 10.0.0.0-10.0.255.255
iptables -t nat -A POSTROUTING -i eth1 -s 192.168.0.0/16 -j SNAT --to-source 10.1.0.0-10.1.255.255
Will that work or is connection tracking unable to differentiate
between the 192.168/16 subnets on eth0 and eth1? My problem is
that although the ranges on eth0 and eth1 are sparsely populated,
some IPs exist in both networks. Communication between the networks
on eth0 and eth1 is not necessary, I just want them to be able to
communicate with the outside (on eth2).
If this is not possible, is there a patch in POM or something else
with which I can achieve my goal with only one machine.
Regards,
Carl-Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SNAT from multiple interfaces with the same IP?
2005-12-04 12:30 SNAT from multiple interfaces with the same IP? Carl-Daniel Hailfinger
@ 2005-12-04 15:31 ` Patrick McHardy
2005-12-04 15:37 ` Herve Eychenne
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2005-12-04 15:31 UTC (permalink / raw)
To: Carl-Daniel Hailfinger; +Cc: Netfilter Development Mailinglist
Carl-Daniel Hailfinger wrote:
> Hi,
>
> some time ago, I read that netfilter is unable to perform SNAT
> for identical ranges on different interfaces.
>
> Scenario:
>
> eth0: 192.168.0.1/16
> eth1: 192.168.0.1/16
> eth2: 10.2.0.1/8
>
> iptables -t nat -A POSTROUTING -i eth0 -s 192.168.0.0/16 -j SNAT
> --to-source 10.0.0.0-10.0.255.255
> iptables -t nat -A POSTROUTING -i eth1 -s 192.168.0.0/16 -j SNAT
> --to-source 10.1.0.0-10.1.255.255
>
> Will that work or is connection tracking unable to differentiate
> between the 192.168/16 subnets on eth0 and eth1? My problem is
> that although the ranges on eth0 and eth1 are sparsely populated,
> some IPs exist in both networks. Communication between the networks
> on eth0 and eth1 is not necessary, I just want them to be able to
> communicate with the outside (on eth2).
I don't see why it wouldn't work, but you can't use -i in POSTROUTING
directly, you need to mark the packets or just SNAT unconditionally.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SNAT from multiple interfaces with the same IP?
2005-12-04 15:31 ` Patrick McHardy
@ 2005-12-04 15:37 ` Herve Eychenne
2005-12-04 16:02 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Herve Eychenne @ 2005-12-04 15:37 UTC (permalink / raw)
To: Patrick McHardy, Netfilter Development Mailinglist
On Sun, Dec 04, 2005 at 04:31:59PM +0100, Patrick McHardy wrote:
> I don't see why it wouldn't work, but you can't use -i in POSTROUTING
> directly,
BTW, I've always wondered why exactly...
> you need to mark the packets or just SNAT unconditionally.
Herve
--
_
(°= Hervé Eychenne
//)
v_/_ WallFire project: http://www.wallfire.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SNAT from multiple interfaces with the same IP?
2005-12-04 15:37 ` Herve Eychenne
@ 2005-12-04 16:02 ` Patrick McHardy
2005-12-04 23:35 ` Herve Eychenne
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2005-12-04 16:02 UTC (permalink / raw)
To: Herve Eychenne; +Cc: Netfilter Development Mailinglist
Herve Eychenne wrote:
> On Sun, Dec 04, 2005 at 04:31:59PM +0100, Patrick McHardy wrote:
>
>
>>I don't see why it wouldn't work, but you can't use -i in POSTROUTING
>>directly,
>
>
> BTW, I've always wondered why exactly...
Two reasons:
- The incoming interface is not known anymore in POST_ROUTING
- Locally generated packets don't even have an incoming interface
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SNAT from multiple interfaces with the same IP?
2005-12-04 16:02 ` Patrick McHardy
@ 2005-12-04 23:35 ` Herve Eychenne
2005-12-04 23:41 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Herve Eychenne @ 2005-12-04 23:35 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Netfilter Development Mailinglist
On Sun, Dec 04, 2005 at 05:02:09PM +0100, Patrick McHardy wrote:
> Herve Eychenne wrote:
> >On Sun, Dec 04, 2005 at 04:31:59PM +0100, Patrick McHardy wrote:
> >
> >
> >>I don't see why it wouldn't work, but you can't use -i in POSTROUTING
> >>directly,
> >
> >
> >BTW, I've always wondered why exactly...
> Two reasons:
> - The incoming interface is not known anymore in POST_ROUTING
Sorry, but... why? (that was my question indeed)
> - Locally generated packets don't even have an incoming interface
So what?
If you could use -i, then locally generated packets wouldn't match
(that's not a problem because you would do it on purpose).
If you don't, it would work as it used to till now.
Herve
--
_
(°= Hervé Eychenne
//)
v_/_ WallFire project: http://www.wallfire.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: SNAT from multiple interfaces with the same IP?
2005-12-04 23:35 ` Herve Eychenne
@ 2005-12-04 23:41 ` Patrick McHardy
0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2005-12-04 23:41 UTC (permalink / raw)
To: Herve Eychenne; +Cc: Netfilter Development Mailinglist
Herve Eychenne wrote:
> On Sun, Dec 04, 2005 at 05:02:09PM +0100, Patrick McHardy wrote:
>
>>- The incoming interface is not known anymore in POST_ROUTING
>
> Sorry, but... why? (that was my question indeed)
In the input path the incoming interface is stored in the skb
in skb->dev. On the output path (POST_ROUTING) it contains the
outgoing interface. This might actually be changeable with not
too much effort, one of my IPsec patches already reorders the
POST_ROUTING hook.
>>- Locally generated packets don't even have an incoming interface
>
> So what?
> If you could use -i, then locally generated packets wouldn't match
> (that's not a problem because you would do it on purpose).
> If you don't, it would work as it used to till now.
Yes, that wouldn't be problem.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-12-04 23:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-04 12:30 SNAT from multiple interfaces with the same IP? Carl-Daniel Hailfinger
2005-12-04 15:31 ` Patrick McHardy
2005-12-04 15:37 ` Herve Eychenne
2005-12-04 16:02 ` Patrick McHardy
2005-12-04 23:35 ` Herve Eychenne
2005-12-04 23:41 ` Patrick McHardy
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.