Iptables Firewall Lab Manual
Iptables Firewall Lab Manual
Objective:
1. Learn to configure iptables on a Linux system.
2. Create rules to filter incoming, outgoing, and forwarded traffic.
3. Test the firewall’s effectiveness against various types of network attacks.
Prerequisites
1. Basic knowledge of Linux commands.
2. Familiarity with networking concepts such as IP addresses, ports, and protocols.
3. A Linux-based system with iptables installed (commonly found on most distributions).
Equipment Required
1. Linux-based system (Ubuntu/Debian/CentOS recommended).
2. Internet access.
3. Another system or virtual machine for generating network traffic and simulating
attacks.
Lab Setup
1. Verify iptables Installation:
• Open the terminal on your Linux system and run the following command to check if
iptables is installed:
`sudo iptables --version`
If not installed, use the following command:
`sudo apt-get install iptables -y` (For Ubuntu/Debian)
`sudo yum install iptables -y` (For CentOS/RHEL)
Set default policies to drop all incoming and forwarding traffic but allow outgoing traffic:
`sudo iptables -P INPUT DROP`
`sudo iptables -P FORWARD DROP`
`sudo iptables -P OUTPUT ACCEPT`
Permit traffic for established and related connections to maintain connections without
interruptions:
`sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j
ACCEPT`
From a different machine or browser, access the Linux system's web server. Verify HTTP
and HTTPS traffic.
Ping the Linux system from another machine to verify ICMP echo requests are blocked.
Use tools like `nmap` from another system to scan open ports on the Linux machine:
`nmap -sS <IP_Address>`
Reboot the system and verify access restrictions according to the previous tests.
Tasks
Lab Report
Document each command executed, the observations for each test, and any additional
rules you think could enhance security.