centos7 防火墙与端口设置、linux端口范围
防火墙
启动防火墙: systemctl start firewalld
查看防火墙状态: systemctl status firewalld
关闭防火墙: systemctl stop firewalld
开机时启用防火墙服务:systemctl enable firewalld
开机时禁用防火墙服务:systemctl disable firewalld
查询防火墙服务是否开机启动:systemctl is-enabled firewalld
服务列表
查询已经启动的服务列表:systemctl list-unit-files|grep enabled
查询启动失败的服务列表:systemctl --failed
端口相关操作
添加端口:firewall-cmd --zone=public --add-port=80/tcp --permanent
更新防火墙规则:firewall-cmd --reload
查看端口状态:firewall-cmd --zone=public --query-port=80/tcp
删除开放的端口:firewall-cmd --zone=public --remove-port=80/tcp --permanent
每次都更新防火墙规则,都需要重新更新:firewall-cmd --reload,更新状态
查看所有开启的端口:firewall-cmd --zone=public --list-ports
端口配置的文件:/etc/firewalld/zones/public.xml
1、firewalld的基本使用
启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld
开机禁用 : systemctl disable firewalld
开机启用 : systemctl enable firewalld
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed
3.配置firewalld-cmd
查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看所有打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
查看区域信息: firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
那怎么开放一个端口呢?(让外部能够访问)
添加
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone= public --query-port=80/tcp
删除
firewall-cmd --zone= public --remove-port=80/tcp --permanent
linux端口范围:
port的取值范围是 0 - 65535(即2的16次方),0到1024是众所周知的端口(知名端口,常用于系统服务等,例如http服务的端口号是80)。
个人写的应用程序,尽量不要使用0到1024之间的端口号。
centos7 防火墙与端口设置、linux端口范围的更多相关文章
- [转帖]Centos7防火墙配置rich-rule实现IP端口限制访问
Centos7防火墙配置rich-rule实现IP端口限制访问 2019-02-18 18:05:35 sunny05296 阅读数 2143 收藏 更多 分类专栏: Linux 版权声明:本文 ...
- 【linux】在宝塔上 同ip 不同端口 设置一个端口对应一个网站
准备工作: ip一个 , 例如:192.168.1.666 服务器一台,放行所需端口 假想一个域名 www.test.com ps:默认你已经装好宝塔面板了 实现效果: 192.168.1.666:6 ...
- Centos7 防火墙frewalld规则设置
配置firewalld-cmd 查看版本: firewall-cmd --version 查看帮助: firewall-cmd --help 显示状态: firewall-cmd --state 查看 ...
- centos7 防火墙一些相关设置 开机添加静态路由 特殊的方法
参考文献: https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/security_guide/s ...
- Linux CentOS 7 防火墙/端口设置
CentOS升级到7之后用firewall代替了iptables来设置Linux端口, 下面是具体的设置方法: []:选填 <>:必填 [<zone>]:作用域(block.d ...
- Linux CentOS 7 防火墙与端口设置操作
CentOS升级到7之后用firewall代替了iptables来设置Linux端口, 下面是具体的设置方法: []:选填 <>:必填 [<zone>]:作用域(block.d ...
- Linux CentOS 7 防火墙/端口设置【转发】
CentOS升级到7之后用firewall代替了iptables来设置Linux端口, 下面是具体的设置方法: []:选填 <>:必填 [<zone>]:作用域(block.d ...
- Centos7防火墙快速开放端口配置方法
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! Firewalld服务是红帽RHEL7系统中默认的防火墙管理工具,特点是拥有运行时配置与永久配置选 ...
- Linux CentOS中防火墙的关闭及开启端口
注:CentOS7之前用来管理防火墙的工具是iptable,7之后使用的是Firewall 样例:在CentOS7上安装tomcat后,在linux本机上可以访问tomcat主页,http://ip: ...
随机推荐
- python list和函数之间的复制和原地址修改问题
def change(a): a.pop() #自带的方法都是原地址修改 a=[,,] change(a) print (a)#直接修改了3. def change(a): a=[,,,] #复制操作 ...
- 移动文件流的读写指针---fseek
函数原型:int fseek(FILE *stream,long offset,int origin) stream:文件指针, offset:偏移量,正数表示正向偏移,负数表示负向偏移.origin ...
- db2 存储过程中的玩意
aix的top是topas.vmstat也是一个玩意,但是不懂. AND C_DEP_CDE like substr(I_C_DPT_CDE,1,2)||'%';--db2中字符串的加法用||这个 ...
- Devexpress VCL Build v2013 vol 14.1.5 发布
What's New in 14.1.5 (VCL Product Line) New Major Features in 14.1 What's New in VCL Products 14.1 ...
- 2018.09.08 NOIP模拟eat(贪心)
签到水题啊... 这题完全跟图论没有关系. 显然如果确定了哪些点会被选之后顺序已经不重要了.于是我们给点按权值排序贪心从大向小选. 我们要求的显然就是∑i(a[i]−(n−i))" role ...
- 经典的SQL语句面试题(转)
Student(S#,Sname,Sage,Ssex) 学生表Course(C#,Cname,T#) 课程表SC(S#,C#,score) 成绩表Teacher(T#,Tname) 教师表 问题:1. ...
- Part 3 - Advanced Concepts(11-13)
https://simpleisbetterthancomplex.com/series/2017/09/18/a-complete-beginners-guide-to-django-part-3. ...
- chandy-lamport 分布式一致性快照 算法详细介绍
在一个分布式计算系统中,为了保证数据的一致性需要对数据进行一致性快照.Flink和spark在做流失计算的时候都借鉴了chandy-lamport算法的原理,这篇文章就是对chandy-lamport ...
- VHDL的库
STD_LOGIC_ARITH 扩展了UNSIGNED.SIGNED.SMALL_INT(短整型)三个数据类型,并定义了相关的算术运算和转换函数. --======================== ...
- Spring MVC controller 被执行两次
interceptor 被执行两次 后来发现 时controller被执行两次 后来发现是jsp页面有个: <img src="#" > 导致被执行两次. 解决方案:去 ...