你的位置:首页 > 互联网IT

Linux防火墙设置Centos 6.9

2020-03-26 浏览:(2509) 互联网IT 评论(0)

Linux防火墙设置Centos 6.9

检查 VPS iptables 内部防火墙规则是否开放端口

首先查看一下iptables防火墙规则,看看是不是把 Shadowsocks的端口堵住了,如果你的VPS并没有什么重要的防火墙规则,那就可以直接 **关闭防火墙 **或者 清空防火墙规则

当然,如果你的VPS上面放的有网站(一般lnmp安装完都会把非必要端口外的端口全部封掉)或者其他的程序,你就需要 添加开放端口规则

1.  # 查看iptables防火墙规则

2.  iptables -L



4.  # 清空iptables防火墙规则,注意,一些VPS使用后会导致无法连接VPS!!

5.  iptables -F


7.  # 添加iptables防火墙开放 TCP/UDP 端口规则

8.  iptables -I INPUT -p tcp --dport 端口  -j ACCEPT

9.  iptables -I INPUT -p udp --dport 端口  -j ACCEPT


11.  # 关闭防火墙

12.  service iptables stop



想要永久关闭防火墙还需要输入命令:

chkconfig iptables off


14.  # 以上四个命令不是按顺序执行,而是根据需求执行!







CentOS6.9系统关闭防火墙


查看防火墙状态:service iptables status


关闭防火墙:service iptables stop(关闭防火墙的命令即时生效,但是下次开机还会重启)


开启防火墙:service iptables start


想要永久关闭防火墙还需要输入命令:chkconfig iptables off


再输入命令,查看一下状态,chkconfig iptables --list,如果是iptables  0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭,如果是这样的话,你就成功了。


QQ截图20200327001211.jpg Linux防火墙设置Centos 6.9 互联网IT

  • 发表评论
  • 查看评论
【暂无评论!】

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。