centos7防火墙使用方法
参考网站:https://blog.csdn.net/achang21/article/details/52538049
添加开放指定端口:
[root@yao bin]# firewall-cmd --zone=public --permanent --add-port=10051/tcp
命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
防火墙重启:
[root@yao bin]# firewall-cmd --reload
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
查看防火墙列表:
[root@yao bin]# firewall-cmd --list-all
删除制定端口:
[root@LinuxS03 ~]# vim /etc/firewalld/zones/public.xml
[root@yao ~]# cat /etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<service name="dhcpv6-client"/>
<service name="ssh"/>
<port protocol="tcp" port="22222"/>
<port protocol="tcp" port="10050"/>
<port protocol="tcp" port="10051"/>
</zone>
iptables -L -n
下面添加对特定端口开放的方法:
使用iptables开放如下端口
/sbin/iptables -I INPUT -p tcp --dport 8000 -j ACCEPT
保存
/etc/rc.d/init.d/iptables save
重启服务
service iptables restart
查看需要打开的端口是否生效?
/etc/init.d/iptables status
法2:
或直接编辑/etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 4000 -j ACCEPT
保存在前面部分
再重启:
service iptables restart
centos7防火墙使用方法的更多相关文章
- Centos7防火墙快速开放端口配置方法
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! Firewalld服务是红帽RHEL7系统中默认的防火墙管理工具,特点是拥有运行时配置与永久配置选 ...
- CentOS7 防火墙(firewall)的操作命令
CentOS7 防火墙(firewall)的操作命令 安装:yum install firewalld 1.firewalld的基本使用 启动: systemctl start firewalld 查 ...
- [转帖]Centos7防火墙配置rich-rule实现IP端口限制访问
Centos7防火墙配置rich-rule实现IP端口限制访问 2019-02-18 18:05:35 sunny05296 阅读数 2143 收藏 更多 分类专栏: Linux 版权声明:本文 ...
- (三) Docker 常用操作与CentOS7 防火墙命令
参考并感谢 Docker 常用命令 https://docs.docker.com/engine/reference/commandline/docker/ Docker 登录docker账户 doc ...
- CentOS7 防火墙设置
CentOS7 防火墙命令 最近在公司服务器上安装了oracle12c数据库,在用数据库客户端连接的时候,连接不了.最后查找资料的原因是因为oracle的服务端口未开放. 首先还是还是输入以往的开启某 ...
- CentOS7防火墙firewalld 和 CentOS6防火墙iptables的一些配置命令
CentOS7 防火墙 一.防火墙的开启.关闭.禁用.查看状态命令 (1)启动防火墙:systemctl start firewalld (2)关闭防火墙:systemctl stop firewal ...
- centos7 防火墙一些相关设置 开机添加静态路由 特殊的方法
参考文献: https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/security_guide/s ...
- Centos6与Centos7防火墙设置与端口开放的方法
Centos升级到7之后,内置的防火墙已经从iptables变成了firewalld.所以,端口的开启还是要从两种情况来说明的,即iptables和firewalld.更多关于CentOs防火墙的最新 ...
- centos 6和centos7关闭防火墙的方法
centos 6 关闭命令: service iptables stop 永久关闭防火墙:chkconfig iptables off 两个命令同时运行,运行完成后查看防火墙关闭状态 ...
随机推荐
- rabbitmq学习(五):springboot整合rabbitmq
一.Springboot对rabbitmq的支持 springboot提供了对rabbitmq的支持,并且大大简化了rabbitmq的相关配置.在springboot中,框架帮我们将不同的交换机划分出 ...
- Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined
遇到问题: Android NDK: jni/Android.mk: Cannot find module with tag 'XXXXXXXXX' in import path Android ND ...
- 初识Tarjan算法
#include<bits/stdc++.h> using namespace std; ; ;//强连通分量的个数 int stk[maxn];//暂时存放遍历过的点,在遇到low[x] ...
- 定时器setTimeout()的传参方法
更具体的代码:http://www.cnblogs.com/3body/p/5416830.html // 由于setTimeout()的延迟执行特性,所以在执行的函数中直接使用外部函数的变量是无法获 ...
- DataFrame 列运算
import pandas as pd import StringIO table_buffer = StringIO.StringIO('''a b 2007-01-08 0.786667 270 ...
- ballerina 学习 三十二 编写安全的程序
ballerina编译器已经集成了部分安全检测,在编译时可以帮助我们生成错误提示,同时ballerina 标准库 已经对于常见漏洞高发的地方做了很好的处理,当我们编写了有安全隐患的代码,编译器就已 ...
- sql server insert values 多值 与oracle 的不同
类似的语句在 oracle 中是不能执行的 insert into temp_tbl values('app'),('demo'); 但是在sql server 中是可以的 insert into c ...
- smarty学习——变量
变量的处理对于模板来说是比较重要的. Smarty有几种不同类型的变量. 变量 的类型取决于它的前缀是什么符号(或者被什么符号包围) Smarty的变量可以直接被输出或者作为函数属性和修饰符(modi ...
- FastAdmin 插件的 Git 开发流程(简明)
FastAdmin 插件的 Git 开发流程(简明) cms zip 安装 包安装 删除 addons 里的 cms 使用 mklink 软链接到 cms 插件 Git 仓库 修改 cms 插件 gi ...
- 查询语句中 select from where group by having order by 的执行顺序
查询中用到的关键词主要包含六个,并且他们的顺序依次为 select--from--where--group by--having--order by 其中 select 和 from 是必须的,其他关 ...