Linux Firewall Management Tools Overview

Topics · Published 2019-08-23 · Revised 2026-11-23
Reviewed corrections applied locally; pre-review version preserved separately · Joomla source

4,592 Total views across this article’s versions; includes the historical baseline where available.

Linux provides several tools for different parts of packet handling. route belongs to the older net-tools package; ip route and ip rule belong to iproute2. They configure kernel routing state rather than carrying packets themselves. For policy routing and multiple tables, use ip route and ip rule. The older route display can still be useful when reading a historical example.

A route describes how to reach a destination. Policy rules determine which routing table to consult, or return an action such as prohibit. Netfilter is the kernel framework used for packet filtering, connection tracking, and NAT. iptables and nft configure firewall rules within that framework. These tools complement one another; choosing a route does not by itself grant permission to forward traffic.

Here is a quick reference to their roles:

CommandRole
ip routeInspect and change kernel routes, including named or numbered tables.
routeInspect and change routes through the older net-tools interface; it does not provide the policy-table controls of iproute2.
ip ruleInspect and change the ordered routing policy rules (RPDB).
iptablesManage IPv4 filtering, NAT, marking, and related rules; ip6tables handles IPv6.
nftManage nftables rules, including IPv4, IPv6, and combined inet rulesets.
ufwProvide a higher-level firewall configuration interface on systems using UFW.

The following paths describe ordinary IPv4 delivery and forwarding. Hook names identify points in kernel processing; a hook is not a table containing other tables.

TrafficSimplified IPv4 path
Arriving for this hostNetwork → PREROUTING → routing decision → INPUT → local process
Forwarded through this hostNetwork → PREROUTING → routing decision → FORWARD → POSTROUTING → network
Created by this hostLocal process → initial route/source selection → OUTPUT → POSTROUTING → network

The incoming routing decision chooses local delivery or forwarding. Changes made during OUTPUT, such as destination translation or a routing mark, can require another route lookup. Loopback traffic can traverse both output and input paths. Tunnels and bridges introduce additional processing, so this overview is not a complete trace of every packet.

See iptables Process Flow for table ordering and Follow the (ip) Rules for policy-rule selection.

References: ip-route(8), ip-rule(8), iptables manual, nftables manual, and Ubuntu firewall documentation.