搬瓦工VPS错误提示iptables command not found的原因和解决方法

VPS新手教程搬瓦工VPS错误提示iptables command not found的原因和解决方法已关闭评论1阅读模式

iptables是linux的一款防火墙软件,可以用来管理端口的开放关闭,封禁、解封某IP的访问等等。不过一些新手朋友在操作搬瓦工VPS的过程中直接就运行百度到某条命令,然后就得到提示iptables command not found,意思就是没有安装iptable。之前的文章讲过一个简单粗暴的遇到ommand not found的解决方法,就是直接安装缺少的这个软件。不过这个iptables,并不是直接安装就可以,也要分系统版本。

如果你使用的系统不是centos7,那么可以直接安装iptables,运行安装命令yum -y install iptables(centos)或者sudo apt-get install iptables(debain)。文章源自搬瓦工-https://www.bwhcn.com/1205.html

而centos7使用的防火墙已经更换成firewalld了。所以提示找不到iptables很正常。附上几条firewalld常用的命令。文章源自搬瓦工-https://www.bwhcn.com/1205.html

1、添加端口:firewall-cmd --zone=public --add-port=80/tcp --permanent文章源自搬瓦工-https://www.bwhcn.com/1205.html

注意,这里的--permanent表示永久生效,没有此参数重启后失效文章源自搬瓦工-https://www.bwhcn.com/1205.html

2、删除端口:firewall-cmd --zone= public --remove-port=80/tcp --permanent文章源自搬瓦工-https://www.bwhcn.com/1205.html

3、重新载入:firewall-cmd --reload文章源自搬瓦工-https://www.bwhcn.com/1205.html 文章源自搬瓦工-https://www.bwhcn.com/1205.html

 
  • 本文由 admin 发表于 2018年8月21日 10:07:33
  • 转载请务必保留本文链接:https://www.bwhcn.com/1205.html