netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Hall <netfilter@gmch.uk>
To: netfilter@vger.kernel.org
Subject: snat and Port Numbers
Date: Mon, 3 Mar 2025 18:16:45 +0000	[thread overview]
Message-ID: <e526722b-9ec7-49db-8b22-a756a390b24c@gmch.uk> (raw)
In-Reply-To: <93e5770f-86d1-4c07-b9c9-ba8953e1796c@gmch.uk>


I'm trying to understand what ports the netfilter snat will map TCP/UDP 
connections to.  I've tried, but failed, to find answers elsewhere :-(

---------------

For iptables the SNAT target may be set:

    --to-source [ipaddr[-ipaddr]][:port[-port]]

where [according to iptables-extensions(8)]:

    "If no port range is specified, then source ports below 512 will
     be mapped to other ports below 512: those between 512 and 1023
     inclusive will be mapped to ports below 1024, and other ports
     will be mapped to 1024 or above.  Where possible, no port
     alteration will occur."

Is the nftables snat the same ??

If a port range is specified, will all source ports be forced into that 
range ??  Or are source ports below 1024 still mapped separately ??

Then there are the /proc/sys/net/ipv4 entries:

   ip_local_port_range:        32768   60999
   ip_local_reserved_ports:    <empty>
   ip_unprivileged_port_start: 1024

Do these interact with the source port mapping for snat at all ??

RFC's 4787 & 5382 REQUIRE "Endpoint-Independent Mapping".  Is that 
supported ??

Thanks,

Chris

       reply	other threads:[~2025-03-03 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <93e5770f-86d1-4c07-b9c9-ba8953e1796c@gmch.uk>
2025-03-03 18:16 ` Chris Hall [this message]
2025-03-03 19:31   ` snat and Port Numbers Kerin Millar

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=e526722b-9ec7-49db-8b22-a756a390b24c@gmch.uk \
    --to=netfilter@gmch.uk \
    --cc=netfilter@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).