Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Daniel <tech@tootai.net>
Cc: netfilter@vger.kernel.org
Subject: Re: NAT - how external source port is selected
Date: Wed, 18 Aug 2021 16:46:15 +0200	[thread overview]
Message-ID: <20210818144615.GQ607@breakpoint.cc> (raw)
In-Reply-To: <9cc05668-b4fb-4ed8-1588-7a0f5c378b3a@tootai.net>

Daniel <tech@tootai.net> wrote:
> how on a NAT firewall server using iptables or nftables, are the external
> source ports choosen ? I would say range is 1024-65535 but if for instance I
> use port 5060 for SIP this one can not be used as source port. Is there a
> table of at time used ports ?

Are you talking about SNAT/MASQUERADE?

It will try to use whatever port is used.  If the source address
replacement results in a collision, it tries to pick a different source
port between 1024 and 65535.

> Also, SNOM phones are systematically using port 2048 as source port of the
> WAN ip. Is there a mechanism to allow such behavior ?

What do you mean? The initiator is free to pick whatever source port they like.

  parent reply	other threads:[~2021-08-18 14:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 13:53 NAT - how external source port is selected Daniel
2021-08-18 14:22 ` Reindl Harald
2021-08-18 14:50   ` Daniel
2021-08-18 15:15     ` Reindl Harald
2021-08-18 14:46 ` Florian Westphal [this message]
2021-08-18 15:12   ` Daniel
     [not found]     ` <20210818161622.GS607@breakpoint.cc>
2021-08-18 16:43       ` Daniel
2021-08-18 14:52 ` AW: " Thomas Bätzler

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=20210818144615.GQ607@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netfilter@vger.kernel.org \
    --cc=tech@tootai.net \
    /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