【原创】CentOS iptables注意事项

以往用centos,防火墙都是firewall,一直没有接触iptables。

这次用虚拟机安装测试CentOS系统后,vsftpd启动,selinux、firewalld关闭,ftp却无论如何连接不上,一直提示连接超时。

最后发现,原来系统中还启动了iptables(为何启动的?什么时候安装的?均不知)

原想卸载iptables,上网查询后发现运行yum -y remove iptables会删除很多依赖组件

如果不需使用iptables,只需将其停止或是清楚规则即可。

停止:

systemctl stop iptables

禁用:

systemctl disabled iptables

停止或禁用后 ftp连接正常。

另附上关闭firewall及selinux的方法

 

停止firewall:

systemctl stop firewalld.service

禁用firewall:

systemctl disable firewalld.service

临时关闭selinux:

setenforce 0

永久关闭selinux:

vi /etc/selinux/config

SELINUX=disabled
设置后需要重启系统

查看selinux启动状态:

getenforce

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注