Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How to Setup and Configure Firewall with UFW on Ubuntu 18.04

by Cloudbooklet
4 years ago
in Google Cloud
How To Setup And Configure Firewall With Ufw On Ubuntu 18.04
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

How to Setup and Configure Firewall with UFW on Ubuntu 18.04. This demo is tested on Google Cloud and it will also work on any Ubuntu and Debian servers. UFW or Uncomplicated Firewall, is a front-end to iptables which provides an easy-to-use interface and a great way to secure your server. Install UFW UFW is […]

ADVERTISEMENT

How to Setup and Configure Firewall with UFW on Ubuntu 18.04. This demo is tested on Google Cloud and it will also work on any Ubuntu and Debian servers.

UFW or Uncomplicated Firewall, is a front-end to iptables which provides an easy-to-use interface and a great way to secure your server.

Install UFW

UFW is installed by default in Ubuntu, for some reason if it is not installed you can install by typing the following command.

ADVERTISEMENT
sudo apt install ufw

You can check the status (active or inactive) of UFW using this command.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago
sudo ufw status

Right now you will see it in inactive state.

Setup Firewall Rules

Now you can add the rules and then enable it. If you enable the Firewall now, you will get blocked from your terminal because you haven’t allowed connections on port 22 which is SSH.

ADVERTISEMENT

Go ahead and add the rule to allow connections for SSH.

sudo ufw allow ssh

This command is basically a shorthand for this command.

ADVERTISEMENT
sudo ufw allow 22/tcp

If you are using SSH on custom port you can enable the port with this.

sudo ufw allow 2222/tcp

Allow UFW for Port Ranges

You can also specify port ranges with UFW. To allow ports 3000 through 6000, use the command.

ADVERTISEMENT
sudo ufw allow 3000:6000/tcp

For UDP you can use this.

sudo ufw allow 3000:6000/udp

Allow IP Addresses

You can also specify IP address to allow connections. For example, if you want to allow connections form a specific IP address you can use this sample below

ADVERTISEMENT
sudo ufw allow from 38.58.345.143

Denying connections

On the other hand you can also deny connections from ports or IP address or ranges.

sudo ufw deny 8080/tcp

Delete Firewall Rules

A simple and effective way to delete a rule is using the rule number. Take note of the rule number you need to delete using this command.

sudo ufw status numbered

Now you will get the number of your rule and then you can delete it.

sudo ufw delete [number]

Enable/Disable/Reset Firewall

Once you have added all rules you need you can enable firewall. Make sure you have allowed connections for SSH.

sudo ufw enable 

If you want to disable UFW firewall you can use this command.

sudo ufw disable

To reset firewall to it’s default settings, you can do this with this command.

sudo ufw reset
Tags: Cloud SecurityUbuntu 18.04
ShareTweetSendShare
Cloudbooklet

Cloudbooklet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Best Laptop For Minecraft-

5 Best Laptop for Minecraft in 2023: Top Picks for All Budgets

September 21, 2023

WhatsApp Business Gets New Features to Help your Businesses Grow

Microsoft Unveils New Disc-Less Xbox Series X with Lift-to-Wake Controller

Google Bard Extensions: How to Link Your Gmail, Docs, Maps, and More to an AI Chatbot

AI Statistics and Trends: What You Need to Know in 2023

10 Best AI Song Generator in 2023 (Free and Paid)

Popular Articles

Ai Comic Generator

Best 10 AI Comic Generator: Create Comic book in Seconds

September 18, 2023

5 FREE AI Horoscope Online – Personalized Way to See Your Future

10 Best Free AI Porn Generators in 2023

10 Best WordPress Hosting Providers for 2023(Free and Paid)

OpenAI Introduces ChatGPT Enterprise for Businesses

Top 10 Ways to Use ChatGPT for Marketing in 2023

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.