CentOS 关闭SELINUX及添加防火墙规则

来源:互联网 发布:鲸鱼宝网络不给力 编辑:程序博客网 时间:2024/05/10 22:41

开放80、3306端口

vim /etc/sysconfig/iptables在默认的22端口这条规则下面添加以下代码(可以继续添加,修改端口号即可)#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT然后保存,重启防火墙使配置生效/etc/init.d/iptables restartshutdown -r now#重启系统查看打开的端口/etc/init.d/iptables status--------------一点补充-----------------#关闭防火墙/etc/init.d/iptables stop#停止服务service iptables stop#查看防火墙信息/etc/init.d/iptables status

关闭SELINUX

vim /etc/selinux/config#SELINUX=enforcing #注释掉#SELINUXTYPE=targeted #注释掉SELINUX=disabled #增加:wq!#保存退出shutdown -r now#重启系统
0 0
原创粉丝点击