linux(centos7)防火墙配置firewalld和iptables
linux系统中防火墙管理有2种方式,分别是iptables和firewalld(centos7.x),下面介绍centos7的配置方法
一、firewalld:
因为cenos7默认使用firewalld作为防火墙管理,这里先介绍firewalld方式:
教程只说明特殊情况(卸载Firewall并安装iptables后重新安装回Firewall),其他情况比如默认的,没有装过iptables(从步骤4或7开始)都包含其中:
1. 首先停止和禁用iptables:
systemctl stop iptables && systemctl disable iptables
2.
systemctl unmask firewalld.service
3.
yum install firewalld
4.
systemctl start firewalld.service
5.
systemctl enable firewalld.service
6. 在不改变状态的条件下重新加载防火墙
firewall-cmd --reload
7. 开启某个端口(可以范围开启如:xxxadd-port=8080-8088/tcp)
firewall-cmd --permanent --zone=public --add-port=8080/tcp
8. 修改配置后需要重启服务使其生效
systemctl restart firewalld.service
9. 如果不生效可重启系统生效
reboot
注:
查看开启的端口和服务
firewall-cmd --permanent --zone=public --list-services //服务空格隔开 例如 dhcpv6-client https ss
firewall-cmd --permanent --zone=public --list-ports //端口空格隔开 例如 8080-8081/tcp 8388/tcp 80/tcp
查看某个端口是否生效
firewall-cmd --zone=public --query-port=8080/tcp //查看服务是否生效(例:添加的端口为8080)
参考:https://blog.csdn.net/Joe68227597/article/details/75207859
二、itables:
--关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
--安装安装iptables防火墙
yum install iptables-services #安装
--清空已有的规则:
iptables -F
iptables -X
iptables -Z
--开放特定的端口,以80为例
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
--保存配置
service iptables save
--重启
systemctl restart iptables.service
--设置开机自启动
systemctl enable iptables.service
--重启系统使其生效
linux(centos7)防火墙配置firewalld和iptables的更多相关文章
- [转帖]Centos7防火墙配置rich-rule实现IP端口限制访问
Centos7防火墙配置rich-rule实现IP端口限制访问 2019-02-18 18:05:35 sunny05296 阅读数 2143 收藏 更多 分类专栏: Linux 版权声明:本文 ...
- Linux(CentOS7)下配置多个tomcat
记录 Linux(CentOS7) 下配置多个 tomcat 的操作过程. 一.下载tomcat 前提:安装配置好jdk环境,未配置可参考Linux(CentOS7)下安装jdk1.8. 从 tomc ...
- Linux CentOS7 安装配置 IPtables
2021-08-11 1. 前言 防火墙其实就是实现 Linux 下访问控制功能的,分为硬件和软件的防火墙两种类型.无论在何网络中,防火墙工作的地方一定是网络的边缘.防火墙的策略.规则就是去定义防火墙 ...
- CentOS7 防火墙配置firewall-cmd
firewalld(Dynamic Firewall Manager of Linux systems,Linux系统的动态防火墙管理器)服务是默认的防火墙配置管理工具. firewall-cmd 是 ...
- CentOS7防火墙管理firewalld
学习apache安装的时候需要打开80端口,由于centos 7版本以后默认使用firewalld后,网上关于iptables的设置方法已经不管用了,想着反正iptable也不太熟悉,索性直接搬官方文 ...
- CentOS7 防火墙配置(关闭)
CentOS7 的防火墙配置跟曾经版本号有非常大差别,经过大量尝试,最终找到解决这个问题的关键 CentOS7这个版本号的防火墙默认使用的是firewall.与之前的版本号使用iptables不一样. ...
- Centos7 防火墙关闭和启用iptables防火墙
操作系统环境:CentOS Linux release 7.0.1406(Core) 64位CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭f ...
- CentOS7 防火墙配置-详解
CentOS 7 防火墙配置 1.防火墙的简述 防火墙对服务器起到一定的保护作用,所以了解一些相关的操作是很有必要的. 在CentOS 7.x中,有了一种新的防火墙策略叫FireWall , 在6.x ...
- Centos7防火墙关闭和启用iptables操作
https://yq.aliyun.com/ziliao/33590前序 还是docker惹得最近做的系统都是上的centos7的系统带来的一系列的新环境的适应 补记下:在使用oracle vmbox ...
随机推荐
- LeetCode: Triangle 解题报告
Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to a ...
- JSP怎么将表单提交到对应的servlet
昨天学习了这些内容,今天做一下分享吧,个人感觉挺乱的....呵呵,其实没事,慢慢就好了.难的不会,会的不难嘛!努力+认真就可以了,相信大家都可以的!加油!!! 下面的图是我用myeclipse建立的项 ...
- [转]基于BootStrap 的城市三级联动
原文地址:https://blog.csdn.net/peiyuanxin/article/details/51992384 HTML代码部分 <div class="form- ...
- 25个必须记住的SSH命令【转】
OpenSSH是SSH连接工具的免费版本.telnet,rlogin和ftp用户可能还没意识到他们在互联网上传输的密码是未加密的,但SSH是加密的,OpenSSH加密所有通信(包括密码),有效消除了窃 ...
- IDEA无法启动debugger,报错Address localhost:1099 is already in use
Address localhost:1099 is already in use http://blog.csdn.net/huazhongkejidaxuezpp/article/details/4 ...
- am335x Lan8710a 双网口配置
一. 经过调试, LAN8710A在 am335x 上面需要使用 GMII的模式,设备树 pin mux配置如下: // 下面是工作模式的配置,在睡眠模式下是配成GPIO模式 162 cpsw_def ...
- iPad适合写作吗
我一直感觉对着电脑不利于思考,当需要纯粹的思考时,我习惯让视线离开屏幕,起身走动两圈,再用纸和笔整理思路,想清楚后,开始动手编码. 双手端着iPad时,似乎也能有类似纸与笔的组合效果,大脑能适应那种界 ...
- rfid 125khz
环境是STVD V4.1.6, 编译器是COSMIC STM8 C Compiler 16K ,Version: 4.3.1 调用的库有:GPIO,TIM2 相关宏定义: //RF数据引脚 #defi ...
- linux下查看cpu物理个数和逻辑个数
hadoop@chw-desktop3:~$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 ...
- Microsoft.AspNet.Identity.EntityFramework/IdentityDbContext.cs
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; ...