Skip to content
Commitpedia
Log in Join & edit

What is a firewall?

A firewall is a filter that decides which network connections are allowed in or out of a computer or network.

Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?

Edit history of What is a firewall?: 1 recorded edit
Edit history · 1 edit
Type
Article
Edits
1
Editors
1
First issued
15 Oct 2026
Last edit
15 Oct 2026
Reading
1 min

A firewall inspects network traffic and allows or blocks it according to rules. Think of a bouncer at a club door with a guest list: people on the list walk in, everyone else is turned away. Rules are usually written in terms of ports, IP addresses and direction, for example allow port 22 from the office network only.

Every laptop, server and router has one. On Linux you meet ufw, firewalld or raw nftables; cloud providers call theirs security groups. The safest habit is to block everything incoming by default and open only the ports you really serve. When a new service is unreachable from outside but works locally, the firewall is the most likely cause.

Check before you run this

  • Runs with administrator rights. Make sure you understand every line.
sudo ufw default deny incoming
sudo ufw allow 22/tcp
sudo ufw enable

See also: What is a port? and What is an IP address?

Did this work for you?

No votes yet. Be the first.

If it did not work, the report form below tells the editors what went wrong.

See also

  • 0343 Fix: Connection refused and Connection timed out, what each one means Refused means the host answered and nothing is listening there. Timed out means no answer at all, usually a firewall or wrong… Beginner · Fixes an error · Linux, macOS Article DNS, IP addresses & ports · Firewalls 15 Oct 2026
  • 0344 ufw and firewalld: open and close ports Allow and remove ports and services on the two standard Linux host firewalls, restrict a port to one source network, and make… Beginner · Step by step · Linux Article Firewalls · Networking & firewalls 15 Oct 2026
  • 0347 Port check script: test a list of host:port pairs with timeouts A bash script that tries a TCP connection to each host:port you give it, waits a few seconds at most, and reports… Beginner · Cheat sheet · Linux, macOS Script DNS, IP addresses & ports · Firewalls 15 Oct 2026

Repos in the wild

History

Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.

  1. Dominik +793 chars

Report a problem

Something wrong, unsafe or copied? Tell the editors.
What is wrong?