iptables

1、iptables 的基本使用

  • 启动: service start iptables
  • 关闭: service stop iptables
  • 查看状态: service status iptables

开启一个端口

// 添加端口
iptables -I OUTPUT -p tcp --sport 22 -j ACCEPT //保存
service iptables save //查看
iptables -L -n

firewalld

1、firewalld的基本使用

  • 启动: systemctl start firewalld
  • 关闭: systemctl stop firewalld
  • 查看状态: systemctl status firewalld
  • 开机禁用 : systemctl disable firewalld
  • 开机启用 : systemctl enable firewalld

注:启动时,可能报错

Failed to start firewalld.service: Unit is masked

原因:firewalld服务被锁定

解除锁定:

systemctl unmask firewalld

增加锁定:

systemctl mask firewalld

那怎么开启一个端口呢

  • 添加
firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
  • 重新载入
firewall-cmd --reload
  • 查看
firewall-cmd --zone= public --query-port=80/tcp
  • 删除
firewall-cmd --zone= public --remove-port=80/tcp --permanent

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

  • 启动一个服务:systemctl start firewalld.service
  • 关闭一个服务:systemctl stop firewalld.service
  • 重启一个服务:systemctl restart firewalld.service
  • 显示一个服务的状态:systemctl status firewalld.service
  • 在开机时启用一个服务:systemctl enable firewalld.service
  • 在开机时禁用一个服务:systemctl disable firewalld.service
  • 查看服务是否开机启动:systemctl is-enabled firewalld.service
  • 查看已启动的服务列表:systemctl list-unit-files|grep enabled
  • 查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

  • 查看版本: firewall-cmd --version
  • 查看帮助: firewall-cmd --help
  • 显示状态: firewall-cmd --state
  • 查看所有打开的端口: firewall-cmd --zone=public --list-ports
  • 更新防火墙规则: firewall-cmd --reload
  • 查看区域信息: firewall-cmd --get-active-zones
  • 查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
  • 拒绝所有包:firewall-cmd --panic-on
  • 取消拒绝状态: firewall-cmd --panic-off
  • 查看是否拒绝: firewall-cmd --query-panic

Linux - iptables firewalld的更多相关文章

  1. Linux防火墙配置(iptables, firewalld)

    netfilter和底层实现 iptables firealld Linux中的防火墙 RHEL中有几种防火墙共存: iptables firewalld ip6tables ebtables 这些软 ...

  2. Linux防火墙(iptables/firewalld)

    Linux防火墙(iptables/firewalld) 目录 Linux防火墙(iptables/firewalld) 一.iptables 1. iptables概述 2. netfilter和i ...

  3. linux iptables常用命令之配置生产环境iptables及优化

    在了解iptables的详细原理之前,我们先来看下如何使用iptables,以终为始,有可能会让你对iptables了解更深 所以接下来我们以配置一个生产环境下的iptables为例来讲讲它的常用命令 ...

  4. Linux iptables原理--数据包流向

    Iptable与Netfilter 在上一篇文章 linux iptables常用命令--配置一个生产环境的iptables 我们知道iptables有好几个表,如raw,mangle,nat,fil ...

  5. Linux iptables

    一.简介 http://liaoph.com/iptables/ 二.操作 1)查看规则 iptables -t filter -L -n iptables -t nat -L -n iptables ...

  6. Linux iptables 应用控制访问SSH服务

    Title:Linux iptables 应用控制访问SSH服务  --2012-02-23 17:51 今天用到了以前从来没有用到过的,iptables控制访问,只允许外部访问SSH服务(22号端口 ...

  7. Linux iptables 配置规则

    Linux iptables 防火墙配置规则 前言:把网上我感觉不错iptables的访问规则都统一在这里,以后做参考. modprobe ipt_MASQUERADE modprobe ip_con ...

  8. Linux iptables用法与NAT

    1.相关概念 2.iptables相关用法 3.NAT(DNAT与SNAT) 相关概念 防火墙除了软件及硬件的分类,也可对数据封包的取得方式来分类,可分为代理服务器(Proxy)及封包过滤机制(IP ...

  9. [svc]linux iptables实战

    参考: http://blog.51yip.com/linux/1404.html 链和表 参考: https://aliang.org/Linux/iptables.html 配置 作为服务器 用途 ...

随机推荐

  1. zz如何让你的婚姻天长地久?

    如果天长地久意味着一列永不出轨的火车,下面有关婚姻生活的战略就像制定一张准确的运行时刻表.因为成功的婚姻并非源于机运,所谓的七年之痒也不是空穴来风.对那些已婚男人来说,他们需要计划——为了一年比一年过 ...

  2. 变分贝叶斯VBEM 由浅入深

    变分贝叶斯EM指的是变分贝叶斯期望最大化(VBEM, variational Bayes expectation maximization),这种算法基于变分推理,通过迭代寻找最小化KL(Kullba ...

  3. HRBUST1311 火影忍者之~忍者村 2017-03-06 16:06 106人阅读 评论(0) 收藏

    火影忍者之-忍者村   忍者村是忍者聚居的村子,相等于国家的军事力量.绝大部分村民都是忍者,有一些忍者会在村内开设书店.餐厅等,不过大部分忍者都是为村子执行任务的忍者,以赚取酬劳,并于战时为国家出战. ...

  4. Hdu4280 Island Transport 2017-02-15 17:10 44人阅读 评论(0) 收藏

    Island Transport Problem Description In the vast waters far far away, there are many islands. People ...

  5. GameTOOL

    1.游戏的资源网站 http://www.gameres.com/yanfa_1.html

  6. B-spline Curves 学习之B样条曲线的系数计算与B样条曲线特例(6)

    B-spline Curves: Computing the Coefficients 本博客转自前人的博客的翻译版本,前几章节是原来博主的翻译内容,但是后续章节博主不在提供翻译,后续章节我在完成相关 ...

  7. 2、Docker和虚拟机的对比

    2.1 虚拟化技术   虚拟机Virtual Machine与容器化技术(代表Docker)都是虚拟化技术,两者的区别在于虚拟化的程度不同.   Docker为代表的容器化技术并不是虚拟机.   虚拟 ...

  8. java中的四种代码块

    一.普通代码块 直接在一个方法中出现的{}就称为普通代码块,例子程序如下: public class CodeDemo01{ public static void main(String[] args ...

  9. Kubernetes 自动伸缩 auto-scaling

    使用 Kubernetes 的客户能够迅速响应终端用户的请求,交付软件也比以往更快.但是,当你的服务增长速度比预期更快时,计算资源不够时,该怎么处理呢? 此时可以很自豪地说: Kubernetes 1 ...

  10. Git 安装配置,key导入

    系统 Centos 6.5 安装git 命令  yum install  git 配置git用户名 git config --global user.name "yangchengguo&q ...