Skip to contentSkip to conversation

New: masquarade and source ip

Bugme-new David S. Miller 3 participants 4 messages Feb 7, 2005 – Feb 8, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Didn't this get changed on purpose?

Begin forwarded message:

Date: Mon, 7 Feb 2005 11:18:22 -0800
From: Andrew Morton <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Fw: [Bugme-new] [Bug 4180] New: masquarade and source ip

Begin forwarded message:

Date: Mon, 7 Feb 2005 10:16:56 -0800
From: [email protected]
To: [email protected]
Subject: [Bugme-new] [Bug 4180] New: masquarade and source ip

http://bugme.osdl.org/show_bug.cgi?id=4180

Summary: masquarade and source ip
Kernel Version: 2.6.10
Status: NEW
Severity: normal
Owner: [email protected]
Submitter: [email protected]

i try next on router (eth0 - inernet, eth1 - localnet):

ip addr add eth0 1.2.3.4
ip addr add eth0 2.3.4.5

ip route add default via 2.3.4.6 src 2.3.4.5

iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -d ! 10.0.0.0/8 -j MASQUERADE

if i do ping www.google.com from router source ip is 2.3.4.5, but if i do ping from local network source ip is 1.2.3.4 (i think it's wrong)

with older kernel source ip is always set to 2.3.4.5

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

#1 lore raw
Quoted 2 lines · David S. Miller

Didn't this get changed on purpose?

Yes. One thing we could do to make it more consistent is treat local packets the same way as forwarded ones in MASQUERADE, then at least all packets would have the same source address. This check currently prevents local packets from beeing masqueraded:

       /* FIXME: For the moment, don't do local packets, breaks
          testsuite for 2.3.49 --RR */
       if ((*pskb)->sk)
               return NF_ACCEPT;

I'm not sure if we can simply remove it, maybe Rusty remembers :)

Regards
Patrick

Quoted 9 lines

Begin forwarded message:

if i do ping www.google.com from router source ip is 2.3.4.5, but if i do ping from local network source ip is 1.2.3.4 (i think it's wrong)

with older kernel source ip is always set to 2.3.4.5

#2 lore raw
Quoted 7 lines · On Mon, 07 Feb 2005 21:15:50 +0100 Patrick McHardy <[email protected]> wrote:
Quoted 1 line

Didn't this get changed on purpose?

Yes. One thing we could do to make it more consistent is treat local packets the same way as forwarded ones in MASQUERADE, then at least all packets would have the same source address. This check currently prevents local packets from beeing masqueraded:

Quoted 6 lines
        /* FIXME: For the moment, don't do local packets, breaks
           testsuite for 2.3.49 --RR */
        if ((*pskb)->sk)
                return NF_ACCEPT;

I'm not sure if we can simply remove it, maybe Rusty remembers :)

Ok, when you figure out what's going on please post the analysis to netdev et al., and in particular Andrew or Stephen, so the bugzilla can get closed properly.

Thanks.

#3 lore raw
Quoted 10 lines · David S. Miller
Quoted 7 lines · On Mon, 07 Feb 2005 21:15:50 +0100 Patrick McHardy <[email protected]> wrote:
Quoted 1 line

Didn't this get changed on purpose?

Yes. One thing we could do to make it more consistent is treat local packets the same way as forwarded ones in MASQUERADE, then at least all packets would have the same source address. This check currently prevents local packets from beeing masqueraded:

Quoted 6 lines
Quoted 6 lines
        /* FIXME: For the moment, don't do local packets, breaks
           testsuite for 2.3.49 --RR */
        if ((*pskb)->sk)
                return NF_ACCEPT;

I'm not sure if we can simply remove it, maybe Rusty remembers :)

Remove it; nothing should break. The network code used to hate local packets getting changed, but we do the right thing these days (if not, that's another bug).

Quoted 3 lines

Ok, when you figure out what's going on please post the analysis to netdev et al., and in particular Andrew or Stephen, so the bugzilla can get closed properly.

We vastly simplified the masquerade code to use inet_select_addr(), because its purpose is for dynamic links. This user should be using SNAT to specify exactly what he/she wants.

Rusty.

Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman