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