# iptables

> The older Linux firewall tool. It still works, on top of nftables.

**Field:** Infrastructure  
**Category:** Linux & the Command Line  
**Also known as:** iptables Command, ip6tables, iptables Rules

## Think of it like

Think of it like the old way to write the guard's list. People still use it, but a newer book sits behind it.

## Definition

iptables is the older Linux tool for writing firewall rules. Each rule says what to do with a kind of packet, like accept or drop. Guides from many years still use it, so you will see it often. On current Debian and Ubuntu, the iptables command still works. Behind the scenes, it writes its rules into nftables.

## Example

Jack follows an old guide that uses iptables. The command works on his new server, and the rule lands in nftables.

## Example code

```bash
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
```

One rule: accept traffic coming in on port 443.

## Why it matters

Most firewall guides online are written for it. Knowing it lets you read them.

## Common mistake

Adding iptables rules and expecting them to last. They are lost at reboot unless you save them.

## Three principles

- **The older tool.** Still in many guides.
- **One rule per line.** Match a packet, then act.
- **Not saved by default.** Rules vanish at reboot.

## Related terms

- [nftables](https://learn.benibix.com/term/infrastructure/nftables)
- [Uncomplicated Firewall (UFW)](https://learn.benibix.com/term/infrastructure/ufw)
- [Firewall](https://learn.benibix.com/term/infrastructure/firewall)
- [Network Port](https://learn.benibix.com/term/infrastructure/port)

## Told apart from

- [iptables vs nftables](https://learn.benibix.com/compare/iptables-vs-nftables): People often think iptables is the firewall on a new Linux server. Today it is a front door to nftables. The iptables command still works on Debian and Ubuntu. But it writes its rules into nftables. Mixing rules from both by hand can make them clash.

## Taught in

- [UFW and Linux Firewalls](https://learn.benibix.com/learn/infrastructure-linux/ufw-and-linux-firewalls): Linux CLI, 10/10

![Four stacked layers. At the top, UFW takes a short rule, allow 22. Beside it, the older iptables command takes a long rule. Both feed down into nftables, which holds the rules. At the bottom, the Linux kernel checks every packet against them.](https://learn.benibix.com/diagrams/inf3-linux-firewall.svg)

---

Source: https://learn.benibix.com/term/infrastructure/iptables
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
