• 31-1.解决service iptables save出错


    CentOS 7.x开始,CentOS开始使用systemd服务来代替daemon,原来管理系统启动和管理系统服务的相关命令全部由systemctl命令来代替。service命令只保留下了极少部分使用,大部分命令都要改用systemctl使用。  

    [root@localhost ~]# service iptables save
    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.

      关闭防火墙  

    [root@localhost ~]# systemctl stop firewalld
    [root@localhost ~]# systemctl mask firewalld    ----注销服务
    Created symlink from /etc/systemd/system/firewalld.service to /dev/null.

      安装iptables  

    [root@localhost ~]# yum install iptables
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
     * base: mirrors.huaweicloud.com
     * extras: mirror.bit.edu.cn
     * updates: mirrors.huaweicloud.com
    Running transaction
      Updating   : iptables-1.4.21-34.el7.x86_64                                                        1/2 
      Cleanup    : iptables-1.4.21-18.0.1.el7.centos.x86_64                                             2/2 
      Verifying  : iptables-1.4.21-34.el7.x86_64                                                        1/2 
      Verifying  : iptables-1.4.21-18.0.1.el7.centos.x86_64                                             2/2 
    
    Updated:
      iptables.x86_64 0:1.4.21-34.el7                                                                       
    
    Complete!

      设置iptables开机启动  

    [root@localhost ~]# systemctl enable iptables

      重启iptables服务

    systemctl restart iptables.service 

      再次执行保存命令,成功

    [root@localhost ~]# service iptables save
    iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
  • 相关阅读:
    字符输入输出
    每日一例
    每日一例
    结构
    指针数组的初始化
    装箱,拆箱,正则表达式
    数据类型的转换
    怎样让程序不断执行
    SQL练习1关于插入删除,修改,单表查询
    SQLSERVER 总结1
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/13719486.html
Copyright © 2020-2023  润新知