zoukankan      html  css  js  c++  java
  • 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  ]
  • 相关阅读:
    堆内存和栈内存
    链表
    爬虫---正则表达式
    剑指offer---二维数组中的查找
    基于C#开发的俄罗斯方块
    Java第十天
    软考错题合集之11-05-AM
    软考错题合集之11-11-AM
    软考错题合集之12-05-AM
    GOF之模板模式
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/13719486.html
Copyright © 2011-2022 走看看