Step by step teach you how to open and close the ubuntu firewall

Foreword

Firewall (Firewall), also known as a protective wall. It is a [Network Security] (https://cloud.tencent.com/product/ns?from=10680) system located between the internal network and the external network. An information security protection system that allows or restricts the transmission of data in accordance with specific rules.

The importance of firewalls to our network security is self-evident, but in the actual development process we may

The firewall needs to be turned on and off, then how to manage the firewall in Ubuntu. Let's take a look together.

installation method

 sudo apt-get install ufw

Of course, this has a graphical interface (relatively rudimentary), try searching for gufw in Synaptic...

Instructions

1 Enable

 sudo ufw enable
 sudo ufw default deny 

Function: Turn on the firewall and close all external access to the machine at the same time as the system starts (the machine can access the outside normally).

2 shut down

 sudo ufw disable 

2 View firewall status

 sudo ufw status 

3 Examples of enabling/disabling corresponding ports or services

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 Allow this IP to access all local ports
sudo ufw deny smtp prohibit external access to smtp services
sudo ufw delete allow smtp delete a rule established above
sudo ufw deny proto tcp from 10.0.0.0/8 to 192.168.0.1 port 22 To deny all TCP traffic from 10.0.0.0/8 to 192.168.0.1 address 22 port

All RFC1918 networks (LAN/wireless LAN) can be allowed to access this host (/8,/16, /12 is a network classification):

sudo ufw allow from10.0.0.0/8
sudo ufw allow from172.16.0.0/12
sudo ufw allow from192.168.0.0/16

Recommended setting

 sudo apt-get install ufw
 sudo ufw enable
 sudo ufw default deny 

This setting is already very safe. If you have special needs, you can use sudo ufw allow to enable the corresponding service.

to sum up

The above is the entire content of this article. I hope that the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message and exchange. Thank you for your support to ZaLou.Cn.

Recommended Posts

Step by step teach you how to open and close the ubuntu firewall
How to open the ubuntu system in win10
Teach you how to install Ubuntu system enhancement tools
Teach you how to build a Git server on Ubuntu
How to open root account in Ubuntu20.04
How to install Ubuntu20.04 and install NVIDIA driver
How to modify the hostname on Ubuntu 20.04
How to install Pycharm and Ipython on Ubuntu 16.04/18.04
How to install and configure NATS on Ubuntu 16.04
How to install and configure Gogs on Ubuntu 18.04
How to modify time zone and time in ubuntu
How to install and configure Cyberpanel on Ubuntu 18.04
How to install and secure phpMyAdmin on Ubuntu 16.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure GitLab on Ubuntu 18.04
How to install and use Docker on Ubuntu 20.04
How to install and configure Ansible on Ubuntu 18.04
How to install and use Curl on Ubuntu 18.04
How to install and use Composer on Ubuntu 18.04
How to install and use Wine on Ubuntu 18.04
How to install and secure phpMyAdmin on Ubuntu 16.04
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install and use Composer on Ubuntu 20.04
How to install and use BaasBox on Ubuntu 14.04
How to install and configure VNC on Ubuntu 18.04
How to install and configure Sphinx on Ubuntu 16.04
How to install and configure OrientDB on Ubuntu 14.04
How to install and use PostgreSQL on Ubuntu 16.04
Teach you how to write games in python
Turn off and turn on the firewall in ubuntu
How to run the parsing server on Ubuntu 14.04
How to check the installed JDK on Ubuntu
How to install and configure AppScale on Ubuntu 12.04
How to install and use Docker on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install the latest MySQL on Ubuntu 18.04
[Video] Teach you how to install the latest Linux version of QQ under Centos 8
How to repackage Deb files under Debian and Ubuntu
How to backup and restore Redis data on Ubuntu 14.04
How to add the gzip module to Nginx on Ubuntu 14.04
How to turn the language of Ubuntu into Chinese? ?
How to install and use MySQL Workbench on Ubuntu 18.04
How to modify time zone and time in ubuntu system
How to install theano and keras on ubuntu system
How to open https on nginx server under Ubuntu
How to upgrade to Ubuntu 20.04
How to upgrade to Ubuntu 20.04
How to control the ubuntu system in win10 through ssh
How to set up Java Home on Ubuntu and Raspbian
How to set or modify the time zone on Ubuntu 20.04
Xshell and Xftp fail to connect to the virtual machine Ubuntu
How to set up a firewall with UFW on Ubuntu 14.04
How to install memcache and start it in ubuntu environment
How to set or modify the time zone on Ubuntu 20.04
How to compile and install PHP and Nginx in Ubuntu environment
How to install JDK and Mysql on Ubuntu 18.04 linux system
ubuntu 12.04 configure the kernel crash to automatically restart and dump
How to build and deploy the video streaming platform EasyNVR under Centos8 to penetrate the firewall to the designated port?
ubuntu7.10 installed to 3D open