Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ufw firewall configuration under Ubuntu

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Ufw is a simple firewall configuration tool under Ubuntu, and the bottom layer still calls iptables to deal with it. Although the function is simple, it is more practical for desktop applications. It has all the basic common functions and is easy to use.

1. Installation

Sudo apt-get install ufw

two。 Enable

Sudo ufw enable

Sudo ufw default deny

After running the above two commands, the firewall is turned on and automatically turned on when the system starts.

Turn off all external access to the local machine, but the external access to the local machine is normal.

3. Enable / disable

Sudo ufw allow | deny [service]

Open or close a port, for example:

Sudo ufw allow smtp allows all external IP access to the native 25/tcp (smtp) port

Sudo ufw allow 22/tcp allows all external IP access to the native 22/tcp (ssh) port

Sudo ufw allow 53 allows external access to port 53 (tcp/udp)

Sudo ufw allow from 192.168.1.100 allows this IP to access all native ports

Sudo ufw allow proto udp 192.168.0.1 port 53 to 192.168.0.2 port 53

Sudo ufw deny smtp prohibits external access to smtp services

Sudo ufw delete allow smtp deletes one of the rules established above

4. View firewall status

Sudo ufw status

For ordinary users, you only need to set the following settings:

Sudo apt-get install ufw

Sudo ufw enable

Sudo ufw default deny

The above three commands are secure enough. If you need to open some services, use sudo ufw allow to open them.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report