一、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

6、永久关闭
systemctl disable firewalld
# 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;

linux 各种防火墙的更多相关文章

  1. linux关闭防火墙

    查看防火墙状态: sudo service iptables status linux关闭防火墙命令: sudo service iptables stop linux启动防火墙命令: sudo se ...

  2. 写了个Linux包过滤防火墙

    花几天写了个so easy的Linux包过滤防火墙,估计实际意义不是很大.防火墙包括用户态执行程序和内核模块,内核模块完全可以用iptable代替.由于在编写的过程一开始写的是内核模块所以就直接用上来 ...

  3. Linux关闭防火墙、SELinux

    使用root权限: Linux关闭防火墙: 1. chkconfig –list|grep iptables 2. chkconfig iptables off 永久关闭防火墙 3. chkconfi ...

  4. SpringCloud的应用发布(四)vmvare+linux,防火墙和selinux

    一.vmvare网络配置为nat模式 二.vmvare的网络设置为桥接bridge模式 1.linux 网卡的ip获取方式dhcp 三.关闭linux的防火墙和selinux 1.临时关闭防火墙 sy ...

  5. Linux配置防火墙,开启80端口、3306端口

    Linux配置防火墙,开启80端口.3306端口   起因是因为想使用Navicat连接一下数据库,发现连接不上 通过查阅许多资料和多次测试发现是因为防火墙没有配置3306端口 话不多说,开整,同理, ...

  6. Linux firewalld 防火墙

    Linux firewalld 防火墙  简介 RHEL 7 系统中集成了多款防火墙管理工具,其中 firewalld(Dynamic Firewall Manager of Linux system ...

  7. Linux上防火墙开放对应的端口

    在Linux上防火墙开放对应的端口的命令如下: 方式一: [root@localhost sbin]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACC ...

  8. 转:linux关闭防火墙iptables

    ref:https://jingyan.baidu.com/article/066074d64f433ec3c21cb000.html Linux系统下面自带了防火墙iptables,iptables ...

  9. 使用 firewalld 构建 Linux 动态防火墙

    firewalld 是新一 Linux 代防火墙工具,它提供了支持网络 / 防火墙区域 (zone) 定义网络链接以及接口安全等级的动态防火墙管理工具.它也支持允许服务或者应用程序直接添加防火墙规则的 ...

  10. linux设置防火墙

    这样其他主机还是无法访问我们的数据库,linux关闭防火墙,其他主机就可以访问了. 关闭防火墙:/etc/init.d/iptables  stop 开启防火墙:/etc/init.d/iptable ...

随机推荐

  1. 23种设计模式实战:重学Java设计模式

    23种设计模式实战PDF: 链接:https://pan.baidu.com/s/1XfjkBt19G7jZQfwk5wAV3w 提取码:1234

  2. 在 Vercel 部署随机图 API

    在本文中,将详细介绍如何在 Vercel 平台上部署一个具有分类功能的随机图片 API.通过这个 API,用户可以根据不同的分类获取随机图片链接,并且还可以从所有分类中随机获取一张图片. 项目结构 首 ...

  3. ls小技巧

    一.ls -rt ls的功能是列出指定路径下的所有文件,但是有时候文件太多,不方便查找哪些是新生成的文件时,可以使用ls -t或ls -rt命令. ls -t ls -rt 那是什么意思呢?这里-t就 ...

  4. bootwiki-Elasticsearch教程

    https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html Elasticsearch教程 Elasticse ...

  5. biancheng-HBase

    目录http://c.biancheng.net/view/6509.html 1HBase是什么?2HBase的优势有哪些?3Hadoop与HBase的关系4HDFS5HDFS的特点与使用场景6HB ...

  6. Linux基础:用户与用户组

  7. xshell连接服务器无法用password登录,只能用public key的解决办法

    xshell无法用password登录服务器,只能用public key的解决办法 只能用public key登录, 那么我们用阿里云后台的远程连接按钮进入服务器,进入后 修改/etc/ssh/ssh ...

  8. Q:Tomcat使用的jdk版本而不依赖环境变量

    1)在tomcat中显式配置-JVM启动使用内存大小 解决:vim打开tomcat目录下的bin/catalina.sh文件,在文件最上部配置JAVA_OPTS属性. windows下在catalin ...

  9. 关于SpringBoot的测试类中运行时报空指针异常

    1. 首先给出我所遇到的问题源代码 一直会报错 java.lang.NullPointerException: Cannot invoke "com.course.rainngcourseb ...

  10. MacSecureCRT配置

    一.调整连接服务器超时时间 Options->Global Options->General->Default Session-> 右侧Edit Default Setting ...