Teach you how to turn on/off Ubuntu firewall

Source: Internet
Author: User

teach you how to turn on/off Ubuntu firewall

Installation Method
sudo apt-get install UFW

Of course, this is a graphical interface (relatively humble), in the new GUFW to search for a try ...

How to use

1 Enable

sudo UFW enable
sudo ufw default deny

Function: Turns on the firewall and shuts down all external access to the local computer (normal external access) with the system boot.


2 Close

sudo ufw disable

2 View firewall status

sudo UFW status

3 opening/Disabling the appropriate port or service example

sudo UFW allow 80 allows external access to 80 ports
sudo ufw delete allow 80 disallow external access to port 80
sudo ufw allow from 192.168.1.1 allows this IP access to all native ports
sudo UFW deny SMTP prevents external access to the SMTP service
sudo ufw delete allow SMTP to delete a rule established above
sudo ufw deny Proto TCP from 10.0.0.0/8 to 192.168.0.1 Port 22 is going to deny all TCP traffic from 10.0.0.0/8 to 192.168.0.1 Address of 22 port
You can allow all RFC1918 networks (LAN/WLAN) to access this host (/8,/16,/12 is a network rating): sudo ufw allow from 10.0.0.0/8sudo UFW enable from 172.16.0.0/ 12sudo UFW allow from 192.168.0.0/16
Recommended Settings
sudo apt-get install UFW
sudo UFW enable
sudo ufw default deny

This setting is already secure and if you have special needs, you can use sudo ufw allow to turn on the service.


Teach you how to turn on/off Ubuntu firewall

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.