Home > System Tutorial > LINUX > body text

How to close firewall port in linux

下次还敢
Release: 2024-04-11 16:54:15
Original
959 people have browsed it

Linux firewall ports can be closed by closing specific or range ports with the ufw command: Close specific ports: sudo ufw delete allow port/protocol Close port range: sudo ufw delete allow port_range:start_port:end_port/protocol Reload the firewall :sudo ufw reload

How to close firewall port in linux

How to close Linux firewall ports

Close specific ports

Useufw Command to close a specific port:

<code class="bash">sudo ufw delete allow port/protocol</code>
Copy after login

where port is the port number to be closed, protocol is the protocol used by the port (for example, tcp or udp).

For example, to close the HTTP port with port number 80, run the following command:

<code class="bash">sudo ufw delete allow 80/tcp</code>
Copy after login

Close the port range

To close the port range, use the following command:

<code class="bash">sudo ufw delete allow port_range:start_port:end_port/protocol</code>
Copy after login

Where start_port is the start port of the range, end_port is the end port of the range, protocol is the protocol used.

For example, to close TCP ports in the port range 8080 to 8090, run the following command:

<code class="bash">sudo ufw delete allow 8080:8090/tcp</code>
Copy after login

Reload the firewall

After closing the port, you need to reload the firewall rules to enable Changes take effect:

<code class="bash">sudo ufw reload</code>
Copy after login

The above is the detailed content of How to close firewall port in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!