QA
Intermediate LevelLinux Commands & SysAdmin

How do UFW and iptables configure Linux packet filtering firewall rules?

❓ Interview Prompt: Explain Linux firewalling, Netfilter architecture, iptables chains (INPUT, OUTPUT, FORWARD), tables (filter, nat), and UFW CLI wrappers.

Linux kernel packet filtering is driven by Netfilter:

1. iptables:

Defines explicit rules across chains:

•
INPUT: Packets addressed to local server.
•
OUTPUT: Locally generated outgoing packets.
•
FORWARD: Packets routed through server.

2. UFW (Uncomplicated Firewall):

Simplified CLI wrapper for iptables (e.g. 'sudo ufw allow 22/tcp', 'sudo ufw enable').

Code Implementation Example

bash
# Allow SSH and HTTPS ports using UFW
sudo ufw allow 22/tcp
sudo ufw allow 443/tcp
sudo ufw enable

# Native iptables rule blocking IP address
sudo iptables -A INPUT -s 192.168.1.105 -j DROP
💡Configuring network packet filtering rules using UFW and iptables.
🎯 Interview Key Takeaway

Use UFW for straightforward host firewall configuration, and native iptables for complex NAT or packet routing rules.

#iptables#UFW#Firewall#Security#Intermediate
Back to all Linux Commands & SysAdmin Questions→

More Linux Commands & SysAdmin Interview Questions

Beginner LevelLinux Commands & SysAdmin

How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?

Beginner LevelLinux Commands & SysAdmin

What is the Linux Filesystem Hierarchy Standard (/bin, /etc, /var, /usr, /opt, /tmp)?

Beginner LevelLinux Commands & SysAdmin

What are File Descriptors (0=stdin, 1=stdout, 2=stderr) and Redirection (>, >>, 2>&1)?