USD ($)
$
United States Dollar
India Rupee

Understanding Firewall in Networking, Its Working and Types

Created by Gautam Kumar in Articles 13 Dec 2024
Share
«Cybersecurity Consultant Complete Job ...

In the universe of computer networks, the concept of security is truly important. With cyber threats growing more and more advanced, guarding spaces has never been more noteworthy. A computer network firewall is a highly important network security tool that ensures unauthorized access is blocked while authorized traffic flows throughout the organization.

In this article, we will understand what is a firewall and how does it work. We have explained firewall meaning in simple words and covered the types of firewalls, benefits, and limitations of firewalls.

What is a Firewall in Networking?

A firewall in computer networks is a security device—either hardware, software, or a combination of both—that monitors and filters incoming and outgoing traffic based on pre-established security rules.

Its primary function is to serve as a barrier between a trusted internal network and untrusted external networks, such as the Internet. 

Firewalls operate on three basic actions: 

Accept: Permit the traffic to pass. 

Reject: Block the traffic but notify the sender with an "unreachable error." 

Drop: Block the traffic silently without any response. 

What is Firewall Used For?

Firewall devices are used to monitor and control incoming and outgoing network traffic based on predefined security rules.

Firewalls can filter traffic, create audit trails, and enforce policies to enhance overall network security. They are critical for both personal and enterprise environments, ensuring that only legitimate traffic is allowed while blocking potentially harmful data packets.


Start Your Career with CCNA CertificationEnroll in live training class to prepare for CCNA Certification Exam.Explore course
custom banner static image

How Does a Firewall Work?

A firewall works by monitoring and controlling incoming and outgoing network traffic based on predefined security rules.

It acts as a gatekeeper, allowing trusted traffic while blocking potentially harmful data packets. Firewalls analyze packet information, such as source and destination addresses, to determine whether to permit or deny access.

They create a barrier between trusted internal networks and untrusted external networks, preventing unauthorized access and cyber threats. Firewalls can operate at various levels, including packet filtering, stateful inspection, and application-layer filtering, ensuring comprehensive protection for the network.

Role of NAT and VPN in Firewalls 

Firewalls often support Network Address Translation (NAT) and Virtual Private Network (VPN) functions: 

● NAT: Masks internal IP addresses by translating them into public IPs. This not only conserves IPv4 addresses but also protects devices from external reconnaissance. 

● VPN: Creates secure, encrypted tunnels over public networks, ensuring safe transmission of data between remote users and private networks. 

Firewall Functions in Networking

Firewalls perform several vital functions: 

1. Traffic Monitoring and Control: Firewalls examine incoming and outgoing network traffic to ensure it complies with predefined security policies. 

2. Blocking Unauthorized Access: Firewalls prevent unauthorized users from accessing private networks or systems. 

3. Protecting Against Cyber Threats: Firewalls block malicious traffic, including Malware, Viruses, Ransomware, Spyware 

4. Enforcing Security Policies: Organizations can define and enforce specific security rules through firewalls, such as blocking websites and Limiting traffic based on geographic locations. 

5. Network Segmentation: Firewalls help divide a network into smaller, secure zones. 

6. Preventing Data Leaks: Firewalls monitor outbound traffic to ensure sensitive information is not transmitted outside the network without authorization. 

Types of Firewalls

There are multiple types of firewalls for organizational and personal uses. Some common types of firewalls include:

1. Packet Filtering Firewall: This firewall filters traffic based on packet headers such as IP addresses, protocols, and ports. While efficient, it treats packets in isolation and cannot track the context of ongoing sessions. 

2. Stateful Inspection Firewall: Tracks the state of active connections and filters traffic based on both predefined rules and session context. This makes it more effective than packet filtering. 

3. Software Firewall: Installed on individual devices or servers, software firewalls are flexible and ideal for personal use. However, they can be resource-intensive. 

4. Hardware Firewall: A physical device that inspects traffic before it reaches the internal network. Suitable for large-scale networks, hardware firewalls are robust but can be costly. 

5. Application Layer Firewall: Operates at the application layer of the OSI model, inspecting traffic for specific applications or protocols (e.g., HTTP, FTP). Often used as a proxy firewall, it prevents direct connections, enhancing security. 

6. Next-Generation Firewall (NGFW): Combines traditional firewall features with advanced capabilities like deep packet inspection, SSL decryption, and application awareness. 

7. Proxy Service Firewall: Acts as an intermediary between users and the internet, ensuring that sensitive data never directly interacts with external networks. 

8. Circuit-Level Gateway Firewall: Operates at the session layer, validating TCP connections without inspecting the data packets. While lightweight, it is less secure against modern cyber threats. 

Host-Based Firewall

Host-based firewalls are installed on end users' computer systems which take action to either allow or deny the traffic. In this case, the firewall services run on the local computer, it consumes resources and impacts the other applications of that system only.

In host-based firewall architecture, traffic passes through all the network components, which means consuming the network resources before reaching the end user's computer. Here in the below picture is an example of a host-based firewall on Microsoft Windows 10.

Image description

Network-Based Firewall

A network-based firewall is completely transparent to the end user. Such types of firewalls are deployed in the network perimeter or at the internet edge to prevent unwanted traffic from entering the network. 

The end users are completely unaware of the network firewall that is controlling the traffic. In this case, no software is installed in the end user's computer system.

Network firewalls can be further categorized into 3 types- Stateless firewalls, Stateful Firewalls, and Next-Generation Firewalls(NGFW).

Stateless Firewall

The previous generation of firewalls in computer networks was able to allow or block traffic based on these 5 elements of a packet called a tuple.

● Source IP Address

● Destination IP Address

● Source Port

● Destination Port

● Protocol

When these firewalls examine the packets they are not aware of whether the packet is a part of the existing connection or not. That means these firewalls are not able to identify if the packet is manipulated or a rogue packet. That's why these types of firewalls are called Stateless firewalls.

The stateless firewall utilizes the 5-tuple of the OSI layer model as given below.

 Image description

Stateless Firewall Example: When an access control list (ACL) is configured in which there is a requirement of allowing only HTTP and DNS traffic while blocking all other inbound traffic on the network edge Cisco router.

Image description

In this case, it does not check any state of the incoming packet but only checks the protocol number HTTP is 80 and UDP is 53 which are TCP and UDP-based protocols respectively.

Note: Here Router represents the "Internet Edge Cisco Router" shown in the above diagram and no IP address is used in the ACI for allowing or denying traffic.


Router(config)# access-list 100 permit tcp any any eq 80

Router(config)# access-list 100 permit udp any any eq 53

Router(config)# access-list 100 deny ip any any

Router(config)# interface GigabitEthernet0/0

Router(config-if)# ip access-group 100 in

Similarly, a stateless firewall in a computer network can be implemented on Linux as iptables, let's take an example in which we need to block inbound traffic to SSH (port 22) except from a specific IP address 192.168.1.10


# Allow inbound SSH traffic from a trusted IP

sudo iptables -A INPUT -p tcp --dport 22 -s 192.168.1.10 -j ACCEPT

# Block all other inbound SSH traffic

sudo iptables -A INPUT -p tcp --dport 22 -j DROP

# Save the iptables rules

sudo iptables-save > /etc/iptables/rules.v4

Stateful Firewall

Stateful firewalls are developed to overcome the limitations of stateless firewalls. It keeps the state of the connection in the memory that allows the firewall to track the connection stage of the TCP handshake, based on which firewall can take action to reject or allow the packets.

In TCP, each connection has a lifetime. Each TCP connection goes through a series of states which are used by the firewall to filter traffic. Here is the TCP connection state diagram.

 Image description

Traditional firewalls in computer networks, whether stateless or stateful, often fall short of protecting against modern cyber threats targeting today's applications. To effectively safeguard your network, you need more than basic traffic filtering at layers 2–4.

A robust solution must offer advanced capabilities like application visibility and control, deep packet inspection across layers 3–7, intrusion prevention, encrypted traffic decryption, protocol anomaly detection, and contextual data-driven security event correlation.

Most of the firewall vendors offer stateful firewalls, let's take some of the most prominent firewalls and look at how to configure stateful firewalls on them.

1. Stateful Firewall with IPTABLES in Linux -  Allow established and related connections while blocking new incoming connections except on port 80 (HTTP).


# Allow all traffic on the loopback interface

sudo iptables -A INPUT -i lo -j ACCEPT

# Allow established and related connections

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# Allow new incoming HTTP connections

sudo iptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT

# Drop all other incoming traffic

sudo iptables -A INPUT -j DROP

# Save the iptables rules

sudo iptables-save > /etc/iptables/rules.v4

2. Stateful Firewall Configuration on Cisco ASA - Permit outbound HTTP/HTTPS traffic and allow return traffic (stateful inspection).


ASA(config)# access-list OUTBOUND extended permit tcp any any eq 80

ASA(config)# access-list OUTBOUND extended permit tcp any any eq 443

ASA(config)# access-group OUTBOUND in interface inside

# Enable stateful inspection for TCP and UDP

ASA(config)# policy-map global_policy

ASA(config-pmap)# class inspection_default

ASA(config-pmap-c)# inspect tcp

ASA(config-pmap-c)# inspect udp

ASA(config-pmap-c)# exit

ASA(config)# service-policy global_policy global

3. Stateful Firewall on Palo Alto Firewall - Palo Alto firewalls are stateful by default; no additional setup is required for connection tracking. Allow web traffic (HTTP/HTTPS) while inspecting stateful sessions.


Log in to the Palo Alto web interface.

Navigate to Policies > Security and create a new rule:

Source Zone: Trust

Destination Zone: Untrust

Applications: web-browsing, ssl

Action: Allow

Save and commit the changes.

Verification:

Monitor the traffic logs under Monitor > Traffic.

Verify session states under Monitor > Sessions.

4. Stateful Firewall on FortiGate - Allow inbound SSH and HTTP connections with stateful tracking.


Log in to the FortiGate web interface.

Navigate to Policy & Objects > IPv4 Policy.

Create a new policy:

Incoming Interface: WAN

Outgoing Interface: LAN

Source: All

Destination: All

Service: SSH, HTTP

Action: Allow

Save and apply.

Verification:

View sessions in the Dashboard > Sessions.

Test connections using tools like ssh or curl.

Next-Generation Firewall (NGFW)

The next-generation firewall (NGFW) addresses these challenges by consolidating all these critical security features into a single, efficient platform, ensuring comprehensive protection against evolving cyber threats.

Traditional firewalls in computer networks including stateful, often fall short in protecting against modern cyber threats targeting today's applications. To effectively safeguard your network, you need more than basic traffic filtering at layers 2–4.

Next-Generation Firewall offers a robust solution with advanced capabilities like application visibility and control, deep packet inspection across layers 3–7, intrusion prevention, encrypted traffic decryption, protocol anomaly detection, and contextual data-driven security event correlation.

The next-generation firewall (NGFW) addresses these challenges by consolidating all these critical security features into a single, efficient platform, ensuring comprehensive protection against evolving cyber threats.

Here is the diagram depicting some of the security services as next-generation firewall (NGFW) 

Image description


Choosing Your Firewall Deployment: Use Cases 

Selecting the right firewall deployment strategy depends on the specific needs of your organization, network infrastructure, and security goals. Here are common use cases to help you decide the best approach to firewall deployment: 

1. Protecting an Internal Network 

Use Case: Small and medium businesses (SMBs), enterprise networks, or data centers need protection from external threats. 

Recommended Firewall: Hardware Firewall and Next-Generation Firewall (NGFW). 

Deployment: Place the firewall between the internal network and the internet to monitor incoming/outgoing traffic. 

2. Securing Remote Workforce 

Use Case: Employees accessing corporate networks remotely using unsecured networks (e.g., home Wi-Fi or public hotspots). 

Recommended Firewall: Software Firewall and VPN-Compatible Firewall.

Deployment: Deploy software firewalls on end-user devices and integrate VPNs into the network to secure remote connections. 

3. Isolating Critical Systems 

Use Case: Organizations with sensitive data, such as financial institutions, healthcare providers, or government entities. 

Recommended Firewall: Application Layer Firewall and Stateful Inspection Firewall. 

Deployment: Use internal firewalls to segment critical systems (e.g., payment processing servers) from the rest of the network. 

4. Enhancing Cloud Security 

Use Case: Businesses operating in hybrid or fully cloud-based environments need to secure data stored or processed in the cloud. 

Recommended Firewall: Cloud-Native Firewall and Virtual Firewall. 

Deployment: Place firewalls at the edge of the cloud network or integrate directly with cloud-based workloads. 

5. Defending Against Advanced Persistent Threats (APTs) 

Use Case: Organizations at risk of sophisticated attacks targeting intellectual property or sensitive data. 

Recommended Firewall: Next-Generation Firewall (NGFW) and Intrusion Prevention System (IPS). 

Deployment: Deploy NGFWs at the network perimeter and between internal segments for multi-layered protection. 

6. Enforcing Web Access Policies 

Use Case: Schools, enterprises, or public institutions need to regulate internet access and block harmful or inappropriate content. 

Recommended Firewall: Proxy Firewall and Application Layer Firewall. 

Deployment: Configure firewalls to filter outbound traffic based on URL categories, keywords, or time-of-day restrictions. 

Firewall Evolution Over the Years

Firewalls have evolved significantly from basic packet filters in the 1980s to complex, multi-functional systems today. Initially, firewalls only allowed or blocked traffic based on predefined rules. The introduction of stateful inspection in the 1990s allowed firewalls to track active connections and improve security. 

In the mid-2000s, Next-Generation Firewalls (NGFWs) emerged, combining stateful inspection with advanced features like deep packet inspection, application-level filtering, and integrated intrusion prevention systems. These advancements enabled firewalls to protect against more sophisticated threats like malware and APTs. 

Today, firewalls are crucial for securing networks, providing protection against cyberattacks, enabling Zero Trust Architecture, and securing cloud environments. The future of firewalls will involve AI-driven threat detection, automation, and integration with broader security platforms like XDR. 

Firewalls remain essential to modern cybersecurity, adapting to new threats and securing both on-premises and cloud infrastructures. 

Who invented the Firewall?

Firewalls evolved through contributions from various innovators: 

● Jeff Mogul, Paul Vixie, and Brian Reid: Pioneered packet-filtering technology at Digital Equipment Corporation. 

● Marcus Ranum: Developed application-layer firewalls at DEC in the early 1990s. 

● Gil Shwed and Nir Zuk: Created the first user-friendly, commercial firewall product at Check Point Software Technologies. 

Latest Trends in Firewall Technology 

Firewalls continue to evolve in response to the growing complexity of cyber threats and advancements in network infrastructure. Below are some of the key trends shaping the future of firewalls: 

1. Rise of Next-Generation Firewalls (NGFWs) 

NGFWs go beyond traditional packet filtering and stateful inspection by integrating advanced features like: 

1. Deep packet inspection (DPI). 

2. Application awareness and control. 

3. Intrusion detection and prevention systems (IDPS). 

4. SSL/TLS encrypted traffic analysis. 

These firewalls are essential for detecting sophisticated attacks such as zero-day threats and Advanced Persistent Threats (APTs). 

2. Cloud-Delivered Firewalls (Firewall-as-a-Service, FWaaS) 

With the rise of cloud computing, FWaaS solutions are becoming popular, offering: 

1. Scalability for dynamic cloud environments. 

2. Centralized management of firewall policies across hybrid or multi-cloud infrastructures. 

3. Enhanced support for remote workforces through seamless integrations with Secure Access Service Edge (SASE) architectures. 

3. Integration with AI and Machine Learning 

AI-powered firewalls are increasingly capable of: 

1. Automating threat detection and response. 

2. Identifying patterns of anomalous behavior in real-time. 

3. Adapting to new attack vectors through continuous learning. 

4. Zero Trust Network Access (ZTNA) Integration 

Firewalls are becoming a cornerstone of Zero Trust security models by: 

1. Verifying user and device identities before granting access. 

2. Enforcing granular access controls. 

3. Segmenting networks to limit lateral movement of attackers. 

5. Container-Aware Firewalls 

As organizations adopt containerized environments like Kubernetes, firewalls are evolving to: 

1. Secure inter-container communication. 

2. Protect containerized applications against vulnerabilities and misconfigurations. 

6. Emphasis on IoT Security 

The proliferation of Internet of Things (IoT) devices introduces new vulnerabilities. Firewalls are now: 

1. Incorporating IoT-specific security protocols. 

2. Monitoring and securing device-to-device communication. 

Why Are Firewalls Important? 

Firewalls serve as a network’s first line of defense against cyber threats. Without them, networks are vulnerable to unauthorized access, malware, and other malicious activities. By enforcing strict traffic control, firewalls help: 

● Protect sensitive data. 

● Mitigate the risk of identity theft and online fraud. 

● Restrict unauthorized access to critical systems. 

Disadvantages of Firewalls 

● Configuring and maintaining firewalls can be challenging. 

● Hardware firewalls and advanced features may be expensive. 

● Cannot detect threats at the application or endpoint levels. 

● Heavy traffic filtering can slow down network performance. 

● Overreliance on firewalls may neglect other critical security measures. 

Firewall vs Antivirus- What's the Difference?


FeatureFirewallAntivirus Software
Primary FocusControls network traffic and prevents unauthorized access.Detects, quarantines, and removes malicious programs.
ScopeOperates at the network level (though can be endpoint-based).Functions as an endpoint solution on individual devices.
FunctionalityMonitors and filters incoming/outgoing data traffic.Scans local files and applications for malware and other threats.
PurposeBlocks harmful traffic before it enters the network.Neutralizes threats already present on a device.
Type of ProtectionProactive protection by regulating data flow.Reactive and proactive by identifying and removing threats.
DeploymentNetwork-based hardware or software solutions.Software installed on individual devices.
Best Use CaseSecuring network perimeters and preventing intrusion.Protecting individual devices from infections like malware and ransomware.
Examples of ThreatsUnauthorized access, DDoS attacks, and intrusion attempts.Viruses, worms, ransomware, spyware, and Trojans.
Complementary RoleWorks alongside antivirus for comprehensive security.Works alongside firewalls for layered protection.

Leading Firewall Vendors

1. Cisco: 

● Offers a range of firewalls, including NGFWs, through its Cisco ASA and Firepower series.

● Known for high security, integration with Cisco network environments, and scalability.

2. Palo Alto Networks:

● Provides advanced NGFWs with application, user, and content identification capabilities.

● Strong focus on threat prevention and integration with other Palo Alto products, like their Cortex XDR.

3. Fortinet:

● Known for its FortiGate series, which integrates firewall, VPN, antivirus, and intrusion prevention.

● Offers a range of appliances for small to enterprise-level organizations.

4. Juniper Networks:

● Provides firewalls through its SRX series, focused on performance and advanced threat intelligence.

● Often used in enterprise data centers and cloud environments.

5. Check Point:

● Known for robust NGFW features, Check Point firewalls are widely used in corporate networks.

● Offers unified threat management, secure application control, and centralized management.

6. Sophos:

● Provides firewall solutions integrated with endpoint protection.

● Known for user-friendliness, strong threat detection, and its XG Firewall series tailored for small to medium-sized businesses.



Best Firewall Certification Courses & ...»
Gautam Kumar

Gautam Kumar is a senior network engineer having more than 7 years of experience in different companies in India. His work experience in network support and operation and maintaining of any network makes him one of the most valuable IT professional in industry. He has been involving in planning, supporting the physical and wireless networks, ...

More... | Author`s Bog | Book a Meeting

Related Articles

#Explore latest news and articles

Most Wanted Networking Certifications in IT 10 Dec 2024

Most Wanted Networking Certifications in IT

Dive into the best networking certifications, including top choices like Cisco. Discover the most valuable certifications for network engineers today.
How Does TCP Work: TCP IP Protocol Suite 8 Nov 2024

How Does TCP Work: TCP IP Protocol Suite

In-depth details of how does TCP work including a packet level understanding on how TCP three-way handshake works.
Mac Address Flooding: Learning & Aging 12 Nov 2024

Mac Address Flooding: Learning & Aging

Learn MAC address flooding and aging process in switches. Understand how switching concepts impact network security & performance. Read More!
Palo Alto Firewall Features: An Overview 29 Jul 2024

Palo Alto Firewall Features: An Overview

Introduction to Palo Alto Firewall Features and explore the key aspects and capabilities of Palo Alto Firewall.

FAQ

A firewall in a computer is a security device or software that monitors and controls incoming and outgoing network traffic based on predetermined security rules, protecting the system from unauthorized access and cyber threats.
The three main types of firewalls are: 1) Packet filtering firewalls, which inspect data packets; 2) Stateful inspection firewalls, which track active connections; and 3) Application layer firewalls (proxy firewalls), which filter traffic at the application level.
A firewall controls network traffic to prevent unauthorized access, while antivirus software detects, quarantines, and removes malicious programs. Together, they provide layered security for systems against various cyber threats.
The best firewall depends on specific needs. Next-generation firewalls (NGFW) are often recommended for their advanced features like deep packet inspection, intrusion prevention, and application awareness, providing robust protection for modern networks.
An example of a firewall is the Cisco ASA (Adaptive Security Appliance), which combines traditional firewall capabilities with advanced features like VPN support and intrusion prevention to secure enterprise networks.
To install a firewall, choose between hardware or software options, follow manufacturer instructions for setup, configure security rules according to your needs, and ensure it integrates properly with your existing network infrastructure.

Comments (1)

Dcancerian Student
9 Apr 2023 | 01:33 am

Nice Article! This should help new aspirants of CCNA certification.

Share

Share this post with others

Contact learning advisor

Captcha image
Fortinet NSE 1-3 Live Training
Fortinet NSE 1-3 Live Training
Starts 25th Jan | Expert-Led | Lab Access | Certification Ready!
Day
Hr
Min
Sec
Register Now