Use UFW to configure firewalls under Ubuntu (simplifies iptables operations)

Source: Internet
Author: User

UFW is all called uncomplicated Firewall, and is a tool for configuring iptables Firewalls on Ubuntu systems. UFW provides a very friendly command for creating firewall rules based on IPV4,IPV6 . However,UFW is no interface, that is, with the command of that kind, so, the operation is not so convenient, someone helped it to write an interface, the name is called "gufw".

Because the iptables under Ubuntu are more complex to operate and have more dependencies, many operations can be simplified when using UFW . Of course, Debian also applies.

The command line usage of UFW is the same for both desktop and server editions.

First, install the UFW

First, use the following command to check if UFWis already installed on the system.

$ sudo dpkg--get-selections | grep UFW

If it is not installed, you can use the apt command to install it, as shown below:

$ sudo apt-get install UFW

Before you use it, you should check to see if the UFW is already running. Use the following command to check:

$ sudo ufw status

If you find the status is:inactive , meaning is not activated or does not work.

Ii. Methods of Use

1. Enable

#作用: 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. Open/Disable the appropriate port or service example

sudoufw allow #192.168.1.1# # # # # #10.0.0.0/8 to 192.168.0.1 Port #要拒绝 All TCP traffic is from 10.0.0.0/8 to 192.168.0. 1 Address 22 port #可以允许所有RFC1918网络 (LAN/WLAN) access to this host (/8,/16,/10.0.0.0/8 172.16.0.0/12   192.168.0.0/16

4. Reset All Rules

sudo ufw reset

Reference article:

Http://blog.ihipop.info/2010/11/1855.html

Https://linux.cn/article-2489-1.html

Http://wiki.ubuntu.org.cn/index.php?title=Ufw%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97&variant=zh-hans

Http://wiki.ubuntu.org.cn/UFW%E9%98%B2%E7%81%AB%E5%A2%99%E7%AE%80%E5%8D%95%E8%AE%BE%E7%BD%AE

Use UFW to configure firewalls under Ubuntu (simplifies iptables operations)

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.