CentOS 6.8 开端口Bad argument '-state'

感觉在win10的virtualbox中安装CentOS 6.8 与在mac10.13.6的Parallels Desktop中安装CentOS 6.8还是有点区别的

开个端口都能有差别

编辑iptables

sudo vim /etc/sysconfig/iptables

添加

-A INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT

保存重启 

service iptables restart

报错了! Try `iptables-restore -h' or 'iptables-restore --help' for more information.

参考Linux中在防火墙中开启80端口的例子

步骤如下(请看完再照着做!!!)

/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables restart

最后查看端口状态 

/etc/init.d/iptables status

 

but! 不管iptables文件之前有什么配置,改完之后变成了这样

之前默认的配置也不见了一半,只剩下这几句了,我没有备份,现在还看不出有什么影响,最好先备份吧!

猜你喜欢

转载自blog.csdn.net/qq_42440234/article/details/82913435