linux查看防火墙
CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前的版本Centos 6.x使用iptables不一样
一、iptables防火墙
1、基本操作
查看防火墙状态
service iptables status
停止防火墙
service iptables stop
启动防火墙
service iptables start
重启防火墙
service iptables restart
永久关闭防火墙
chkconfig iptables off
永久关闭后重启
chkconfig iptables on
2、开启80端口
vim /etc/sysconfig/iptables
加入如下代码
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
保存退出后重启防火墙
service iptables restart
二、firewall防火墙
1、查看firewall服务状态
systemctl status firewalld
出现Active: active (running)切高亮显示则表示是启动状态。
出现 Active: inactive (dead)灰色表示停止,看单词也行。
2、查看firewall的状态
firewall-cmd --state
3、开启、重启、关闭、firewalld.service服务
开启
service firewalld start
重启
service firewalld restart
关闭
service firewalld stop
4、查看防火墙规则
firewall-cmd --list-all
5、查询、开放、关闭端口
查询端口是否开放
firewall-cmd --query-port=8080/tcp
开放80端口
firewall-cmd --permanent --add-port=80/tcp
移除端口
firewall-cmd --permanent --remove-port=8080/tcp
#重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload
参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、–permanent:表示设置为持久;
3、–add-port:标识添加的端口;
CentOS7 默认使用firewalld防火墙,如果想换回iptables防火墙,可关闭firewalld并安装iptables。
1、关闭firewall:
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
firewall-cmd --state
2.安装iptables-services
yum install iptables-services
3.修改防火墙配置文件
vi /etc/sysconfig/iptables
默认的文件为:
在修改之前使用telnet命令查看端口是否开放。
1.启动telnet。控制面板–>程序和功能–>打开或关闭windows功能–>勾选Telnet的两个选项。
2.打开cmd窗口,输入telnet,如果端口关闭或者无法连接,则显示不能打开到主机的链接,链接失败;端口打开的情况下,链接成功,则进入telnet页面(全黑的),证明端口可用。
(1)telnet IP 端口。
(2)telnet 域名 端口。
如果成功连接会进入的界面
连接失败
添加端口80、8080、3306、3690端口:
esc :wq! 退出保存修改。
注意:添加在端口22上面或者下面,不要放在最后,不然不起作用。
4.重启防火墙使配置生效
systemctl restart iptables.service
刚刚yum install iptables.service之后系统如果没有重启,iptables.service是找不到的,会报unit not fount。耽误时间的小坑!
设置防火墙开机启动:
systemctl enable iptables.service
linux查看防火墙相关推荐
- linux检查防火墙是否阻挡端口,浅析linux查看防火墙状态和对外开放的端口状态...
1.查看防火墙状态 查看防火墙状态 systemctl status firewalld 开启防火墙 systemctl start firewalld 关闭防火墙 systemctl stop fi ...
- linux查看防火墙进程,linux怎么查看防火墙是否开启并清除防火墙规则?
iptables是linux下的防火墙组件服务,相对于windows防火墙而言拥有更加强大的功能,下面我们就来看看linux系统中关于iptables的一般常见操作,判断linux系统是否启用了ipt ...
- Linux查看防火墙状态及开启关闭命令
Linux查看防火墙状态及开启关闭命令 CentOS7 使用firewalld开启关闭防火墙与端口 systemctl 配置firewalld-cmd iptables CentOS6 Ubuntu ...
- linux防火墙有几种状态,linux查看防火墙状态的方法有哪些
linux查看防火墙状态的方法:1.iptables防火墙,查看防火墙状态,代码为[service iptables status]:2.firewall防火墙,代码为[firewall-cmd -- ...
- linux查看防火墙装填,linux 查看防火墙状态
1.查看防火墙状态 systemctl status firewalld firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running) 2 ...
- linux查看防火墙有没关闭了,linux查看防火墙是否关闭的实例方法
linux查看防火墙是否关闭的实例方法 一.service方式 查看防火墙状态: [root@centos6 ~]# service iptables status iptables:未运行防火墙. ...
- linux服务器查看防火墙是否关闭,linux查看防火墙是否关闭了的方法
linux查看防火墙是否关闭了的方法 发布时间:2020-04-02 10:49:28 来源:亿速云 阅读:62 作者:小新 今天小编给大家分享的是linux查看防火墙是否关闭了的方法,很多人都不太了 ...
- linux 查看防火墙对应的进程,Linux系统防火墙进程查看的实用方法
Linux系统防火墙进程查看的实用方法 作者 HonestQiao 2008年03月17日 16:00 启动防火墙 1) 重启后生效 开启: chkconfig iptables on 关闭: chk ...
- linux查看防火墙状态
一.iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service ...
最新文章
- DHCP服务器的搭建
- 第一章 初识Mysql
- 关于在linux下搭建VSFTP下匿名不能上传的问题
- VTK:Points之ExtractSurfaceDemo
- mysql 读写分离 ,mysql_proxy实现
- vue.jsr入门_JSR-308和Checker框架为jOOQ 3.9添加了更多类型安全性
- 他人的一些2017年度总结
- LeetCode MySQL 1126. 查询活跃业务
- ISTQB高级-测试经理国际认证试题及答案(二)
- SQL Server中查询存储的用例
- python相等的表达式_02-python-运算符与表达式
- ncbi查找目的基因序列_献给初学者:如何使用 NCBI 查找基因序列、mRNA、Promoter...
- 很牛的求职经历(转载)
- 13、图灵机器人能力
- CISP 考试教材《第 5 章 知识域:安全工程与运营》知识整理
- MySQL子查询,多表查询
- python深浅拷贝应用_Python深浅拷贝以及应用场景
- SQLI DUMB SERIES-2
- printf中的%f
- IP-guard桌面终端安全解决方案
热门文章
- 产品技术方案范例_紫光展锐推 85Hz 高刷护眼墨水屏技术方案,首款产品将于 6 月面市...
- 智能手机的折戟战:小米魅族向下、荣耀向上
- Linux时间管理(三) GTOD
- 如何开启python编程?
- 工业物联网在智能制造业的主要用途与优势
- jQuery阻止冒泡事件和默认事件
- Java中Map集合的特点
- [含文档+源码等]基于SSM实现的宿舍公共财产管理系统|寝室
- 阿衰java免费版_flutter plugin之路:flutter与原生交互传值OC/java版(一)
- 抽象工厂模式,工厂方法模式区别