All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc SCHAEFER <schaefer@alphanet.ch>
To: netfilter@vger.kernel.org
Subject: Generic map, also with L4 protocol
Date: Mon, 27 Jan 2025 21:37:29 +0100	[thread overview]
Message-ID: <Z5fuieMugg4fcNKR@alphanet.ch> (raw)

Hello,

for dynamic DNAT, I use:

   map multihoming_ext {
      type ipv4_addr . inet_service : ipv4_addr . inet_service
      elements = {
         46.140.72.218 . 8080  : 192.168.202.10 . 80,
         193.72.186.130 . 8080 : 192.168.202.10 . 80
      }
   }

   chain multihoming_prerouting {
      type nat hook prerouting priority -100; policy accept;

      dnat ip addr . port to ip daddr . tcp dport map @multihoming_ext
   }

This seems to DNAT correctly as wanted:

   46.140.72.218:8080 is DNATted to 192.168.202.10:80
and
   193.72.186.130:8080 is DATted to 192.168.202.10:80

To make it even more generic and dynamic, I would like to have also the
protocol in the map, something like:

   map multihoming_ext {
      type ipv4_addr . inet_proto . inet_service : ipv4_addr . inet_service
      elements = {
         46.140.72.218 . tcp . 8080  : 192.168.202.10 . 80,
         193.72.186.130 . tcp . 8080 : 192.168.202.10 . 80
      }
   }

However I have no idea how to modify the DNAT line itself to
get the L4 protocol from the map correctly.

Do you have any idea?

Thank you.

             reply	other threads:[~2025-01-27 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 20:37 Marc SCHAEFER [this message]
2025-02-28 14:42 ` [SOLVED] Generic map, also with L4 protocol Marc SCHAEFER

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=Z5fuieMugg4fcNKR@alphanet.ch \
    --to=schaefer@alphanet.ch \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.