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