• 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  ]
  • 相关阅读:
    php无限极分类
    如何使用百度地图
    如何在windows下用IDA优雅调试ELF
    [补] winpcap编程——EAPSOCKET实现校园网锐捷登录(mentohust)
    [补] winpcap编程——EAP协议与EAPSOCKET实现
    [补] windows C socket编程——大物实验预约
    [C++ Calculator 项目] 文件读入与可视化实现
    Area of Circle
    [C++ Calculator 项目] 基础运算实现
    [C++ Calculator 项目] 初试
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/13719486.html
Copyright © 2020-2023  润新知