Score:0

How do routing rules from IPTables, IPVS, and NFTables get ordered from a precedent perspective, in the Linux kernel?

co flag

The Linux kernel has the ability to route traffic using nftables, iptables, and ipvs. Ive collected 3 related questions here, in order to generally ask the broader overall question of how precedence is determined with regard to kernel routing and firewalling rules:

  • In general, is there an order of precedence for when these load balancing / packet filtering constructs are ordered ?
  • NFT and iptables, if not managed properly from an installation perspective, can result in “collisions” (unpredictable results). The solution to this seems to be making sure iptables-legacy is installed. Is it possible to run both NFT and iptables together, and if so, what order would the given iptables “tables” (Mangle, Filter, NAT), be applied with respect to NFT tables rules ?
  • IPVS is capable of implementing load balancing. In general, is it meant to occur before, or after iptables rules are applied to an incoming packet ?
  • How does firewalld play into all of this?
  • How does precedence work with regard to SELinux and these various rules?

For context, I recently noticed that some iptables rules on a system where NFT was installed weren’t working as expected, and , even though here are great diagrams online of how default iptables chains are ordered with regard to their resident tables, I became curious about how one would reason about these chains and their traversal if other rules from NFT, IPVS, eBPF, and so on were present.

A.B avatar
cl flag
A.B
Too many questions in the question. For bullet #2, I made answers on UL SE on this topic: https://unix.stackexchange.com/questions/607358/packet-processing-order-in-nftables/607391#607391 , https://unix.stackexchange.com/questions/419851/when-and-how-to-use-chain-priorities-in-nftables/442659#442659 .
Score:0
in flag

They are CLI's to manage the same rules stored in the kernel. Any precedence is the one specified or the order of entry.

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.