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 配置 作为服务器 用途 ...
随机推荐
- 关于C语言中的Complex(复数类型)和imaginary(虚数类型)
关于C语言中的Complex(复数类型)和imaginary(虚数类型) 其实这里的复数complex就是数学里的复数,包含实部和虚部两个部分,比如:x=2.1+6i,下面进行详细介绍. C99 新增 ...
- sublime填坑之旅: 格式代码, 缩进缩进
前言:sublime是一款编程神器,轻巧又强大,适用于各种语言.这里介绍下如何快速缩进混乱代码,方便代码阅读. 原料:sublime text 3 1 混乱代码如下: 2 格式菜单选择: 英文: 菜 ...
- 原型模式及C++实现
以下是我自己学习设计模式的感想. 原型模式 学过C++的都知道拷贝构造函数,复制一个对象分为浅拷贝和深拷贝. 浅拷贝:就是给对象中的每个成员变量进行复制,就是把A1类中的变量直接赋给A2类中变量,属于 ...
- 20155334 2016-2017-2 《Java程序设计》第六周学习总结
20155334 2016-2017-2 <Java程序设计>第六周学习总结 教材学习内容总结 第十章:输入/输出 InputStream与OutputStream java将输入/输出抽 ...
- 我的"gethup"(GitHub)注册之旅
大家好,我叫张琪琪,来自网络工程143(学号1413042062),.平时喜欢运动,也喜欢看电视尤其是动漫.其实对于自己的编程能力没有多大自信,如果看着题目回忆课本内容写下的程序也算的话,那是敲过不少 ...
- centos 虚拟机中修改屏幕分辨率
1.$ vi /boot/grub/grub.conf(路径可能会不一样,也可以是 /etc/grub.conf),打开grub.conf文件 2.我们修改分辨率,需要在kernel那行加入 vga= ...
- Javascript设计模式理论与实战:组合模式
我们平时开发过程中,一定会遇到这种情况:同时处理简单对象和由简单对象组成的复杂对象,这些简单对象和复杂对象会组合成树形结构,在客户端对其处理的时候要保持一致性.比如电商网站中的产品订单,每一张产品订单 ...
- selenium + PhantomJS 爬取js页面
from selenium import webdriver import time _url="http://xxxxxxxx.com" driver = webdriver.P ...
- 多彩浏览器win10版 隐私声明
(一)隐私保护 the app need internet access,we won't need your private information, in other words, your i ...
- Android 载入 HTML
Android 中载入 HTML 有两种方式: 1. 用 TextView.setText(Html.fromHtml("<html></html>")); ...