Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use firewall in Linux

Shulou Source: shulou.com Published: 2022-06-01 22:18:55 11月03日 Update

This article shows you how to use firewall in Linux. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Summary of the usage of firewall in Linux

Firewall is easy to use

1, showing all configurations

Firewall-cmd-list-all-zones

2, reload the configuration

Firewall-cmd-reload

3, remove interface from public

Firewall-cmd-zone=public-remove-interface=eno16777736

4. Query public network port

Firewall-cmd-permanent-query-port=8080/tcp

5. Delete port 8080 and prohibit access to public network

Firewall-cmd-permanent-remove-port=8080/tcp

6. Add port 8080 for access to the public network

Firewall-cmd-permanent-add-port=8080/tcp

7, restart the firewall

Systemctl restart firewalld

8, forward the request to port 80 to 8080

Firewall-cmd-add-forward-port=port=80:proto=tcp:toport=8080

9, take a look at which services and ports are now opened by the firewall

[root@localhost ~] # firewall-cmd-- list-allpublic (default, active) interfaces: eno16777736 sources: services: dhcpv6-client ssh ports: 8080/tcp masquerade: no forward-ports: port=80:proto=tcp:toport=8080:toaddr= icmp-blocks: rich rules:

10, set the default zone

Irewall-cmd-- get-default-zonefirewall-cmd-- set-default-zone=trusted the above is how firewall is used in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Port content skills knowledge firewall configuration fire prevention concise concise usage that is articles methods more articles industry information channels channels one bright Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB Docker Microsoft Linux