netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mokhtar BEN MESSAOUD <mbmessaoud@gmail.com>
To: Alex K <rightkicktech@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: [DNAT] Port forwarding with Port range
Date: Wed, 27 Nov 2024 14:02:17 +0100	[thread overview]
Message-ID: <CA+ue7OATT6NUtJaB318ZqyzCwD9NeS7D5E4DM53DRNXyuNsnkQ@mail.gmail.com> (raw)
In-Reply-To: <CABMULtJAEe+jv6O5qpzqiP1q9o4gDmkCti2D-Ldp10MEh1O2nA@mail.gmail.com>

I tried and it does not work
iptables -t nat -A PREROUTING -p tcp --dport 1000:2000 -j DNAT
--to-destination 192.168.1.100:3000   ==> Ok all traffic received with
destination port in  1000:2000  is redirected to 192.168.1.100:3000

but iptables -t nat -A PREROUTING -p tcp --dport 1000:2000 -j DNAT
--to-destination 192.168.1.100:3000-4000  ==> does not work : no
traffic is redirected

it seem a known issue : https://bugzilla.netfilter.org/show_bug.cgi?id=1501
issue with DNAT port range

Le mar. 26 nov. 2024 à 18:36, Alex K <rightkicktech@gmail.com> a écrit :
>
> Yes, that should be possible.
>
> On Tue, 26 Nov 2024 at 4:46 PM, Mokhtar BEN MESSAOUD <mbmessaoud@gmail.com> wrote:
>>
>> is it possible to use iptables to define a rule to make a port
>> forwarding of a range of ports
>> For example :
>> iptables -t nat -A PREROUTING -p tcp --dport 1000:2000 -j DNAT
>> --to-destination 192.168.1.100:3000-4000
>>
>> so traffic for port 1000 will be redirected to port 3000
>> and traffic for port 1000+n ==> 3000+N
>>

      parent reply	other threads:[~2024-11-27 13:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 14:46 [DNAT] Port forwarding with Port range Mokhtar BEN MESSAOUD
     [not found] ` <CABMULtJAEe+jv6O5qpzqiP1q9o4gDmkCti2D-Ldp10MEh1O2nA@mail.gmail.com>
2024-11-27 13:02   ` Mokhtar BEN MESSAOUD [this message]

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=CA+ue7OATT6NUtJaB318ZqyzCwD9NeS7D5E4DM53DRNXyuNsnkQ@mail.gmail.com \
    --to=mbmessaoud@gmail.com \
    --cc=netfilter@vger.kernel.org \
    --cc=rightkicktech@gmail.com \
    /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).