Cyberattacks make the security of personal and organisational computers an everyday concern. Visiting a website, downloading a file or leaving a service exposed can create opportunities for malicious activity. A firewall is one of the principal controls used to manage that exposure: it filters network traffic according to a policy.
Calling it an invisible shield can be a useful image, provided the limitation is understood. A firewall does not recognise and prevent every dangerous action. Its capabilities depend on the product, rules, placement and information it can inspect.
Some systems go beyond simple connection rules to analyse applications, detect suspicious patterns or integrate intrusion-prevention and machine-learning features. Those are capabilities of particular implementations, not a definition that guarantees every firewall includes them.
Computers continually send and receive data. Attackers can try to exploit those communication paths to reach services, steal information or establish malicious connections. A firewall provides a controlled boundary within that activity, allowing or blocking traffic using the evidence and policy available to it.
What is a firewall?
A firewall is a security control that manages incoming and outgoing network traffic using defined rules. It may run as software on a device, as a dedicated appliance or as a virtual or cloud-based service. It forms one layer of protection rather than replacing the rest of a security system.
Its possible tasks include:
- Restricting unauthorised access to network services.
- Controlling which network traffic is permitted.
- Examining suspicious packets or connections within its inspection capabilities.
- Blocking specified IP addresses, ports or protocols.
- Detecting or interrupting connections associated with malicious activity when supported rules or detection features identify them.
These controls can reduce exposure to targeted and opportunistic attacks. Their effectiveness depends on appropriate configuration and maintenance.
How does it work?
A firewall applies rules to traffic that passes through its point of control. It may examine individual packet headers, track the state of connections or inspect application-level information. Processing is often fast enough to go unnoticed, although workload and inspection features can affect latency and throughput.
A simplified sequence is:
- Traffic reaches the firewall on the relevant network path or device interface.
- The firewall examines available information about its source, destination, protocol and, where supported, content or application.
- That information is compared with the configured policy and connection state.
- Traffic that violates the policy is blocked, rejected or otherwise handled according to the rules.
- Permitted traffic continues towards its destination.
“Permitted” is not a certificate that every byte is harmless. Encrypted payloads may not be visible to the firewall, and a connection that matches an allowed rule can still carry a threat.
Types of firewall
Different terms describe inspection methods, deployment arrangements or packages of features. They are related categories rather than mutually exclusive boxes.
Packet filtering
Basic packet filters make decisions using information such as source and destination IP addresses, port numbers and protocols. They do not necessarily understand the wider application conversation.
Stateful inspection
A stateful firewall tracks connection information and evaluates packets in that context. This helps distinguish expected return traffic from a new incoming request, subject to the protocols and policy involved.
Application-layer filtering
An application-aware firewall examines traffic at a level associated with particular services or applications. A web application firewall is a specialised example focused on HTTP-based applications. Inspection depth and handling of encryption vary between implementations.
Next-generation firewalls
Products sold as NGFWs may combine application identification, intrusion prevention, content inspection and other security functions. Antivirus-related features, behavioural analysis and deep packet inspection may be included, but the label alone does not guarantee a particular feature set or result.
Hardware-based deployment
Dedicated appliances are common at organisational network boundaries. Their suitability depends on throughput, resilience, inspection needs and management requirements; a physical box is not automatically more secure than every software arrangement.
Software-based deployment
Host firewalls operate on systems such as Windows, macOS and Linux. They can be useful for home computers and organisational endpoints alike. Whether they are sufficient depends on the wider environment and the risks being addressed.
Different controls can be combined to create layers of protection. The useful question is which traffic each layer sees and which policy it enforces.
Which threats can a firewall help address?
A firewall can block some unwanted traffic before it reaches an exposed service, and can sometimes restrict malicious communications from an already compromised device. Examples include:
- Unauthorised external connection attempts.
- Exposure of services to port scanning, or detected scanning patterns when supported.
- Connections to known botnet infrastructure.
- Some traffic associated with ransomware activity.
- Malware command-and-control connections identified by policy or detection features.
- Certain denial-of-service patterns within the system’s capacity to handle them.
- Connections involving Trojan software or unauthorised remote-access services.
These are possible interventions, not promises to prevent every instance of each attack. A volumetric DDoS attack may overwhelm an upstream connection before a local firewall can help. A permitted encrypted session may conceal traffic that an endpoint security control needs to address.
How are firewall rules defined?
Policies may be supplied by an operating system, configured by an administrator or adjusted through supported automated controls. Common elements include:
- Which services and ports may accept connections.
- Whether specified IP addresses or address ranges are allowed or blocked.
- Permissions for particular applications.
- Rules for different protocols and network directions.
- Responses to suspicious activity where detection features are available.
Many operating systems provide a graphical interface for common settings. Ease of access does not remove the need to understand the effect of an exception: an overly broad permission can undermine a carefully chosen default policy.
Protection at the computer boundary
A host firewall helps manage communication between the computer and other networks. Depending on its configuration, it can:
- Block specified or detected suspicious IP addresses.
- Reject unsolicited incoming connection requests.
- Restrict background applications from communicating without permission.
- Control the network services exposed through ports.
- Interrupt some attempts by malicious software to contact external infrastructure.
These functions connect external protection with control over activity originating inside the device. They do not prove that an allowed application is trustworthy, nor can they replace investigating a suspected compromise.
Practices for home users
Disabling a firewall indiscriminately to install a game or application removes a useful control. If a legitimate program needs access, a narrowly defined exception is generally more appropriate than switching off the entire protection layer.
Useful practices include:
- Keeping the operating system’s firewall enabled and maintained.
- Checking an unfamiliar application before granting network permissions.
- Reviewing the home router’s firewall settings where available.
- Turning off network sharing that is not needed.
- Reviewing Microsoft Defender Firewall settings on Windows, particularly when changing networks or adding exceptions.
The firewall in a home router and the firewall on a computer protect different boundaries. A combined modem/router may provide both functions, but not every modem is itself a full-featured firewall.
Limitations
A firewall cannot prevent every harmful file from being opened locally, every social-engineering attempt or every user mistake. Its ability to inspect an email attachment depends on the product and traffic path; a basic network firewall is not an attachment scanner.
Limitations include:
- Malicious files can arrive through permitted or uninspected channels.
- Phishing cannot be eliminated by firewall rules alone.
- A user can authorise a connection or disclose information despite network controls.
- Outdated or inappropriate rules may miss relevant activity or expose unnecessary services.
Firewalls work best alongside supported software updates, endpoint protection where appropriate, secure configuration and careful account use. No combination makes a computer invulnerable.
A firewall remains an important boundary control in a complicated network environment. Understanding packet filtering, connection state and application-level inspection helps explain both its value and its limits. The practical aim is to know which traffic is controlled, why it is permitted and what additional protection the situation requires.
References
- Apple. (n.d.). Block connections to your Mac with a firewall.
- Microsoft. (n.d.). Windows Firewall.
- Netfilter Project. (n.d.). Netfilter: Firewalling, NAT and packet mangling for Linux.
- Scarfone, K., & Hoffman, P.. (2009). Guidelines on firewalls and firewall policy (NIST SP 800-41 Rev. 1). National Institute of Standards and Technology.
🗓️ Publication date: November 10, 2026
🔄 Last updated: November 10, 2026
🎯 Who this is for: Users who want to understand device and router firewalls rather than relying only on antivirus; home users, small-office administrators and readers learning packet filtering, stateful inspection and NGFW terminology.

IW is a collective byline representing the Invictus Wiki editorial team. Articles published under the IW byline are prepared through research drawing on multiple sources and editorial review, guided by the principle of impartiality.
