iptables/firewalld防火墙开启关闭命令,由于有很多朋友经常会遇到安装好某些科学上网工具,配置一切都正常,但是电脑和手机就是无法连接网络的情况,大致解决办法在搭建上网工具的教程都有提到过,大部分情况都是由于Linux系统防火墙没有放行相应端口所造成的问题,这里也给大家单独做篇教程说明!

SELinux安全套件
SElinux是Linux系统下的一个增强安全模块,虽然保护了我们的系统,但同时也会阻碍很多软件的运行,永久关闭SElinux在命令行输入:vi /etc/selinux/config文章源自Get主机优惠信息-https://getzhuji.com/4405.html
找到SELINUX=enforce,改成SELINUX=disabled;把“SELINUXTYPE=targeted”这行注释掉,变成 # “SELINUXTYPE=targeted”,然后保存重启服务器生效;同理如果要开启则删掉注释把disabled改成enforce。文章源自Get主机优惠信息-https://getzhuji.com/4405.html
iptables防火墙命令
这个防火墙默认安装在centos7以下版本的Linux系统,如果使用的centos6.*的版本作为参考,#后面为注释;文章源自Get主机优惠信息-https://getzhuji.com/4405.html
service iptables status #检查是否安装了iptables yum install -y iptables #安装iptables yum update iptables #升级iptables yum install iptables-services -y #安装iptables-services service iptables restart #重启iptables service iptables start #启动iptables service iptables stop #停止iptables service iptables restart #重启iptables chkconfig iptables on #开机自启 chkconfig iptables off #关闭开机自启
iptables防火墙端口转发教程:https://getzhuji.com/3044.html文章源自Get主机优惠信息-https://getzhuji.com/4405.html
firewalld防火墙命令
这个防火墙默认安装在centos7及以上版本的Linux系统,如果使用的centos7.*的版本作为参考,#后面为注释;文章源自Get主机优惠信息-https://getzhuji.com/4405.html
systemctl status firewalld.service ##查看firewall状态 yum -y install firewall* ##安装firewall命令 yum -y remove firewall* ##卸载firewall命令 systemctl start firewalld.service ##打开firewall命令 systemctl stop firewalld.service ##关闭firewall命令 systemctl restart firewalld.service ##重启firewall systemctl disable firewalld.service ##禁止firewall开机自启 systemctl enable firewalld.service ##允许firewall开机自启
firewalld端口转发教程:https://getzhuji.com/3451.html文章源自Get主机优惠信息-https://getzhuji.com/4405.html
最后如果使用的是谷歌云、微软云、阿里云、腾讯云、UCloud等等大厂家的云服务器,在商家网站后台服务器里面还有个安全组或是防火墙设置,也需要同步放行出站端口。文章源自Get主机优惠信息-https://getzhuji.com/4405.html 文章源自Get主机优惠信息-https://getzhuji.com/4405.html