BCE-C712 Linux System Administration

0 of 74 lessons complete (0%)


Lab 5: Firewall configuration with ufw

You don’t have access to this lesson

Please register or sign in to access the course content.

Lab 4: Firewall Configuration using ufw


  • To understand and practice firewall configuration on a Linux system.

Topics Covered:

  1. Introduction to Firewalls
  2. Installing and Enabling ufw (Uncomplicated Firewall)
  3. Basic ufw Commands
  4. Configuring Firewall Rules
  5. Advanced Firewall Configuration

Lab Exercises:

Exercise 1: Introduction to Firewalls

  1. Understand purpose of a firewall in a Linux system.
  2. Understand the concept of incoming and outgoing traffic.
  3. Learn the basic principles of stateful and stateless firewalls.

Exercise 2: Installing and Enabling ufw

# Install `ufw` if not already installed
sudo apt-get install ufw

# Enable `ufw`
sudo ufw enable

Exercise 3: Basic ufw Commands

# Check the status of `ufw`
sudo ufw status

# Disable `ufw`
sudo ufw disable

# Reset `ufw` rules
sudo ufw reset

Exercise 4: Configuring Firewall Rules

# Allow incoming SSH connections
sudo ufw allow 22/tcp

# Allow incoming connections on a custom service/port (e.g., web server)
sudo ufw allow 80/tcp

# Deny incoming connections on a specific port
sudo ufw deny 1234/tcp

Exercise 5: Advanced Firewall Configuration

# Check the list of applications with `ufw` profiles
sudo ufw app list

# Allow traffic for a specific application profile (e.g., OpenSSH)
sudo ufw allow OpenSSH

# Limit the rate of incoming connections from an IP address
sudo ufw limit from <IP_address> to any port 22

# Create a custom rule for a specific IP range
sudo ufw allow from

# Delete a rule by number
sudo ufw delete <rule_number>

Lab Documentation:

Provide detailed instructions for each exercise, including command syntax and expected outcomes. Include explanations of the purpose behind each task.