Linux Netfilter development
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: "Serguei Bezverkhi (sbezverk)" <sbezverk@cisco.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>
Subject: Re: Operation not supported when adding jump command
Date: Tue, 26 Nov 2019 20:27:52 +0100	[thread overview]
Message-ID: <20191126192752.GE8016@orbyte.nwl.cc> (raw)
In-Reply-To: <0A92D5EA-B158-4C7A-B85C-1692AE7C828B@cisco.com>

Hi,

On Tue, Nov 26, 2019 at 06:47:09PM +0000, Serguei Bezverkhi (sbezverk) wrote:
> Ok, I guess I will work around by using input and output chain types, even though it will raise some brows in k8s networking community.
> 
> I have a second issue I am struggling to solve with nftables. Here is a service exposed for tcp port 80 which has 2 corresponding backends listening on a container port 8080.
> 
> !
> ! Backend 1
> !
> -A KUBE-SEP-FS3FUULGZPVD4VYB -s 57.112.0.247/32 -j KUBE-MARK-MASQ
> -A KUBE-SEP-FS3FUULGZPVD4VYB -p tcp -m tcp -j DNAT --to-destination 57.112.0.247:8080
> !
> ! Backend 2
> !
> -A KUBE-SEP-MMFZROQSLQ3DKOQA -s 57.112.0.248/32 -j KUBE-MARK-MASQ
> -A KUBE-SEP-MMFZROQSLQ3DKOQA -p tcp -m tcp -j DNAT --to-destination 57.112.0.248:8080
> !
> ! Service
> !
> -A KUBE-SERVICES -d 57.142.221.21/32 -p tcp -m comment --comment "default/app:http-web cluster IP" -m tcp --dport 80 -j KUBE-SVC-57XVOCFNTLTR3Q27
> !
> ! Load balancing between 2 backends
> !
> -A KUBE-SVC-57XVOCFNTLTR3Q27 -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-FS3FUULGZPVD4VYB
> -A KUBE-SVC-57XVOCFNTLTR3Q27 -j KUBE-SEP-MMFZROQSLQ3DKOQA
> 
> I am looking for nftables equivalent for the load balancing part and also in this case there are double dnat translation,  destination port from 80 to 8080 and destination IP:  57.112.0.247 or 57.112.0.248.
> Can it be expressed in a single nft dnat statement with vmaps or sets?

Regarding xt_statistic replacement, I once identified the equivalent of
'-m statistic --mode random --probability 0.5' would be 'numgen random
mod 0x2 < 0x1'.

Keeping both target address and port in a single map for *NAT statements
is not possible AFAIK.

If I'm not mistaken, you might be able to hook up a vmap together with
the numgen expression above like so:

| numgen random mod 0x2 vmap { \
|	0x0: jump KUBE-SEP-FS3FUULGZPVD4VYB, \
|	0x1: jump KUBE-SEP-MMFZROQSLQ3DKOQA }

Pure speculation, though. :)

Cheers, Phil

  reply	other threads:[~2019-11-26 19:27 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 18:55 Operation not supported when adding jump command Serguei Bezverkhi (sbezverk)
2019-11-26 12:21 ` Florian Westphal
2019-11-26 14:30   ` Serguei Bezverkhi (sbezverk)
2019-11-26 14:52     ` Florian Westphal
2019-11-26 15:38     ` Pablo Neira Ayuso
2019-11-26 15:47       ` Serguei Bezverkhi (sbezverk)
2019-11-26 15:51         ` Phil Sutter
2019-11-26 18:47           ` Serguei Bezverkhi (sbezverk)
2019-11-26 19:27             ` Phil Sutter [this message]
2019-11-26 21:20               ` Serguei Bezverkhi (sbezverk)
2019-11-26 22:15                 ` Phil Sutter
2019-11-27 10:11                 ` Arturo Borrero Gonzalez
2019-11-27 11:57                   ` Phil Sutter
2019-11-27 14:36                   ` Serguei Bezverkhi (sbezverk)
2019-11-27 15:08                     ` Phil Sutter
2019-11-27 15:35                       ` Serguei Bezverkhi (sbezverk)
2019-11-27 16:06                         ` Phil Sutter
2019-11-27 16:50                           ` Serguei Bezverkhi (sbezverk)
2019-11-27 17:22                             ` Phil Sutter
2019-11-28  1:22                               ` Serguei Bezverkhi (sbezverk)
2019-11-28  9:10                                 ` Laura Garcia
2019-11-28 11:58                                   ` Serguei Bezverkhi (sbezverk)
2019-11-28 13:08                                 ` Phil Sutter
2019-11-28 13:34                                   ` Serguei Bezverkhi (sbezverk)
2019-11-28 14:51                                   ` Serguei Bezverkhi (sbezverk)
2019-11-28 15:15                                     ` Phil Sutter
2019-11-29 20:13                                       ` Serguei Bezverkhi (sbezverk)
2019-11-30  0:04                                         ` Phil Sutter
2019-12-03 18:43                                           ` Serguei Bezverkhi (sbezverk)
2019-12-04 10:36                                             ` Phil Sutter
2019-12-03 23:50 ` Duncan Roe
2019-12-04  1:13   ` [PATCH nft] doc: Clarify conditions under which a reject verdict is permissible Duncan Roe
2019-12-06  2:37   ` [PATCH nft v2] " Duncan Roe
2019-12-06  6:55     ` Florian Westphal

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=20191126192752.GE8016@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=sbezverk@cisco.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