zoukankan      html  css  js  c++  java
  • CentOS 7 以上防火墙简单配置

    CentOS 7 版本以上默认的防火墙不是iptables,而是firewalle.

    因此CentOS 7 以下的 iptables 的配置不能使用。


    查看防火墙状态:

     systemctl status firewalld
    
     firewall-cmd --state

    查看防火墙配置:

     firewall-cmd --list-all

    列出所有已开放端口:

     firewall-cmd --zone=public --list-ports


    查询端口 8080 是否开放:

     firewall-cmd --query-port=8080/tcp

    关闭 | 启动防火墙:

     systemctl start firewalld
    
     systemctl stop firewalld

    关闭开机启动:

     systemctl disable firewalld

    开启开机启动:

     systemctl enable firewalld

    开启 80 端口

     firewall-cmd --zone=public --add-port=80/tcp --permanent


    移除 80 端口

     firewall-cmd --zone=public --remove-port=80/tcp --permanent


    上面俩命令需要重新载入配置,才能生效

     firewall-cmd --reload

    查看开机自启动的服务列表

     systemctl list-unit-files|grep enabled 

    查看监听的端口

     netstat -lntp


    检查 80 端口被哪个进程占用

     netstat -lnp|grep 80
  • 相关阅读:
    cookie和session学习笔记
    Listener和Filter学习笔记
    [转载]mysql root密码忘了怎么办
    [转载]oracle连不上的各种现象
    Oauth入门学习
    XML学习笔录
    共享内存
    守护进程
    Linux系统调用与文件I/O(一)
    我的第一篇博客
  • 原文地址:https://www.cnblogs.com/lwthad/p/10253318.html
Copyright © 2011-2022 走看看