加入收藏 | 设为首页 | 会员中心 | 我要投稿 岳阳站长网 (https://www.0730zz.com/)- 物联平台、混合云存储、数据仓库、智能推荐、智能数字人!
当前位置: 首页 > 综合聚焦 > CentOS > 正文

centos下/etc/sysconfig/下找不到iptables文件

发布时间:2020-07-03 10:15:54 所属栏目:CentOS 来源:互联网
导读:原因:在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。 解决办法: 1、随便写一条iptables命令配置个防火墙规则:如: iptables -P OUTPUT ACCEPT 2,进行保存 service iptables s


原因:在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。


解决办法:
1、随便写一条iptables命令配置个防火墙规则:如:

iptables -P OUTPUT ACCEPT

2,进行保存

service iptables save

3,service iptables restart


异常

The service command supports only basic LSB actions (start,stop,restart,try-restart,reload,force-reload,status). For other actions,please try to use systemctl.

解决


With RHEL 7 / CentOS 7,firewalld was introduced to manage iptables. IMHO,firewalld is more suited for workstations than for server environments.

It is possible to go back to a more classic iptables setup. First,stop and mask the firewalld service:


systemctl stop firewalld
systemctl mask firewalld


Then,install the iptables-services package:

yum install iptables-services



Enable the service at boot-time:

systemctl enable iptables



Managing the service

systemctl stop iptables

systemctl start iptables

systemctl |restart iptables


Saving your firewall rules can be done as follows:

service iptables save

or

/usr/libexec/iptables/iptables.init save

参考文章:

http://www.centoscn.com/CentosBug/osbug/2014/0919/3779.html

http://www.cnblogs.com/love3556/p/5923392.html

(编辑:岳阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读