From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pascal Hambourg Subject: Re: How are tunneled interfaces masqueraded? Date: Thu, 02 Jul 2015 23:42:38 +0200 Message-ID: <5595B04E.2050801@plouf.fr.eu.org> References: Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: netfilter-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="iso-8859-1" To: Glen Huang Cc: netfilter@vger.kernel.org Glen Huang a =E9crit : > Hi, >=20 > 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 th= e 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 sysctl= s net.bridge.bridge-nf-filter-pppoe-tagged and net.bridge.bridge-nf-call-iptables are enabled. Then netfilter digs int= o 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 b= e masqueraded, so another IP masquerading at the bridge layer is not poss= ible. > 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 pp= pd, > then tunneled through GRE by pptpd, and i masquerade that ppp interfa= ce, > as outbound packets travel through it, what packets are translated? > The ones that travels in the virtual ppp interface or the ones that i= s > generated by pptpd and get sent to the outside world? The ones that travel through the PPP interface of course.