netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry <onyx@z-up.ru>
To: netfilter@vger.kernel.org
Subject: NAT to multiple ranges
Date: Tue, 27 Jun 2023 23:21:24 +0300	[thread overview]
Message-ID: <5fc45938-1c10-a5fd-bf3d-0d358bbd02eb@z-up.ru> (raw)

Hello!

I have lan network like 10.10.0.0/16 and two sets of external addresses 
like 1.1.1.0/24 and 2.2.2.0/24. How to perform nat to use all my 
external addresses? Now i have rules like

add rule ip nat POSTROUTING oifname "vlan3" ip saddr 10.10.0.0/16 
counter snat to 1.1.1.0-1.1.1.255 persistent

add rule ip nat POSTROUTING oifname "vlan3" ip saddr 10.10.0.0/16 
counter snat to 2.2.2.1-2.2.2.255 persistent

But,as expected, only first rule works. I need something like this:

add rule ip nat POSTROUTING oifname "vlan3" ip saddr 10.10.0.0/16 
counter snat to 1.1.1.0-1.1.1.255,2.2.2.1-2.2.2.255 persistent

But it is not supported.

Also, i've tried to use names sets like this:

add set ip nat ext_addr {type ipv4_addr;  flags interval; 
elements={1.1.1.0-1.1.1.255,2.2.2.1-2.2.2.255} ;}

But

nft 'add rule ip nat POSTROUTING oifname "vlan3" ip saddr 10.178.0.0/16 
counter snat to @ext_addr persistent'
Error: unknown raw payload base
add rule ip nat POSTROUTING oifname "vlan3" ip saddr 10.178.0.0/16 
counter snat to @ext_addr persistent


With all respect!


             reply	other threads:[~2023-06-27 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 20:21 Dmitry [this message]
2023-06-27 20:34 ` NAT to multiple ranges seentr

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=5fc45938-1c10-a5fd-bf3d-0d358bbd02eb@z-up.ru \
    --to=onyx@z-up.ru \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).