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

What is the method of setting firewall in different versions of Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I will talk to you about how to set up firewalls in different versions of Linux, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

How to set up Linux firewall in Linux system? Different versions of firewalls are different in Linux systems, so the methods of setting them are also different.

View Linux version model

[root@localhost ~] # cat / etc/redhat-release

CentOS Linux release 7.5.1804 (Core)

You can see that this version is centos7

Different models use different firewall commands. This version is centos7. If you use other versions of the command, you will be prompted that you have no permission.

1. Basic use of firewalld

Launch: systemctl start firewalld

View status: systemctl status firewalld

Set whether to boot or not: systemctl disable firewalld

Set up the boot systemctl enable firewalld

Turn off: systemctl stop firewalld

2.systemctl is the main tool in CentOS7's service management tools, which combines the functions of service and chkconfig.

Start a service: systemctl start firewalld.service

Shut down a service: systemctl stop firewalld.service

Restart a service: systemctl restart firewalld.service

Displays the status of a service: systemctl status firewalld.service

Enable a service at boot time: systemctl enable firewalld.service

Disable one service at boot time: systemctl disable firewalld.service

Check to see if the service is powered on: systemctl is-enabled firewalld.service

View the list of started services: systemctl list-unit-files | grep enabled

View the list of services that failed to start: systemctl-failed

3. Configure firewalld-cmd

View version: firewall-cmd-version

Check out help: firewall-cmd-help

Display status: firewall-cmd-state

View all open ports: firewall-cmd-zone=public-list-ports

Update firewall rules: firewall-cmd-reload

View area information: firewall-cmd-get-active-zones

View the area to which the specified API belongs: firewall-cmd-get-zone-of-interface=eth0

Reject all packages: firewall-cmd-panic-on

Cancel rejection status: firewall-cmd-panic-off

Check to see if reject: firewall-cmd-query-panic

So how do you open a port?

Add

Firewall-cmd-zone=public-add-port=80/tcp-permanent (- permanent is in effect permanently and expires after restart without this parameter)

Reload

Firewall-cmd-reload

View

Firewall-cmd-zone= public query-port=80/tcp

Delete

Firewall-cmd-zone= public remove-port=80/tcp permanent

After reading the above, do you have any further understanding of how to set up firewalls in different versions of Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Development

Wechat

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

12
Report