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  ]
  • 相关阅读:
    DS博客作业--线性表
    c博客06-2019-结构体&文件
    C语言博客作业03--函数
    DS博客作业05--查找
    DS博客作业04--图
    DS博客作业03--树
    DS博客作业02--栈和队列
    DS博客作业2--线性表
    c博客06-结构体&文件
    C语言博客作业—2019-指针
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/13719486.html
Copyright © 2011-2022 走看看