sudo nft list rulesetDisplay the active nftables ruleset.
nftables, iptables, ufw, firewalld, conntrack, and packet flow debugging commands.
Inspect and manage packet filtering and NAT.
sudo nft list rulesetDisplay the active nftables ruleset.
sudo nft add table inet filterCreate an inet filter table.
sudo nft 'add chain inet filter input { type filter hook input priority 0; policy drop; }'Create an input chain with a default policy.
sudo nft add rule inet filter input tcp dport 22 ct state new,established acceptPermit inbound SSH traffic.
sudo iptables -L -n -vShow IPv4 filter rules with counters.
sudo iptables-saveDump current iptables rules in restore format.
sudo iptables -I INPUT -p tcp --dport 22 -j ACCEPTInsert a rule allowing inbound SSH.
sudo iptables -A INPUT -s 203.0.113.25 -j DROPBlock all inbound traffic from a source IP.
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEApply source NAT for outbound traffic.
sudo ufw status verboseInspect uncomplicated firewall status and rules.
sudo ufw allow 443/tcpAllow inbound TCP on a specific port.
sudo firewall-cmd --list-allShow active firewalld zones and services.
sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reloadPermanently allow the HTTPS service.
Inspect conntrack, counters, and common packet flow issues.
sudo conntrack -LInspect conntrack table entries.
sudo conntrack -D -p tcp --orig-src 10.0.0.10 --orig-dst 10.0.0.20Remove conntrack state for a given flow.
sudo iptables -ZZero rule counters before testing packet paths.
sudo nft monitor traceMonitor nftables trace events for debugging.
sysctl net.ipv4.ip_forwardInspect whether packet forwarding is enabled.
sudo sysctl -w net.ipv4.ip_forward=1Turn on IPv4 forwarding immediately.