centos7防火墙配置
一、在工作中远程连接经常通过堡垒机连接,不能直接开启防火墙。所以就需要写入配置文件中
编译配置文件 /etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<service name="dhcpv6-client"/>
<service name="ssh"/>
<port protocol="tcp" port="80"/>
<port protocol="tcp" port="22"/>
<rule family="ipv4">
<source address="172.21.0.16"/>
<port protocol="tcp" port="3306"/>
<accept/>
</rule>
</zone>
注释:
#开启端口 <port protocol="tcp" port="443"/>
<port protocol="tcp" port="80"/>
<port protocol="tcp" port="22"/> #开启ip+端口
<rule family="ipv4">
<source address="172.21.0.16"/>
<port protocol="tcp" port="3306"/>
<accept/>
</rule>
最后重启防火墙就可以了
systemctl restart firewalld.service #查看规则
[root@VM_0_14_centos html]# firewall-cmd --list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: dhcpv6-client ssh
ports: 80/tcp 22/tcp
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
rule family="ipv4" source address="172.21.0.16" port port="3306" protocol="tcp" accept
二、最主要的ssh端口用配置文件写其他规则就无所谓了!
命令直接写规则
#永久开启9090端口
firewall-cmd --zone=public --add-port=9090/tcp --permanent #Postgresql端口设置。允许192.168.142.166访问5432端口 firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.27.0.2" port protocol="tcp" port="1521" accept"
centos7防火墙配置的更多相关文章
- [转帖]Centos7防火墙配置rich-rule实现IP端口限制访问
Centos7防火墙配置rich-rule实现IP端口限制访问 2019-02-18 18:05:35 sunny05296 阅读数 2143 收藏 更多 分类专栏: Linux 版权声明:本文 ...
- CentOS7 防火墙配置(关闭)
CentOS7 的防火墙配置跟曾经版本号有非常大差别,经过大量尝试,最终找到解决这个问题的关键 CentOS7这个版本号的防火墙默认使用的是firewall.与之前的版本号使用iptables不一样. ...
- CentOS7 防火墙配置-详解
CentOS 7 防火墙配置 1.防火墙的简述 防火墙对服务器起到一定的保护作用,所以了解一些相关的操作是很有必要的. 在CentOS 7.x中,有了一种新的防火墙策略叫FireWall , 在6.x ...
- centos7 防火墙配置
firewall-cmd --zone=public --add-port=80/tcp --permanentfirewall-cmd --zone=public --add-port=8080/t ...
- CentOS7 防火墙配置firewall-cmd
firewalld(Dynamic Firewall Manager of Linux systems,Linux系统的动态防火墙管理器)服务是默认的防火墙配置管理工具. firewall-cmd 是 ...
- centos7 防火墙 配置
1.查看Firewall 服务状态 systemctl status firewalld 2.查看Firewall 的状态 firewall-cmd --state 注意: firewalld默认配置 ...
- CentOS7下Firewall防火墙配置用法详解
官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...
- Centos7防火墙快速开放端口配置方法
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! Firewalld服务是红帽RHEL7系统中默认的防火墙管理工具,特点是拥有运行时配置与永久配置选 ...
- Centos7 防火墙常用配置及说明
一. Centos7和Centos6 防火墙的区别: 使用的工具不一样了.Centos6 使用的是iptables ,Centos7 使用的是filewall iptables 用于过滤数据包,属于网 ...
随机推荐
- TinyMCE
段落段落段落段落 标题1 标题2 标题3 标题4 标题5 标题6
- CentOS Android Studio桌面图标的创建
1.切换到root用户,在桌面上创建Android.Studio.desktop,如下: [Desktop Entry] Name=Android Studio Comment=Android Stu ...
- IE8引用jQuery报$或者jQuery未定义
最近公司做的项目要求兼容到IE8,结果在页面调试的时候出了个bug,在IE8上面一直报错$未定义,或者jQuery未定义,导致页面上面写的jQuery全部失效,在Chrome浏览器没有任何问题.很是头 ...
- 一场由like引发的事故
故事背景: 有一张用户级表,数据量在千万级别,而运营人员要查看这张表,其中有一项查询条件为根据“错误类型”(单值)查出所有包含这个类型的数据,而这个数据类型在数据库存放的方式类似于 “1,2,3,4, ...
- JAVA BigDecimal 用法
一.BigDecimal 的加减乘除 BigDecimal bignum1 = new BigDecimal("10"); BigDecimal bignum2 = new Big ...
- ansible-mysql
ansible mysql -m command -a "yum -y install https://www.percona.com/downloads/percona-monitorin ...
- .net core 接口返回图片并且进行压缩
背景: .net core 中默认已经取消可以直接访问图片,因为这样不安全. 导致我们上传的图片无法直接通过url访问. 解决方案: 一: 通过修改项目配置,使可以直接通过url访问.(方法略,可 ...
- Linux网络技术管理及进程管理
OSI七层模型和TCP/IP四层模型 OSI七层模型:OSI(Open System Interconnection)开放系统互连参考模型是国际标准化组织(ISO)制定的一个用于计算机或通信系统间互联 ...
- [FJWC2018]全排列
题解: 考虑长度为k的时候的贡献 即取出一些元素然后给他们排个顺序然后问你有多少排法 假设排法为ans 那么应该就是$C(n,k)*C(n,k)*(n-k)!*(n-k)!*(n-k+1)*ans$ ...
- 从外面更新unity需要用的题库
unity中必须要有Plugins文件夹以及dll文件官方dll文件下载链接: https://archive.codeplex.com/?p=exceldatareader using System ...