Linux - iptables firewalld
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的更多相关文章
- Linux防火墙配置(iptables, firewalld)
netfilter和底层实现 iptables firealld Linux中的防火墙 RHEL中有几种防火墙共存: iptables firewalld ip6tables ebtables 这些软 ...
- Linux防火墙(iptables/firewalld)
Linux防火墙(iptables/firewalld) 目录 Linux防火墙(iptables/firewalld) 一.iptables 1. iptables概述 2. netfilter和i ...
- linux iptables常用命令之配置生产环境iptables及优化
在了解iptables的详细原理之前,我们先来看下如何使用iptables,以终为始,有可能会让你对iptables了解更深 所以接下来我们以配置一个生产环境下的iptables为例来讲讲它的常用命令 ...
- Linux iptables原理--数据包流向
Iptable与Netfilter 在上一篇文章 linux iptables常用命令--配置一个生产环境的iptables 我们知道iptables有好几个表,如raw,mangle,nat,fil ...
- Linux iptables
一.简介 http://liaoph.com/iptables/ 二.操作 1)查看规则 iptables -t filter -L -n iptables -t nat -L -n iptables ...
- Linux iptables 应用控制访问SSH服务
Title:Linux iptables 应用控制访问SSH服务 --2012-02-23 17:51 今天用到了以前从来没有用到过的,iptables控制访问,只允许外部访问SSH服务(22号端口 ...
- Linux iptables 配置规则
Linux iptables 防火墙配置规则 前言:把网上我感觉不错iptables的访问规则都统一在这里,以后做参考. modprobe ipt_MASQUERADE modprobe ip_con ...
- Linux iptables用法与NAT
1.相关概念 2.iptables相关用法 3.NAT(DNAT与SNAT) 相关概念 防火墙除了软件及硬件的分类,也可对数据封包的取得方式来分类,可分为代理服务器(Proxy)及封包过滤机制(IP ...
- [svc]linux iptables实战
参考: http://blog.51yip.com/linux/1404.html 链和表 参考: https://aliang.org/Linux/iptables.html 配置 作为服务器 用途 ...
随机推荐
- JavaScript 对象笔记
1. JS 将对象看成是属性的无序集合, 每个属性是一个key/value, 属性名是字符串, 值为任意类型; 对象除了键值对, 还从一个称为 "原型" 的 对象 继承属性(为啥是 ...
- Jenkins执行selenium报错unknown error: cannot find Chrome binary
问题描述:在Pycharm中执行selenium测试用例,可以正常运行, 集成在Jenkins中,构建时,发现构建成功,但是查看Console Output,报错:unknown error: can ...
- Knowing how all your components work together: distributed tracing with Zipkin
转自: http://aredko.blogspot.com/2014/02/knowing-how-all-your-components-work.html In today's post we ...
- CGLIB实现动态代理
JDK动态代理和CGLIB字节码生成的区别? * JDK动态代理只能对实现了接口的类生成代理,而不能针对类 * CGLIB是针对类实现代理,主要是对指定的类生成一个子类,覆盖其中的方法 因为是继承 ...
- 【分分钟内搭建一个带用户系统的博客程序(一)用户系统】asp.net core的Identity真香,EF真香!
不用不知道,一用香到爆. 老哥是个屌丝前端,但也想写点web应用耍一耍.之前弄过了NodeJs,也弄过JAVA,最近由于写游戏的原因用C#,索性上手一波asp.net core. 这篇博客记录的是,如 ...
- .Net Core MVC初学习
.net core已经出来很长一段时间了,没有很好的学习过,现在工作不那么忙了,参考官方文档,在这里记录自己的学习过程! ASP.NET Core 是一个跨平台的高性能开源框架,用于生成基于云且连接 ...
- 如何让你的项目同时支持go vendor和go module
目录 如何让你的项目同时支持go vendor和go module 1. go module简介 2. 使用go mod命令管理项目 2.1 初始化环境 2.2 构建 3. 保持兼容性 4. 使用go ...
- iOS 添加 Watch OS 1 应用后无法运行 An error was encountered while running (Domain = LaunchServicesError, Code = 0)
在 iOS 应用基础上我添加了一个 Watch OS 2 应用,运行良好.又加了一个 Watch OS 1 应用,然后就所有 Target 都不能运行了. 运行时说 An error was enco ...
- SHOI2013 扇形面积并
题目链接:戳我 补一张图 我们尝试把圆上的扇形转化成直线上的矩形--我们维护[1,2*m]的区间,那么每个能产生贡献的子区间的长度*第K大的半径的平方的总和就是answer了. 怎么转化呢?左端点为a ...
- Java50道经典习题-程序6 求最大公约数及最小公倍数
题目:输入两个正整数m和n,求其最大公约数和最小公倍数.分析:用辗转相除法求最大公约数 两个数的最大公约数:设两个数分别为n和m,(n>=m);用定义一个变量i,使用for循环,将i的取值 ...