Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@lists.netfilter.org
Subject: Re: matching -d to a given interface without specifying ip address
Date: Fri, 08 Sep 2006 11:44:43 +0200	[thread overview]
Message-ID: <45013B8B.2040801@plouf.fr.eu.org> (raw)
In-Reply-To: <4500CA7B.6050304@nth.ca>

Dmitri a écrit :
> Danny Rathjens wrote:
> 
>> Dmitri wrote:
>>
>>> The problem with specifying an IP is that it may change, which breaks 
>>> the rules and requires an update (and detection as well). Event for a 
>>> static IP, that's an extra dependency to watch out for.
>>
>> That's what variables in your firewall script are for.
>> Just re-run it when your network connection restarts:
>> EXTIF="eth0"
>> EXTIP=`ifconfig $EXTIF |perl -ne'print $1 if /inet addr:([\d.]+)/'`
>> iptables -A INPUT -j ACCEPT -i $EXTIF -p tcp -d $EXTIP --dport 80
> 
> Yes, but it's exactly the sort of hack I hoped to avoid. For a perfectly 
> simple expression, now I need to 1) detect that IP changed or connection 
> restarted, and 2) run the hack. There isn't supposed to be any firewall 
> script.

 From what you wrote in your messages, I understand that your box serves 
as a gateway with an ethernet interface on the LAN side and a PPP 
interface on the WAN side. On the LAN side, a gateway address is not 
likely to change, so I don't see a reason to worry about changes of the 
address of the ethernet interface. On the WAN side, pppd can run scripts 
every time the PPP connection goes up or down and provide them useful 
information in environment variable such as the IP address, the peer 
address, the interface name... without the need fo hugly hacks.

> It's like SNAT vs. MASQUERADE - MASQUERADE works without any scripts or 
> reloads.

Or not. MASQUERADE does not work in some special cases when advanced 
routing is used. MASQUERADE is not just SNAT with a dynamic address, it 
is much more. For example you don't actually tell MASQUERADE "use that 
interface address" but rather "use the suitable source address for the 
packet destination".


  reply	other threads:[~2006-09-08  9:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-02 22:32 matching -d to a given interface without specifying ip address Dmitri
2006-09-04  5:05 ` Rob Sterenborg
2006-09-05  4:42   ` Dmitri
2006-09-05  4:43     ` Rob Sterenborg
2006-09-08  2:03       ` Dmitri
2006-09-06 18:11     ` Danny Rathjens
2006-09-08  1:42       ` Dmitri
2006-09-08  9:44         ` Pascal Hambourg [this message]
2006-09-08  9:26 ` Pascal Hambourg

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=45013B8B.2040801@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --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