• Centos6、Centos7防火墙基本操作整理


    Centos7:
    查看防火墙状态:
    firewall-cmd --state
    开启防火墙:
    systemctl start firewalld.service
    关闭防火墙(重启失效):
    systemctl stop firewalld.service
    开机不启动防火墙:
    systemctl disable firewalld.service
    开机启动防火墙:
    systemctl enable firewalld.service
    重启防火墙:
    firewall-cmd --reload
    查看已开放端口:
    firewall-cmd --list-ports
    查看指定端口状态(以1521端口为例):
    firewall-cmd --zone=public --query-port=1521/tcp
    开放指定端口:
    firewall-cmd --zone=public --add-port=1521/tcp --permanent
    关闭指定端口:
    firewall-cmd --zone=public --remove-port=1521/tcp --permanent
    开放、关闭端口注意:
    重启防火墙才生效
    --permanent:永久生效,否则重启失效
    Centos6:
    查看防火墙状态:
    service iptables status
    开启防火墙:
    service iptables start
    关闭防火墙(重启失效):
    service iptables stop
    开机不启动防火墙:
    chkconfig iptables off
    开机启动防火墙:
    chkconfig iptables on
    查看端口状态:
    /etc/init.d/iptables status
    重启防火墙
    service iptables restart
    开放指定端口:
    修改 /etc/sysconfig/iptables 文件:
    添加
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
    保存重启防火墙

  • 相关阅读:
    HDU2546(01背包)
    HDU4283(KB22-G)
    POJ1651(KB-E)
    POJ2955(KB22-C 区间DP)
    POJ3264(KB7-G RMQ)
    POJ3468(KB7-C 线段树)
    POJ3616(KB12-R dp)
    Ubuntu16.04安装opencv for python/c++
    华中农业大学第五届程序设计大赛网络同步赛-L
    华中农业大学第五届程序设计大赛网络同步赛-K
  • 原文地址:https://www.cnblogs.com/Lans-word/p/11626872.html
Copyright © 2020-2023  润新知