python调用centos防火墙_CentOS关闭防火墙

本文介绍了在CentOS6和CentOS7中如何管理和关闭防火墙。CentOS6使用iptables,通过service命令进行控制;而CentOS7引入了firewalld,用systemctl来管理。若要在CentOS7中使用iptables,需安装iptables-services。详细步骤包括查看状态、关闭服务及禁止开机启动。
摘要由CSDN通过智能技术生成

CentOS6和

CentOS7两个版本的火墙操作操作工具不同,分别是iptables和firewalld

,如果想

CentOS7也可以使用iptables,需要安装iptables-services服务;

CentOS6关闭防火墙:

[root@test01 ~]# service iptables status  -- 查看防火墙状态

[root@test01 ~]# service iptables stop    -- 关闭防火墙

[root@test01 ~]# chkconfig iptables off   -- 关闭防火墙开机自启动

CentOS7关闭防火墙:

[root@test01 ~]# systemctl status firewalld  -- 查看防火墙状态

● firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

Active: active (running) since Fri 2020-12-18 14:36:16 CST; 3s ago

Docs: man:firewalld(1)

Main PID: 7111 (firewalld)

CGroup: /system.slice/firewalld.service

└─7111 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

Dec 18 14:36:16 test01 systemd[1]: Starting firewalld - dynamic firewall daemon...

Dec 18 14:36:16 test01 systemd[1]: Started firewalld - dynamic firewall daemon.

[root@test01 ~]# systemctl stop firewalld   -- 关闭防火墙

[root@test01 ~]# systemctl disable firewalld  -- 关闭防火墙开机自启动

CentOS7使用iptables操作防火墙:

[root@test01 ~]# service iptables status          -- 安装iptables-services之前

Redirecting to /bin/systemctl status iptables.service

Unit iptables.service could not be found.

[root@test01 ~]# yum install iptables-services    -- 安装iptables-services

[root@test01 ~]# service iptables status          -- 安装iptables-services之后

Redirecting to /bin/systemctl status iptables.service

● iptables.service - IPv4 firewall with iptables

Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)

Active: inactive (dead)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值