ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux关闭防火墙

Linux关闭防火墙

原创 Linux操作系统 作者:joshliu 时间:2020-10-20 10:40:09 0 删除 编辑

        目前Linux防火墙的管理工具主要有两种,一个是Centos6版本的iptables,一个是Centos7版本的firewalld,这里分两个版本总结防火墙的关闭;

Centos 7 关闭防火墙

[root@node1 ~]# systemctl status firewalld   -- 查看防火墙状态,目前是running状态
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-10-20 10:25:02 CST; 2s ago
     Docs: man:firewalld(1)
 Main PID: 22161 (firewalld)
   Memory: 23.8M
   CGroup: /system.slice/firewalld.service
           └─22161 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Oct 20 10:25:01 node1.esgyn.cn systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 20 10:25:02 node1.esgyn.cn systemd[1]: Started firewalld - dynamic firewall daemon.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
[root@node1 ~]# systemctl stop firewalld   -- 关闭防火墙
[root@node1 ~]# systemctl status firewalld  -- 关闭后查看防火墙状态,与关闭前的状态进行对比
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
Oct 20 10:25:01 node1.esgyn.cn systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 20 10:25:02 node1.esgyn.cn systemd[1]: Started firewalld - dynamic firewall daemon.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
Oct 20 10:25:02 node1.esgyn.cn firewalld[22161]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Oct 20 10:25:11 node1.esgyn.cn systemd[1]: Stopping firewalld - dynamic firewall daemon...
Oct 20 10:25:12 node1.esgyn.cn systemd[1]: Stopped firewalld - dynamic firewall daemon.

        systemctl stop firewalld:通过该命令关闭防火墙后,如果服务器重启,防火墙默认是会开启的,所以避免重启后防火墙开启导致Linux上安装的服务出现问题(一般分布式的软件在Linux上部署,需要关闭防火墙),需要设置开机禁止启动防火墙;

[root@node1 ~]# systemctl disable firewalld  -- 设置防火墙开机禁止启动

Centos 6 关闭防火墙

[root@node1 ~]# service iptables status   -- 查看防火墙状态
[root@node1 ~]# service iptables stop     -- 关闭防火墙
[root@node1 ~]# chkconfig iptables off    -- 设置防火墙开机禁止启动


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69985104/viewspace-2728018/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Linux关闭selinux
请登录后发表评论 登录
全部评论

注册时间:2020-10-09

  • 博文量
    78
  • 访问量
    74237