Centos7防火墙常用命令
有些人安装的linux的系统默认防火墙不是iptables,而是firewall,那就得使用以下方式关闭防火墙了。
>>>关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
>>>开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令含义
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
>>>重启防火墙
firewall-cmd --reload
其他常用命令:
firewall-cmd --state ##查看防火墙状态,是否是running
firewall-cmd --reload ##重新载入配置,比如添加规则之后,需要执行此命令
firewall-cmd --get-zones ##列出支持的zone
firewall-cmd --get-services ##列出支持的服务,在列表中的服务是放行的
firewall-cmd --query-service ftp ##查看ftp服务是否支持,返回yes或者no
firewall-cmd --add-service=ftp ##临时开放ftp服务
firewall-cmd --add-service=ftp --permanent ##永久开放ftp服务
firewall-cmd --remove-service=ftp --permanent ##永久移除ftp服务
firewall-cmd --add-port=80/tcp --permanent ##永久添加80端口
iptables -L -n ##查看规则,这个命令是和iptables的相同的
man firewall-cmd ##查看帮助
更多命令,使用 firewall-cmd --help 查看帮助文件
>>> CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下
1、直接关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、设置 iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙端口3306
vi /etc/sysconfig/iptables
增加规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
保存退出后
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
Centos7防火墙常用命令的更多相关文章
- Centos7防火墙常用命令及mask锁定不能添加端口问题
一.开放端口 sudo firewall-cmd --zone=public --add-port=3000/tcp --permanent sudo firewall-cmd --reload 二. ...
- Centos7 防火墙常用命令 开启 关闭防火墙
如果你的系统上没有安装使用命令安装 #yum install firewalld //安装firewalld 防火墙 开启服务 # systemctl start firewalld.service ...
- linux下防火墙开启某个端口号及防火墙常用命令使用
linux防火墙常用命令 1.永久性生效,重启后不会复原 开启:chkconfigiptables on 关闭:chkconfigiptables off 2.即时生效,重启后复原 重启防火墙 方式一 ...
- 【CentOS7】常用命令
[CentOS7]常用命令 转载:https://www.cnblogs.com/yangchongxing/p/10646640.html 目录 ========================== ...
- Centos7 防火墙常用配置及说明
一. Centos7和Centos6 防火墙的区别: 使用的工具不一样了.Centos6 使用的是iptables ,Centos7 使用的是filewall iptables 用于过滤数据包,属于网 ...
- iptables防火墙常用命令
iptables防火墙启动停止和基本操作 iptables是centos7之前常用的防火墙,在centos7上使用了firewall 防火墙基本操作: # 查询防火墙状态 service iptabl ...
- Fortigate防火墙常用命令
命令结构 #config 对策略,对象等进行配置 #get 查看相关对象的参数 #show 查看配置文件 #diagnose 诊断命令 #execute 常用的工具命令,如ping treacer ...
- centos6和centos7中常用命令区别
以前一直接触的是centos6,最近因为新项目接触到centos7,发现有些命令还是有差异的(从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig),现 ...
- CentOS7.5常用命令
常用命令: 关机shutdown -h now 参数:重启-r定时-r 23:59 分-r 10 查源软件yum list |grep telnet参数:安装install 服务启动systemctl ...
随机推荐
- linux命令之 repeat 重复执行命令
$ vim ~/.bashrc function repeat() { number=$1 shift echo $@ for n in $(seq $number); do $@ done } $ ...
- Linux性能优化从入门到实战:09 内存篇:Buffer和Cache
Buffer 是缓冲区,而 Cache 是缓存,两者都是数据在内存中的临时存储. 避免跟文中的"缓存"一词混淆,而文中的"缓存",则通指内存中的临时存储 ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - A
题目链接:http://codeforces.com/contest/831/problem/A 题意:给定一个序列,问你这个序列是否是单峰的. 定义单峰的序列为: (序列值的变化趋势)开始是递增的, ...
- Codeforces 750E 线段树DP
题意:给你一个字符串,有两种操作:1:把某个位置的字符改变.2:询问l到r的子串最少需要删除多少个字符,使得这个子串含有2017子序列,并且没有2016子序列? 思路:线段树上DP,我们设状态0, 1 ...
- 高精乘(fft板子
哇..fft的原理真的是不太好懂,看了好久许多细节还是不太清楚,但感觉本质就是用了单位根的性质. https://www.luogu.org/problem/P1919 #include<cst ...
- 64bit assembly
16个通用寄存器: %rax %rbx %rcx %rdx %rsi %rdi %rbp %rsp %r8 %r9 %r10 %r11 %r12 %r13 %r14 %r15
- phpstorm 调试时浏览器显示The requested resource / was not found on this server
1.进入thinkphp项目的public 目录运行以下命令即可 root@jiang:/var/www/tp5# php -S localhost:8080 router.php PHP 7.2.2 ...
- mysql 5.6 datetime default now()
CREATE TABLE `test` ( id int, `gmt_create` datetime DEFAULT NOW() not NULL )ENGINE=InnoDB; mysq ...
- 029:url标签使用详解
url标签使用详解: 在模版中,我们经常要写一些 url ,比如某个 a 标签中需要定义 href 属性.当然如果通过硬编码的方式直接将这个 url 写死在里面也是可以的.但是这样对于以后项目维护可能 ...
- java生成128A条形码
添加maven依赖 <dependency> <groupId>net.sf.barcode4j</groupId> <artifactId>barco ...