Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
To: Glen Huang <curvedmark@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: How are tunneled interfaces masqueraded?
Date: Thu, 02 Jul 2015 23:42:38 +0200	[thread overview]
Message-ID: <5595B04E.2050801@plouf.fr.eu.org> (raw)
In-Reply-To: <CB9FFA86-278F-4EB5-9C90-9EBFF70DF32C@gmail.com>

Glen Huang a écrit :
> Hi,
> 
> If I masquerade a pppoe interface that connects a host to its ISP,

Which interface exactly ?
There are two network interfaces involved in a PPPoE connection : the
ethernet interface (eth?) transmitting and receiving the encapsulating
PPPoE frames and the PPP interface (ppp?) transmitting and receiving the
encapsulated IP packets (or any other network protocol negotiated with a
NCP) of the PPP session.

> and although ethernet frames encapsulating ppp frames travel through
> this interface, netfilter digs into the ppp frames and translate the
> encapsulated IP packets. Is this correct?

If you masquerade packets going out the PPP interface ppp?, netfilter
doesn not have to dig into anything : the packets are plain IP packets,
so they are passed to iptables.

If you masquerade packets going out the ethernet interface eth?, the
packets are PPPoE frames, not IP packets, so netfilter will usually not
see them. The exception is if the ethernet interface is part of a
bridge, CONFIG_BRIDGE_NETFILTER is enabled in the kernel and the sysctls
net.bridge.bridge-nf-filter-pppoe-tagged and
net.bridge.bridge-nf-call-iptables are enabled. Then netfilter digs into
the PPPoE frames and passes the encapsulated IP packets to iptables.
Besides, I suspect that if the PPPoE frames are locally generated (i.e.
not bridged), the encapsulated IP packets have already been seen by
iptables POSTROUTING chain at the IP layer and had the opportunity to be
masqueraded, so another IP masquerading at the bridge layer is not possible.

> If so, what about the case where the ppp interface is tunneled?
> Let's take pptp for an example. If a ppp interface is created with pppd,
> then tunneled through GRE by pptpd, and i masquerade that ppp interface,
> as outbound packets travel through it, what packets are translated?
> The ones that travels in the virtual ppp interface or the ones that is
> generated by pptpd and get sent to the outside world?

The ones that travel through the PPP interface of course.

      reply	other threads:[~2015-07-02 21:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 14:55 How are tunneled interfaces masqueraded? Glen Huang
2015-07-02 21:42 ` Pascal Hambourg [this message]

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=5595B04E.2050801@plouf.fr.eu.org \
    --to=pascal@plouf.fr.eu.org \
    --cc=curvedmark@gmail.com \
    --cc=netfilter@vger.kernel.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