netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: johan <johan.peeters111@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: SNAT and contrack helpers
Date: Tue, 15 Sep 2015 22:33:19 +0200	[thread overview]
Message-ID: <55F8808F.5050900@gmail.com> (raw)

Hello,

I just figured out that conntrack helpers don't obey the configured NAT 
rules when predicting the related streams. This starts to be an issue in 
MAP network deployments where each home user only gets a part of the 
available port range [1024-65534].

The MAP-T architecture is included for convenience (extract from 
draft-mdt-softwire-map-translation-01)

        User N

        Private IPv4

       |  Network

       |

    O--+---------------O

    |  | MAP-T CE      |

    | +-----+--------+ |

    | NAPT44|  MAP-T | `-.

    | +-----+      | |  -._   ,-------.                     .------.

    |       +--------+ |   ,-'         `-.                ,-'       `-.

    O------------------O  /              \   O---------O /   Public   \

                          /   IPv6 only   \  |  MAP-T  |/     IPv4     \

                         (    Network      --+  Border +-   Network     )

                          \ (MAP-T Domain)/  |  Relay  |\              /

    O------------------O  \              /   O---------O \             /

    |    MAP-T CE      |   ;".         ,-'                `-.       ,-'

    | +-----+--------+ | ,"   `----+--'                      ------'

    | NAPT44|  MAP-T | | ,"        |

    | +-----+        | |        IPv6 Server(s)

    |   |   +--------+ |         (v4 mapped

    O---.--------------O          address)

        |

          User M

        Private IPv4

          Network

In above architecture the (NAT44) NAPT [RFC2663] function on a MAP CE is 
extended with support for restricting the allowable TCP/UDP ports for a 
given IPv4 address. Restricting those TCP/UDP ports by using SNAT fails 
for related streams.

Lets take as an example a FTP client in ACTIVE mode which downloads a 
file form the WAN. On the NAT box placed between LAN and WAN next 
MASQUERADE rule is in place:

iptables -t nat -A zone_wan_postrouting -p tcp -j MASQUERADE --to-ports 
4000-4500

We will see that the NAT box uses ports in the range 4000-4500 for its 
control connection, however the data connection (predicted by the NAT 
box) will use the ports used by the FTP client instead of using a port 
out of the port range imposed by the MASQUERADE rule. The same problem 
is present for other helpers too as we have RTSP/SIP/IRC/...

I'm wondering how this issue can be fixed, all suggestions/ideas are 
welcome. Is there any specific reason why the NAT rules aren't checked 
for the predictions?

Kind regards

Johan Peeters

                 reply	other threads:[~2015-09-15 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=55F8808F.5050900@gmail.com \
    --to=johan.peeters111@gmail.com \
    --cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).