I'm trying to create nftables tables with the commands I'll put below, I just wanted to know how I can keep them in openwrt, because when I restart the router they disappear, I'm a layman on the subject, but it's just for study purposes, and I still don't I found a solution, thank you all in advance.
#Add top priority rules with packet marking
nft add rule inet gaming input_high_priority udp dport 3074 meta mark set 0x1 accept
nft add rule inet gaming input_high_priority tcp dport 3074 meta mark set 0x1 accept
nft add rule inet gaming output_high_priority udp sport 3074 meta mark set 0x2 accept
nft add rule inet gaming output_high_priority tcp sport 3074 meta mark set 0x2 accept
Those rules are slightly off. They do not prioritize traffic.
You can insert fragments inside table inet fw4 by placing fragments in /etc/nftables.d/aleatorio.nft files
I already made the correction, but I wanted to know when I type these commands in ssh they are added to the fw, but if I restart the router these rules are practically deleted.
But they do nothing, just slow down your gaming traffic due to per-packet inspection and meta setup....
Ill get back to you later from PC, not very easy to type correct nftable segments with mobile.
I've been trying to configure my router for games for some time now, but I always fail, I used sqm, but I never got a good result, I know there are variables to manipulate openwrt which is a very powerful tool. But here in Brazil, few people have this knowledge.
Yes, I'm going to start using it, it's just that sometimes I forget that there is this type of translation, and I use the first translator in the search lol.
table inet gaming {
chain input_high_priority {
type filter hook input priority filter + 1; policy accept;
udp dport 3074 meta mark set 0x00000001 accept
tcp dport 3074 meta mark set 0x00000001 accept
}
chain output_high_priority {
type filter hook output priority filter + 1; policy accept;
udp sport 3074 meta mark set 0x00000002 accept
tcp sport 3074 meta mark set 0x00000002 accept
}
chain input {
type filter hook input priority filter; policy accept;
}
chain output {
type filter hook output priority filter; policy accept;
}
chain forward {
type filter hook forward priority filter; policy accept;
}
}
Let us remove default chains:
table inet gaming {
chain input_high_priority {
type filter hook input priority filter + 1; policy accept;
udp dport 3074 meta mark set 0x00000001 accept
tcp dport 3074 meta mark set 0x00000001 accept
}
chain output_high_priority {
type filter hook output priority filter + 1; policy accept;
udp sport 3074 meta mark set 0x00000002 accept
tcp sport 3074 meta mark set 0x00000002 accept
}
}
Now lets reduce to a fragment to insert into inet fw4 table:
chain input_high_priority {
type filter hook input priority filter + 1; policy accept;
udp dport 3074 meta mark set 0x00000001 accept
tcp dport 3074 meta mark set 0x00000001 accept
}
chain output_high_priority {
type filter hook output priority filter + 1; policy accept;
udp sport 3074 meta mark set 0x00000002 accept
tcp sport 3074 meta mark set 0x00000002 accept
}
Now save last fragment as /etc/nftables.d/juego.nft and packets will be marked. fw4 check - verify that rules are correct service firewall restart - activate rules
You can observe marking activity with conntrack -E
I think you need to set "priority" not "mark" but if you show origin of your rules we may be able to transport good idea to nftables.