zoukankan      html  css  js  c++  java
  • Centos中iptables和firewall防火墙开启、关闭、查看状态、基本设置等

    iptables防火墙
         # 查看防火墙状态

      service iptables status

      # 停止防火墙
      service iptables stop

      # 启动防火墙
      service iptables start

      # 重启防火墙
      service iptables restart

      # 永久关闭防火墙
      chkconfig iptables off

      # 永久关闭后重启
      chkconfig iptables on 
    开启8080端口

      vim /etc/sysconfig/iptables
        -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

        service iptables restart
      firewall防火墙
        查看firewall服务状态

          systemctl status firewalld
         查看firewall的状态

        firewall-cmd --state
      开启、重启、关闭、firewalld.service服务

      # 开启
      service firewalld start
      # 重启
      service firewalld restart
      # 关闭
      service firewalld stop
    查看防火墙规则

      firewall-cmd --list-all
      查询、开放、关闭端口

      # 查询端口是否开放
      firewall-cmd --query-port=8080/tcp
      # 开放80端口
      firewall-cmd --permanent --add-port=80/tcp
      # 移除端口
      firewall-cmd --permanent --remove-port=8080/tcp

      #重启防火墙(修改配置后要重启防火墙)
      firewall-cmd --reload
      # 参数解释
      1、firwall-cmd:是Linux提供的操作firewall的一个工具;
      2、--permanent:表示设置为持久;

  • 相关阅读:
    ADC推荐:测量Flash的视频消费行为 (转载)
    9.7Go之函数之递归函数
    9.8线性表之单链表
    9.7线性表之顺序表
    9.7顺序表之增、删、改、查
    9.8Go之函数之计算执行时间
    9.8Go之函数之宕机(panic)
    9.9Go语言内存缓存
    9.7Go之函数之处理RuntimeError
    9.7Go之函数之defer(延迟执行语句)
  • 原文地址:https://www.cnblogs.com/cbugs/p/11732211.html
Copyright © 2011-2022 走看看