Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Andrew Beverley <andy@andybev.com>
To: Tony Rogers <tony.rogers@erudine.com>
Cc: netfilter@vger.kernel.org
Subject: Re: iptables - external IP address on internal interface?
Date: Fri, 15 Apr 2011 16:29:32 +0100	[thread overview]
Message-ID: <1302881372.4938.62.camel@andybev-desktop> (raw)
In-Reply-To: <1302873712.2984.17.camel@HP-019.Erudine.local>

> > Anyway, back to the original subject, can you post the output from
> > "iptables-save" instead, as this has additional detail such as the
> > interfaces in the rules.
> > 
> > As a thought before you do so, if you're doing NAT in the normal way to
> > share an internet connection, then what you are seeing is to be
> > expected. You would normally SNAT on the internet-facing interface, not
> > on the LAN-facing interface, meaning that traffic on the LAN interface
> > will be going from/to public IP addresses.
> 
> Output of "iptables-save" below.
> 
> *however*
> 
> I *think* I may have solved it - I will know when I see the logs tomorrow morning.
> 
> I changed my MASQ entry from MASQUERADE any to only MASQ my internal
>  IP. (see last but two lines)
> 

Ah, that would make sense.

> Also - unless I misunderstand the rules - my SNAT is applied to the external interface?
> 

<snip>

> *nat
> -A POSTROUTING -s 192.168.0.0/255.255.255.0 -m mark --mark 0x1 -j SNAT --to-source 192.168.0.1 

Probably, yes, if all the clients on the internal network match the
address range above, but if that's what you want then use -o $EXT_IF.

Out of interest, why would you want to SNAT a public facing interface to
a private IP address?

> -A POSTROUTING -s 192.168.0.0/255.255.255.0 -o eth1 -j MASQUERADE 

Are you sure you want MASQUERADE? If you're using a static IP address
then you should use SNAT instead (see the man page). You can probably
drop the "-s 192.168.0.0/255.255.255.0" as well.

Andy



  reply	other threads:[~2011-04-15 15:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 14:04 iptables - external IP address on internal interface? Tony Rogers
2011-04-11 14:42 ` Usuário do Sistema
2011-04-11 14:53 ` Jan Engelhardt
2011-04-11 17:52 ` Andrew Beverley
2011-04-12  9:20   ` Tony Rogers
2011-04-12 19:26     ` Andrew Beverley
2011-04-12 20:31       ` Robert Nichols
     [not found]     ` <1302626146.4938.1.camel@andybev-desktop>
     [not found]       ` <054F5B1BB94BD943B243C3B39B4F568D0161B8F7@victory.Erudine.local>
     [not found]         ` <1302636161.4938.5.camel@andybev-desktop>
2011-04-12 21:37           ` Tony Rogers
2011-04-14 20:24             ` Andrew Beverley
2011-04-15 13:21               ` Tony Rogers
2011-04-15 15:29                 ` Andrew Beverley [this message]
2011-04-20 12:19                   ` Tony Rogers
2011-04-20 19:41                     ` Andrew Beverley

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=1302881372.4938.62.camel@andybev-desktop \
    --to=andy@andybev.com \
    --cc=netfilter@vger.kernel.org \
    --cc=tony.rogers@erudine.com \
    /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