(linux笔记)开放防火墙端口
关闭防火墙
CentOS 7、RedHat 7 之前的 Linux 发行版防火墙开启和关闭( iptables ):
- 即时生效,重启失效
#开启
service iptables start
#关闭
service iptables stop
- 重启生效
chkconfig iptables on
#关闭
chkconfig iptables off
CentOS 7、RedHat 7 之后的 Linux 发行版防火墙开启和关闭( firewall )
systemctl stop firewalld.service
开放端口
CentOS 7、RedHat 7 之前的 Linux 发行版开放端口:
#查看开放的端口列表
firewall-cmd --list-ports #命令方式开放5212端口命令
#开启5212端口接收数据
/sbin/iptables -I INPUT -p tcp --dport 5212 -j ACCEPT #开启5212端口发送数据
/sbin/iptables -I OUTPUT -p tcp --dport 5212 -j ACCEPT #保存配置
/etc/rc.d/init.d/iptables save #重启防火墙服务
/etc/rc.d/init.d/iptables restart #查看是否开启成功
/etc/init.d/iptables statusCentOS 7、RedHat 7 之后的 Linux 发行版开放端口:
firewall-cmd --zone=public --add-port=5121/tcp --permanent
# --zone 作用域
# --add-port=5121/tcp 添加端口,格式为:端口/通讯协议
# --permanent 永久生效,没有此参数重启后失效
firewall-cmd --reload
使用iptables
- iptables 的安装
系统默认使用 firewall 作为防火墙,把他停止和屏蔽,并且装一个iptable【CentOs 7 】
systemctl stop firewalld
systemctl mask firewalld
yum install -y iptables
yum install iptables-services
升级iptables
yum update iptables
yum update iptables-services
解除禁止 iptables 服务
systemctl enable iptables
开启服务
systemctl start iptables.service
配置 /etc/sysconfig 下的 iptables 文件[vim /etc/sysconfig/iptables]
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3000 -j ACCEPT
重启防火墙使配置生效
systemctl restart iptables.service设置防火墙为开机启动
systemctl enable iptabls.service
检查是否安装了 iptables
service iptables status
其它命令
systemctl start iptables //开启/暂停服务
systemctl stop iptables // systemctl disable iptables //禁止/解除禁止 iptables 服务
systemctl enable iptables
转:https://www.cnblogs.com/jjxhp/p/11111898.html
参考:https://www.cnblogs.com/marso/archive/2018/01/06/8214927.html
(linux笔记)开放防火墙端口的更多相关文章
- linux - centos7 开放防火墙端口的新方式
CentOS 升级到7之后,发现无法使用iptables控制Linuxs的端口, google之后发现Centos 7使用firewalld代替了原来的iptables. 下面记录如何使用firewa ...
- Linux下开放防火墙端口
方法一:1.vi /etc/sysconfig/iptables 2.-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEP ...
- linux 安装禅道 和 CentOS 7 开放防火墙端口 命令
linux 安装禅道链接: https://www.cnblogs.com/maohuidong/p/9750202.html CentOS 7 开放防火墙端口 命令 链接:https://www. ...
- Linux 7.x 防火墙&端口
Linux 7.x 防火墙&端口 查看当前防火墙的状态: # firewall-cmd --state 也可以使用指令:systemctl status firewall.service 启动 ...
- CentOS 7 开放防火墙端口
我:最近在使 CentOS 7时发现在本地不能访问linux上8080端口,以上是我的操作,修改后访问成功 CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现 ...
- Linux系统 开通防火墙端口
Redhat 7内核 Linux系统 开通防火墙端口 使用systemctl 1.查看防火墙状态,root用户登录,执行命令systemctl status firewalld 2.开启防火墙:sy ...
- CentOS 7 开放防火墙端口命令
CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...
- CentOS 7 开放防火墙端口 命令(转载)
CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...
- linux suse系统防火墙端口开放配置
1.切换到root用户下 2.进入到/etc/sysconfig/SuSEfirewall2 3.修改FW_SERVICES_EXT_TCP=" 22 80 8080 8081 8082 8 ...
- 【linux】如何开放防火墙端口
linux默认大部分端口的是关闭的.而我们在开发.部署环境时,需要用到大量的服务,如mysql.tomcat.redis.zk等,需要开放指定的端口号. 以mysql端口3306为例 首先编辑服务器的 ...
随机推荐
- 京准GPS北斗卫星时钟同步系统投运国电内蒙古晶阳能源有限公司
京准GPS北斗卫星时钟同步系统投运国电内蒙古晶阳能源有限公司 2020年1月初期,我京准科技生产研发的GPS北斗卫星时钟同步系统投运国电内蒙古晶阳能源有限公司,为该单位的能源管理系统及其他各业务子系 ...
- nestjs mongoose关联查询
nestjs,mongoose关联查询网上搜不到了,查看了nest/mongoose.d.ts文件,分享一波 user.model.ts import { Prop, Schema, SchemaFa ...
- 数字图像处理 day1
第一节 什么是图像 f(x y z λ t)z 立体 入 彩色 t 活动 f(x y) 静止的 单色 二值图像 黑白图像 灰度图像 彩色图像 点云图像 多光谱图像 我的理解是 建 ...
- 关于idea2021.1版本的左边不显示bpmn Editor的问题
我这里是自定义主题风格出现的问题 idea左上角File→选择setting→找到Color Scheme菜单,将主题颜色改为IntelliJ Light.在重启idea就好
- Drift Programming | 漂移编程 | 哲学编程 | 架构设计 | TDD |DDD |Microservice
- Influxdb客户端使用
Influxdb客户端使用 1. 简介 Influxdb在网络上可以搜索到一个叫InfluxdbStudio的工具,但只能在window下使用,有时在其他系统下做简单数据查询时就比较麻烦,下面以Inf ...
- 由Restart()想到的
官方文档: Application.Restart Method (System.Windows.Forms) | Microsoft Docs 目录 Restart 探索 结论 启示 Restart ...
- 网络-6 IPV6(上)
一.iPv4与ipv6对比 1.ipv4与ipv6优缺点 1.1 Ipv4与ipv6对比,ipv4中的切片使用的三个字段:identification flags fragment offse ...
- 阿里云IPSec的一些问题
1.阿里云IPSec无法进行多段连接单个IPSec连接 解决方案 在阿里云端需要如下操作 1.单个VPN网关下创建多个IPSec连接 连接属性一致 使用兴趣流模式.打开nat转换. 2段对2段 ...
- Linux上面配置Apache2支持Https(ssl)具体方案实现
虽然Nginx比较流行,但是由于一些老项目用到了Apache2来支持Web服务,最近想给服务上一个Https支持,虽然看似教程简单,但是也遇到一些特殊情况,经历了一番折腾也算是解决了所有问题,将过程记 ...