iptables nat problem

This is a discussion on iptables nat problem within the Linux Security forums, part of the System Security and Security Related category; Hello, I am using the following line to allow all inside to outside traffic to be natted: $IPTABLES -t nat -...


Go Back   Usenet Forums > System Security and Security Related > Linux Security

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-22-2003
Lothar Behrens
 
Posts: n/a
Default iptables nat problem

Hello,

I am using the following line to allow all inside to outside
traffic to be natted:

$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP

I think I get touble with throughput when using this.
I also think, there is traffic from inside to outside that should not be
there, because this rule is to general.

The Global TCP/UDP Protocol Distribution from ntop is about 60 % of other
tcp/udp based protos.

Sample:

Very often I cannot get web pages through my proxy running on that firewall.

Any help ?

Thanks

Lothar
Reply With Quote
  #2 (permalink)  
Old 10-25-2003
Bryan Packer
 
Posts: n/a
Default Re: iptables nat problem

Lothar Behrens wrote:
> Hello,
>
> I am using the following line to allow all inside to outside
> traffic to be natted:
>
> $IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP
>
> I think I get touble with throughput when using this.
> I also think, there is traffic from inside to outside that should not be
> there, because this rule is to general.


You might try $IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -s $LAN -j
SNAT --to $INET_IP

The -s $LAN would only NAT packets from machines behind the firewall. As
written, it would also NAT the packets that the firewall itself sends
out. Not a huge issue, but no point in rewriting packets that don't need
it.

Not sure if using the --to $INET_IP instead of --to-source matters or
not, but it has been working well for me for years.

bryan
--
A Freudian slip is when you say one thing but mean your mother.

Reply With Quote
  #3 (permalink)  
Old 10-27-2003
Lothar Behrens
 
Posts: n/a
Default Re: iptables nat problem

Bryan Packer <bryanp@visi.com.com> wrote in message news:<3f9a9bf9$0$75895$a1866201@authen.newsreader. visi.com>...

> You might try $IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -s $LAN -j
> SNAT --to $INET_IP
>


So I would allow nat only for specific hosts instead $LAN.

> The -s $LAN would only NAT packets from machines behind the firewall. As
> written, it would also NAT the packets that the firewall itself sends
> out. Not a huge issue, but no point in rewriting packets that don't need
> it.


I have seen broadcasts coming from an external IP address on my client
(etheral). Is it possible that I have activated any routing of broadcasts or
is it the host that also has an internal network card where the broadcast comes
from ?

To do more restriction of what to nat, do I simply define $Host $port in that
rule ?

>
> Not sure if using the --to $INET_IP instead of --to-source matters or
> not, but it has been working well for me for years.
>
> bryan


Thanks

Lothar
Reply With Quote
  #4 (permalink)  
Old 11-01-2003
Bryan Packer
 
Posts: n/a
Default Re: iptables nat problem

Lothar Behrens wrote:

> I have seen broadcasts coming from an external IP address on my client
> (etheral). Is it possible that I have activated any routing of broadcasts or
> is it the host that also has an internal network card where the broadcast comes
> from ?


Not enough info to say really, but if there was another machine with both internal
and external interfaces on your network it could do that. I've seen similar things
from broken dial-up clients.

> To do more restriction of what to nat, do I simply define $Host $port in that
> rule ?


You certainly can. I happen to prefer leaving the NAT do NAT without filters, and
do my filtering in the FORWARD and OUTPUT tables. That's what they are there for.
Not mandatory, but it seems more logical to me.

bryan
--
A Freudian slip is when you say one thing but mean your mother.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0