Manage firewall on Centos 7

Check the Firewall Status

To view the current status of the FirewallD service you can use the firewall-cmd command:

sudo firewall-cmd --state

If the FirewallD service is running on your CentOS system the command above will print the following message:

running

Disable Firewall

You can temporarily stop the FirewallD service with the following command:

sudo systemctl stop firewalld

However this change will be valid for the current runtime session only.

To permanently disable the firewall on your CentOS 7 system, follow the steps below:

  1. First, stop the FirewallD service with:

    sudo systemctl stop firewalld
  2. Disable the FirewallD service to start automatically on system boot:

    sudo systemctl disable firewalld

    The output from the command above will look something like this:

    Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  3. Mask the FirewallD service which will prevent the firewall from being started by other services:

    sudo systemctl mask --now firewalld

    As you can see from the output the mask command simply creates a symlink from the firewalld service to /dev/null:

    Created symlink from /etc/systemd/system/firewalld.service to /dev/null.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值