A network doorman#

A firewall works like the doorman of a building. It checks every packet of data entering or leaving against rules such as source address, port, and type of connection, and decides whether to let it through or reject it. The principle is simple: whatever doesn't need to be open should stay closed.

Types#

  • Personal firewall: built into Windows, macOS, and Linux, and controls which programs can connect to the internet.
  • Network or router firewall: controls the traffic of a whole home or office.
  • Server firewall: closes the unnecessary ports on a server.
  • Web application firewall (WAF): filters a portion of common attacks against websites.

An example of use#

On a dedicated server, you might only need the web ports (80 and 443) and management access from specific addresses. The firewall closes all other ports, so even if a service is accidentally left running, it can't be reached from outside. WordPress sites sometimes also use a plugin-based firewall or a proxy service.

Limitations#

A firewall can't stop your own mistakes. If you run malware yourself or enter your password on a fake site, the firewall won't notice. It is therefore one layer of defense, not the whole of it.

Simple advice#

Don't turn off your operating system's built-in firewall, close unnecessary server ports, and change settings carefully; one wrong rule can lock you out of your own server.