From: seentr@at.encryp.ch
To: netfilter@vger.kernel.org
Cc: Dmitry <onyx@z-up.ru>
Subject: Re: NAT to multiple ranges
Date: Tue, 27 Jun 2023 20:34:39 +0000 (UTC) [thread overview]
Message-ID: <a4ca1b1d-d1f1-42b7-aceb-72cc7e629f64@at.encryp.ch> (raw)
In-Reply-To: <5fc45938-1c10-a5fd-bf3d-0d358bbd02eb@z-up.ru>
You may try to use Load balancing features to use both of your rules: https://wiki.nftables.org/wiki-nftables/index.php/Load_balancing
2023-06-27T20:31:32Z Dmitry <onyx@z-up.ru>:
> 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!
prev parent reply other threads:[~2023-06-27 20:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 20:21 NAT to multiple ranges Dmitry
2023-06-27 20:34 ` seentr [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=a4ca1b1d-d1f1-42b7-aceb-72cc7e629f64@at.encryp.ch \
--to=seentr@at.encryp.ch \
--cc=netfilter@vger.kernel.org \
--cc=onyx@z-up.ru \
/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).