Skip to main content

What is a firewall?

A firewall is a network security tool that controls and filters network traffic, deciding what can pass through and what must be blocked.

In simple terms: a firewall is a "guard" between networks (for example, between the internet and the internal network).


Why a firewall is needed

A firewall is needed to:

  • protect the network from unauthorized access;
  • block attacks and malicious traffic;
  • restrict access to services and ports;
  • separate networks (internal, external, DMZ).

Without a firewall:

  • anyone can try to connect to the services;
  • the risk of breaches and attacks increases.

How a firewall works

A firewall analyzes every network packet and compares it to a set of rules:

  • allow, and the packet passes through;
  • deny, and the packet is blocked.

What can be checked:

  • the source and destination IP address;
  • the protocol (TCP, UDP, ICMP);
  • the port number;
  • the connection state.

The rules are applied automatically and continuously.


Main types of firewall

1. Packet filtering firewall

  • analyzes individual packets;
  • works fast;
  • does not track connection state.

Simple, but limited.


2. Stateful firewall

  • tracks connection state;
  • understands which traffic is a reply;
  • safer and smarter.

The most common type.


3. Application firewall

  • analyzes traffic at the application level;
  • understands HTTP, FTP, SMTP and others;
  • protects against attacks on applications.

Often used for web services.


Where a firewall can be located

  • on a router;
  • on a dedicated server;
  • built into the operating system;
  • in the cloud infrastructure.

A firewall can be network-based or host-based.


What a firewall does NOT do

It is important to understand its limitations:

  • it does not encrypt data;
  • it does not protect against all types of attacks;
  • it does not replace antivirus software and IDS/IPS.

A firewall is a basic building block, not the only defense.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.