CentOS7使用firewalld防火墙
firewalld的基本使用
systemctl
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
配置firewalld-cmd
查看有哪些服务已经在列表中允许通过:
firewall-cmd --list-services
添加服务
firewall-cmd --permanent --add-service openvpn (--permanent永久生效,没有此参数重启后失效)
firewalld对指定IP开放指定端口的配置
允许192.168.142.166访问5432端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="" accept"
删除规则
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="5432" accept"
重新加载配置文件
firewall-cmd --reload
firewalld 配置转发
firewall-cmd --zone=inernal --change-interface=eno2
firewall-cmd --zone=internal --change-interface=eno2
firewall-cmd --zone=public --add-forward-port=port=:proto=tcp:toport=:toaddr=192.168.224.5 --permanent
firewall-cmd --zone=public --add-forward-port=port=:proto=tcp:toport=:toaddr=192.168.224.5 --permanent
firewall-cmd --zone=public --add-forward-port=port=:proto=tcp:toport=:toaddr=192.168.224.5 --permanent
firewall-cmd --zone=public --add-forward-port=port=:proto=tcp:toport=:toaddr=192.168.224.5 --permanent
firewall-cmd --zone=public --add-forward-port=port=:proto=tcp:toport=:toaddr=192.168.224.5 --permanent
firewall-cmd --zone=public --add-forward-port=port=:proto=tcp:toport=:toaddr=192.168.224.5 --permanent
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --zone=internal --add-masquerade --permanent
firewall-cmd --reload
firewall-cmd --list-all-zones
NET转发,firewalld实现内网访问外网
应用场景:机房服务器里一些没有外网IP的,通过跳板机上网。
服务端,使用firewalld防火墙实现nat路由转发
systemctl start firewalld.service #关闭其他防火墙,然后开启firewalld
firewall-cmd --add-masquerade --permanent #内部主机依靠firewalld转发上网
firewall-cmd --reload #生效
客户端,修改网关为跳板机内网IP
vim /etc/sysconfig/network-scripts/ifcfg-em2
IPADDR=192.168.224.22
NETMASK=255.255.255.0
GATEWAY=192.168.224.9
DNS1=8.8.8.8
ZONE=internal # 重启网卡
ifdown em2 && ifup em2 # 测试
ping www.baidu.com
CentOS7使用firewalld防火墙的更多相关文章
- CentOS7使用firewalld防火墙配置端口
安装启用firewalld防火墙 CentOS7默认的防火墙是firewalld 如果没有firewalld防火墙,可以执行yum install firewalld 命令进行安装 firewalld ...
- centos7之firewalld防火墙的配置与使用
firewalld是centos7开始提供的管理防火墙工具,提供了一个动态管理的防火墙,当然低层仍然调用的是 netfilter . 一.区域(zone)firewalld将网卡对应到不同的区域(zo ...
- Centos7下Firewalld防火墙配置命令
前 言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态 1 systemctl status firewalld 开机启用/禁用防火墙 1 s ...
- Centos7 iptables firewalld防火墙与selinux配置
一.iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service ...
- Centos7.5 firewalld防火墙配置
CentOS 7.0默认使用的是firewall作为防火墙 1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-c ...
- CentOS 7 打开关闭FirewallD防火墙端口命令
CentOS 7 使用firewalld代替了原来的iptables,使用方法如下: >>>关闭防火墙 systemctl stop firewalld.service ...
- CentOS7使用firewalld打开关闭防火墙与端口(转载)
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...
- CentOS7、REHL7的firewalld防火墙使用简单说明
title: CentOS7.REHL7的firewalld防火墙使用简单说明 categories: Linux tags: - Linux timezone: Asia/Shanghai date ...
- 关于学习CentOS7使用firewalld打开关闭防火墙和端口
1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...
随机推荐
- 概率分布的 perplexity
1. 一种 measurement 信息论中,perplexity is a measurement of how well a probability distribution or probabi ...
- Rust 2017 调查报告:学习曲线是最大痛点(最大的问题是这门语言太偏底层了,现在做底层的少了。还有C这个绕不过去的存在)
Rust 官方在社区上做了一次调查,以了解用户如何看待 Rust 的发展.调查共收到 5368 份回复,其中有 大约 2/3 的是 Rust 用户,剩下的 1/3 是非 Rust 用户,调查结果如下. ...
- Http请求格式(在Linux下使用telnet亲测,通过这篇我才明白)
命令行窗口中用telnet测试HTTP协议请求消息格式响应消息格式1. 命令行窗口中用telnet测试HTTP协议 HTTP消息是由普通ASCII文本组成.消息包括消息头和数据体部分.消息头以行为单位 ...
- Matlab随笔之三维图形绘制
1.三维曲线 用到了plot3函数.plot3(x,y,z)用来绘制3维曲线图,而不能绘制曲面图!就是把所有的(x,y,z)点连接在一起. t=linspace(,*pi,); x=sin(t); y ...
- C#控制台关闭之前做一些操作
using System; using System.Runtime.InteropServices; class Program { static void Main(string[] args) ...
- glibc头文件和宏定义
头文件没啥好说的,无非就是" "和< >的区别,这估计只要是学过C/C++的人都明白.现在的编译器对头文件的包含顺序没有要求,但老的C实现则不一样.当然,我们现在无需关 ...
- jquery 表格练习
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...
- 关于WPF后台触发键盘按键
1.变向响应Tab按键 private void Grid_KeyUp(object sender, KeyEventArgs e) { UIElement e ...
- 写给非专业人士看的 *** 简介(同时也解释了GFW )
写给非专业人士看的 *** 简介 这个文章来源于一个朋友在***的过程中,搞不清楚 *** 的配置问题,在这里我想按照我对 *** 的理解简单梳理一下,以便一些非专业人士也能了解 long long ...
- 【转】在C#中简单的科学计算,包括幂数,指数,对数,Math类
用Math类进行一些简单的科学计算,包括幂数,指数,对数等的计算: double m,n; m=Math.Exp(0.5); //自然对数e的0.5次方 n=Math.Exp(); //自然对数e的3 ...