All of lore.kernel.org
 help / color / mirror / Atom feed
* traffic shaping with tc and nft
@ 2022-05-28 10:07 Lars Noodén
  2022-05-28 10:20 ` Kamil Jońca
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Noodén @ 2022-05-28 10:07 UTC (permalink / raw)
  To: Linux Netfilter Users List

Hello,

I'm working on traffic shaping with tc and have some old iptables rules
with which I've tried to use iptables-translate to convert legacy
instructions to nftables.  For example, I have the following:

     iptables -t mangle -A OUTPUT -p tcp --match multiport \
	--sports 22,1965 -j MARK --set-mark 100

and the result is,

     nft add rule ip mangle OUTPUT ip protocol tcp \
	tcp sport {22,1965} counter meta mark set 0x64

However, nftables does not like that as-is and responds with an error:

     "Error: Could not process rule: No such file or directory"

I've obviously missed or misinterpreted something there.  What would be
the correct nft instruction(s) including any prerequisites?  Or what
traffic shaping guides are there for nftables with concrete examples?
I've pored over the wiki and it is great for the aspects which have
already become familiar but it is far too abstract for me for new areas.

$ uname -sr
Linux 5.10.63-v7l+

$ apt-cache policy nftables | head -n 2
nftables:
   Installed: 0.9.8-3.1

Thanks.
Lars

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: traffic shaping with tc and nft
  2022-05-28 10:07 traffic shaping with tc and nft Lars Noodén
@ 2022-05-28 10:20 ` Kamil Jońca
  2022-05-28 11:21   ` Lars Noodén
  0 siblings, 1 reply; 3+ messages in thread
From: Kamil Jońca @ 2022-05-28 10:20 UTC (permalink / raw)
  To: netfilter

Lars Noodén <lars.nooden@gmx.com> writes:

> Hello,
>
> I'm working on traffic shaping with tc and have some old iptables rules
> with which I've tried to use iptables-translate to convert legacy
> instructions to nftables.  For example, I have the following:
>
>     iptables -t mangle -A OUTPUT -p tcp --match multiport \
> 	--sports 22,1965 -j MARK --set-mark 100
>
> and the result is,
>
>     nft add rule ip mangle OUTPUT ip protocol tcp \
> 	tcp sport {22,1965} counter meta mark set 0x64

Blind shot: in nftables you have no OUTPUT chain by default so I suspect
you have to create it manually.

nft add chain ip mangle  OUTPUT ...

KJ


-- 
http://wolnelektury.pl/wesprzyj/teraz/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: traffic shaping with tc and nft
  2022-05-28 10:20 ` Kamil Jońca
@ 2022-05-28 11:21   ` Lars Noodén
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Noodén @ 2022-05-28 11:21 UTC (permalink / raw)
  To: netfilter

On 5/28/22 13:20, Kamil Jońca wrote:
> Lars Noodén <lars.nooden@gmx.com> writes:
>
>> Hello,
>>
>> I'm working on traffic shaping with tc and have some old iptables rules
>> with which I've tried to use iptables-translate to convert legacy
>> instructions to nftables.  For example, I have the following:
>>
>>      iptables -t mangle -A OUTPUT -p tcp --match multiport \
>> 	--sports 22,1965 -j MARK --set-mark 100
>>
>> and the result is,
>>
>>      nft add rule ip mangle OUTPUT ip protocol tcp \
>> 	tcp sport {22,1965} counter meta mark set 0x64
>
> Blind shot: in nftables you have no OUTPUT chain by default so I suspect
> you have to create it manually.
>
> nft add chain ip mangle  OUTPUT ...
>
> KJ

Thanks.  I think that was it.  I had to create both the table and the
chain first.

/Lars

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-28 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-28 10:07 traffic shaping with tc and nft Lars Noodén
2022-05-28 10:20 ` Kamil Jońca
2022-05-28 11:21   ` Lars Noodén

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.