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.