netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SNAT and contrack helpers
@ 2015-09-15 20:33 johan
  0 siblings, 0 replies; only message in thread
From: johan @ 2015-09-15 20:33 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-15 20:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 20:33 SNAT and contrack helpers johan

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).