Score:0

Use iptables and nftables together

ro flag

Is it possible to use nftables and iptables together? How can I give iptables rules higer priority than nftables. As I am using nftables for nat and iptables to drop traffic by matching hex & string.

These are the iptables rules which I wanted to use. If someone can translate them for nftable then also it will work as iptable-translate utility is also failing in this case.

sudo iptables -t mangle -A PREROUTING -s 45.62.140.0/24 -p udp -m udp --dport 11011 -m string --hex-string '|ffffffff54|' --algo bm --to 65535 -j DROP
sudo iptables -t mangle -A PREROUTING -s 45.62.140.0/24 -p udp -m udp --dport 11011 -m string --hex-string '|ffffffff41|' --algo bm --to 65535 -j DROP
sudo iptables -t mangle -A PREROUTING -s 45.62.140.0/24 -p udp -m udp --dport 11011 -m string --hex-string '|ffffffff55|' --algo bm --to 65535 -j DROP
sudo iptables -t mangle -A PREROUTING -s 45.62.140.0/24 -p udp -m udp --dport 11011 -m string --string 'TSource Engine Query' --algo kmp --to 65535 -j DROP

T.I.A

paladin avatar
id flag
Not quiete an answer, but this page should give you some help: https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables
Martin avatar
kz flag
Check here: https://serverfault.com/questions/998962/nftables-support-string-matching-support
Score:0
us flag

You can run both, iptables rules will be applied, then nftables one. In this order. If you want a packet to go to nftables, you juste have not to drop it in iptables.

If you expect to do DNAT in nftables, then filtering in iptables, you can't then, so you would need to use only iptables or only nftables.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.