centos7-关闭防火墙

  • 2019 年 10 月 4 日
  • 笔记

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/qq_37933685/article/details/89342051

关闭防火墙

centos:

  1. 关闭selinux:
 vi /etc/sysconfig/selinux   修改   ...   SELINUX=disabled   ...   修改完后   reboot
  1. 防火墙开启某端口:
7:  firewall-cmd --zone=public --add-port=8888/tcp --permanent  6:  iptables -A INPUT -p tcp --dport 8080 -j ACCEPT  /etc/rc.d/init.d/iptables save  /etc/init.d/iptables restart
  1. 防火墙关闭某端口:
firewall-cmd --zone=public --remove-port=8888/tcp --permanent
  1. 防火墙查看某个端口状态:
firewall-cmd --query-port=8888/tcp
  1. 查看已经开放的端口:
7:  firewall-cmd --list-ports    6:  /etc/init.d/iptables status
  1. 重启防火墙:
7:  firewall-cmd --reload    6:  service iptables restartd
  1. 关闭防火墙:
7:  systemctl stop firewalld.service    6:  service iptables stop
  1. 开启防火墙:
7:  systemctl start firewalld.service    6:  service iptables start
  1. 设置开机自启
7:  systemctl enable firewalld.service    6:  chkconfig iptables on
  1. 设置开启不自启
7:  systemctl disable firewalld.service    6:  chkconfig iptables off