参考链接1:https://blog.csdn.net/song_csdn1550/article/details/51768671

参考链接2:  https://www.cnblogs.com/wanghuaijun/p/5469437.html

[root@tp ~]# 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@tp ~]# iptables -F 清除预设表filter中的所有规则链的规则
[root@tp ~]# iptables -X 清除预设表filter中使用者自定链中的规则

然后查看iptable中的规则

[root@tp ~]# iptables -L -n

Chain INPUT (policy ACCEPT)
target prot opt source destination </p> <p>Chain FORWARD (policy ACCEPT)
target prot opt source destination </p> <p>Chain OUTPUT (policy ACCEPT)

target prot opt source destination  

大致出现上面的输出则表明已经清除了原有的配置规则

因为上面的清除仅仅闲鱼当前启动情况,如果我们重启服务后,它又会回到原来的配置,所以我们需要持久保存

[root@tp ~]# service iptables save

在执行该语句的时候就出现了上面的报错信息,所以就有了下面的解决方案

执行一下命令:

[plain]  view plain  copy
  1. systemctl stop firewalld  
  2. systemctl mask firewalld  
并且安装iptables-services:
[plain]  view plain  copy
  1. yum install iptables-services  
设置开机启动:
[plain]  view plain  copy
  1. systemctl enable iptables 
[plain]  view plain  copy
  1. systemctl stop iptables  
  2. systemctl start iptables  
  3. systemctl restart iptables  
  4. systemctl reload iptables  
保存设置:
[plain]  view plain  copy
  1. service iptables save  

这时候就可以了。

上面的操作是说把 firewalld 的防火墙关闭,并安装iptables形式的防火墙,然后设置开机时开启iptables形式的防火墙,然后为iptables载入start\stop

等操作指令。

使用下面的命令就可以操作iptables形式防火墙

service iptables status   //查看防火墙状态
service iptables start    //启动防火墙

service iptables stop     //停止防火墙

service iptables restart   //重启防火墙

Redirecting to /bin/systemctl restart  iptables.service

在防火墙开启的情况,加载开放端口

开放某个端口 在/etc/sysconfig/iptables里添加

在该文件中找到


然后按照该格式修改端口就可以,然后重启iptables


GitHub 加速计划 / li / linux-dash
12
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐