(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为例 首先编辑服务器的 ...
随机推荐
- Jest - Using test function to test the function
Note: Please check the prev blog to see the jest configuration. calculator.js const plus = (a, b) =& ...
- element table 表格嵌套
/////////////////////////// 代码如下 <template> <div class="report-forms-page"> & ...
- PYTHON中的CONCURRENT.FUTURES模块
一 : 概述 concurrent.futures模块提供了高度封装的异步调用接口 ThreadPoolExecutor:线程池,提供异步调用 ProcessPoolExecutor: 进程池,提供异 ...
- 基于北斗gps设计的NTP网络时间服务器
基于北斗gps设计的NTP网络时间服务器 基于北斗gps设计的NTP网络时间服务器 京准电子科技官微--ahjzsz 随着5G等新型基础设施持续建设和发展,在未来万物互联的庞大信息网络中,跨路由节点之 ...
- andriod升级保错问题归类
https://developer.aliyun.com/article/1116339 https://www.jianshu.com/p/5d9c790ab958 https://blog.51c ...
- Django中的app模型细节TypeError: __init__() missing 1 required positional argument: 'on_delete' 解决办法
TypeError: init() missing 1 required positional argument: 'on_delete' 解决办法 当执行应用app模型迁移时: python man ...
- nginx(二) の 配置静态资源网站
首先在开始配置前,要想明白,nginx 配置 静态资源 服务时基本逻辑,其实就是要 将路由地址与服务器中文件真实的存储地址进行映射. 配置静态资源样例 配置前,首先要将当前配置文件的路径,写入到 ng ...
- 在axios拦截器js文件中无法使用vue-router问题
如果在axios设置拦截器的js文件或者说在vue-router路由配置文件,配置好的路由文件以外的js文件中使用 import {useRouter} from 'vue-router' 系统不会默 ...
- 1067- invalid default value for ""
创建表时报的,一个时间字段类型是datetime,一保存就报错,网上说是datetime类型只支持mysql 5.6.5+,我看了下我的版本,5.8的,没什么问题,然后找了许久找到了错误的地方. 很蠢 ...
- SQLSERVER判断是否为数字ISNUMERIC
从SQLSERVER 2005新增isnumeric函数,返回1则字符串是数值,返回0则认为不是数值 但里面有些其他的字符也返回1,不知道是怎么个思路,是不是花旗国的规则? SELECT ISNUME ...