To configure and test basic firewall rules to allow or block network traffic and understand how firewall rules control network access.
- UFW (Uncomplicated Firewall) – Firewall management tool on Linux
- Ubuntu 22.04 – Operating system
- Terminal – Used to execute firewall commands
The goal of this task was to configure and test firewall rules on a Linux system using UFW.
The practical focused on:
- Checking the firewall status
- Enabling UFW
- Listing existing firewall rules
- Blocking inbound traffic on a specific port
- Testing the firewall rule
- Allowing SSH traffic
- Removing the test block rule
- Documenting the firewall commands and results
The UFW firewall status was checked using:
sudo ufw statusUFW was initially disabled, so it was enabled using:
sudo ufw enableThe current firewall configuration was checked using:
sudo ufw statusThe output initially showed no specific rules for ports 23 or 22.
Port 23, commonly associated with Telnet, was blocked using:
sudo ufw deny 23/tcpThe rule was verified using:
sudo ufw statusExample output:
To Action From
-- ------ ----
23/tcp DENY Anywhere
23/tcp (v6) DENY Anywhere (v6)
A Telnet connection to port 23 was attempted from another machine:
telnet <linux-machine-ip> 23The connection was refused, confirming that the configured firewall rule blocked the traffic.
SSH traffic was allowed using:
sudo ufw allow 22/tcpThe firewall configuration was then verified using:
sudo ufw statusExample output:
To Action From
-- ------ ----
23/tcp DENY Anywhere
22/tcp ALLOW Anywhere
23/tcp (v6) DENY Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
After completing the test, the temporary Telnet block rule was removed using:
sudo ufw delete deny 23/tcpThe firewall status was checked again:
sudo ufw statusThe final configuration retained the SSH rule.
sudo ufw enable
sudo ufw status
sudo ufw deny 23/tcp
sudo ufw allow 22/tcp
sudo ufw delete deny 23/tcpA firewall filters network traffic by evaluating incoming and outgoing connections against predefined rules.
In this practical:
- The
deny 23/tcprule blocked inbound TCP traffic on port 23. - The
allow 22/tcprule permitted inbound TCP traffic on port 22. - UFW provided a simplified interface for managing Linux firewall rules.
- Firewall configuration
- Network traffic filtering
- Inbound traffic control
- Port-based firewall rules
- UFW
- Linux security
- Telnet and SSH ports
- Firewall rule testing
- Security configuration
This practical demonstrated how to configure and test firewall rules on a Linux system using UFW.
The exercise provided hands-on experience with blocking and allowing specific network traffic, testing firewall behavior, and restoring the firewall configuration after testing.
This practical is intended for educational and cybersecurity learning purposes.
Firewall configuration and security testing should only be performed on systems and networks where you have appropriate authorization.
Jahnavi Pokala
- GitHub: jahnavi9905
- LinkedIn: Jahnavi Pokala