Skip to content

What Is a Firewall? Definition and Examples

Quick answer

A firewall allows or blocks network traffic by rules. See NIST's definitions, a worked rule table with two packets traced, and how network and personal firewalls differ.

What Is a Firewall? Definition and Examples

A firewall is a security control that decides which network traffic is allowed through and which is blocked, based on rules set by the owner. It can be a device, a program or part of a system, and it sits between networks or on a single computer, acting like a gate guard with a list.

Key takeaways

  • A firewall filters traffic by rules: allow what is needed, block the rest.
  • NIST gives several wordings, so the definition depends on context.
  • A network firewall guards a boundary; a personal firewall runs on one computer.
  • A firewall is not an antivirus. It controls connections, not malicious files.

On this page:

TermWhere it sitsWhat it checks
Network firewallBetween networks, such as office and internetTraffic crossing the boundary
Personal firewallOn one desktop or laptopThat computer's incoming and outgoing traffic
AntivirusOn a deviceFiles and programs for malware
VPNBetween a device and a networkEncrypts a tunnel; does not filter by rule

What is a firewall?

NIST does not give one single definition. Its glossary entry for firewall lists several, each tied to a source document. One, citing SP 800-12 Rev. 1, calls it a gateway that limits access between networks in accordance with local security policy. Another, citing SP 800-152, calls it a part of a computer system or network designed to block unauthorized access while permitting outward communication. A third, citing SP 800-41 Rev. 1, describes a device or program that controls the flow of network traffic between networks or hosts.

The common thread is control by policy. As an analogy, think of a gate guard at an office park who checks each visitor against a list.

How does a firewall work?

It compares each connection against an ordered list of rules and applies the first match, with a final rule to drop everything else. Illustrative rules for a small office server (made-up addresses).

#RuleAction
1HTTPS (port 443) from anywhereAllow
2SSH (port 22) from 203.0.113.0/24 onlyAllow
3Everything elseDrop

Now trace two packets. A visitor from any address connects to port 443: rule 1 matches, so it is allowed. An address outside the office range tries port 22: rule 2 does not match and rule 3 drops it.

The same logic in Python, which runs as shown:

import ipaddress

OFFICE = ipaddress.ip_network("203.0.113.0/24")

def decide(src_ip, port):
    if port == 443:
        return "allow"
    if port == 22 and ipaddress.ip_address(src_ip) in OFFICE:
        return "allow"
    return "drop"

print(decide("198.51.100.7", 443))  # allow
print(decide("198.51.100.7", 22))   # drop

Where are firewalls used?

They appear at the edge of an office or data centre, in cloud networks and on individual laptops. NIST's personal firewall entry, citing SP 800-41 Rev. 1, describes a software-based firewall installed on a desktop or laptop computer to monitor and control its incoming and outgoing network traffic. Most operating systems include one.

In an Indian IT firm, that can mean a network firewall at the office boundary, plus the laptop firewalls staff carry home. For a student, it means checking that the laptop's own firewall is on.

General practice checklist (not a cited rule).

  • Check that the operating system firewall is on.
  • Block inbound ports you do not use.
  • Log denied traffic.
  • Review the rules every quarter.

What are the common mistakes and confusions?

  • Treating it as total protection. A firewall will not stop a user from entering a password on a fake site.
  • Confusing it with antivirus. One filters connections, the other looks for malicious files.
  • Allow-all rules. A rule that opens everything cancels the point of having one.
  • Never reviewing rules. Old exceptions pile up and leave doors open.

Firewalls fit inside the wider cybersecurity picture. Pair this with zero trust security, which checks each request instead of trusting a network, and encryption, which protects data inside the connection.

Next step

Open your computer's firewall settings and read the current rules. Then look at beginner cybersecurity tools to practise safely. For the bigger path, see the cybersecurity roadmap and cybersecurity skills in demand in India.

Frequently asked questions

What is a firewall in simple words?

A firewall is a gate guard for network traffic. It checks connections against rules, lets the allowed ones through and blocks the rest. It can be a device, a program or part of a system.

What is the difference between a firewall and an antivirus?

A firewall controls which network connections are allowed. An antivirus scans files and programs for malicious code. They do different jobs, and a device usually needs both.

What is a personal firewall?

NIST describes it as a software-based firewall installed on a desktop or laptop computer to monitor and control that computer's incoming and outgoing network traffic.

Is a firewall hardware or software?

Either. NIST's definitions mention a gateway, a device or program, and a part of a computer system or network. Network firewalls are often devices; personal firewalls are software.

Where is a firewall placed in a network?

A network firewall sits between networks, such as between an office and the internet. A personal firewall runs on the individual computer. Where exactly depends on your policy and design.

Share LinkedIn X WhatsApp
×

Our Courses

Practice-Based Learning Tracks, Supercharged By A.I.