• Centos 7和Centos 6的防火墙


    鉴于大量企业生产环境还在使用Centos 6,对照Centos 7把防火墙相关命令和问题一同记忆

    防火墙 centos7 centos6
    状态 systemctl status firewalld.service service iptables status
    开启 systemctl start firewalld.service service iptables start
    关闭 systemctl stop firewalld.service servcie iptables stop
    自启 systemctl enable firewalld.service chkconfig iptables on
    禁止 systemctl disable firewalld.service chkconfig iptables off
    重启 systemctlrestart firewalld.service service iptables restart
    更新 firewall-cmd --reload
    策略 firewall-cmd --zone=public --list-port iptables -nL
    添加端口 firewall-cmd --zone=public --add-port=80/tcp --permanent iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    删除策略 firewall-cmd --zone=public --remove-port=80/tcp --permanent iptables -A INPUT -p tcp --dport 80 -j REJECT
    添加进程 firewall-cmd --zone=public --add-service=samba
    删除进程 firewall-cmd --zone=public --rmove-service=samba

    --reload :动态更新,不用重启服务
    --permanent : 永久生效,没有此参数重启后失效
    --zone :作用域,一个网卡同时只能绑定一个zone

    zone

    命令

    firewall-cmd --get-active-zones 输出活跃的区域
    firewall-cmd [--zone=] --list-all输出区域全部启用的特性。如果省略区域,将显示默认区域的信息

    类型

    • 丢弃(drop):任何流入网络的包都被丢弃,不作出任何响应。只允许流出的网络连接。
    • 阻塞(block):任何进入的网络连接都被拒绝,并返回 IPv4 的 icmp-host-prohibited 报文或者 IPv6 的 icmp6-adm-prohibited 报文。只允许由该系统初始化的网络连接。
    • 公开(public):用以可以公开的部分。你认为网络中其他的计算机不可信并且可能伤害你的计算机。只允许选中的连接接入。
    • 外部(external):用在路由器等启用伪装的外部网络。你认为网络中其他的计算机不可信并且可能伤害你的计算机。只允许选中的连接接入。
    • 隔离区(dmz):用以允许隔离区(dmz)中的电脑有限地被外界网络访问。只接受被选中的连接。
    • 工作(work):用在工作网络。你信任网络中的大多数计算机不会影响你的计算机。只接受被选中的连接。
    • 家庭(home):用在家庭网络。你信任网络中的大多数计算机不会影响你的计算机。只接受被选中的连接。
    • 内部(internal):用在内部网络。你信任网络中的大多数计算机不会影响你的计算机。只接受被选中的连接。
    • 受信任的(trusted):允许所有网络连接。

    Linux7/Centos7新特性之防火墙:https://blog.csdn.net/weixin_41078837/article/details/80566588
    CentOS7 防火墙(firewall)的操作命令:https://www.cnblogs.com/leoxuan/p/8275343.html
    CentOS7中firewalld的安装与使用详解:https://blog.csdn.net/solaraceboy/article/details/78342360

    ----to be continue

  • 相关阅读:
    Java LinkedList 源码剖析
    Java并发编程:线程池的使用
    Java 线程池的原理与实现
    多线程JAVA篇(一)
    软件开发中会用到的图
    linux文件名匹配——通配符使用
    XModem协议
    dmesg 命令七种用法
    定位精度单位CEP、RMS、2DRMS常识
    5G NR 技术简介
  • 原文地址:https://www.cnblogs.com/enuff/p/firewall.html
Copyright © 2020-2023  润新知