Simple setting of UFW firewall in Ubuntu

Source: Internet
Author: User

UFW is a host-side iptables firewall configuration tool that is easy to use. Generally, the use of ufw for desktop applications can meet the requirements.

Ubuntu Installation Method

Sudo apt-get install ufw

Of course, there is a graphical interface (relatively simple). Search gufw in the new ground and try again ......

Usage

1. Enable

Sudo ufw enable

Sudo ufw default deny

Purpose: Enable the firewall and disable all external access to the local machine as the system starts (access from the local machine is normal ).

2 close

Sudo ufw disable

2. view the Firewall Status

Sudo ufw status

3. enable/disable the corresponding port or service example

Sudo ufw allow 80 allows external access to port 80

Sudo ufw delete allow 80 prohibit external access to port 80

Sudo ufw allow from 192.168.1.1 allows this IP address to access all local ports

Sudo ufw deny smtp prohibit external access to the smtp service

Sudo ufw delete allow smtp delete a rule created above

Ufw deny proto tcp from 10.0.0.0/8 to 192.168.0.1 port: deny all traffic from 10.0.0.0/8 of TCP to 192.168.0.1 of port 22.

Allow all RFC1918 networks (LAN/WLAN) to access this host (/8,/16,/12 is a network classification ):

Sudo ufw allow from 10.0.0.0/8

Sudo ufw allow from 172.16.0.0/12

Sudo 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 safe. If you have special requirements, you can use sudo ufw allow to enable the corresponding service.

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.