Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Linux下如何查看CentOS版本

Linux下如何查看CentOS版本

作者头像
小柒2012
发布于 2018-04-13 06:59:05
发布于 2018-04-13 06:59:05
12.6K00
代码可运行
举报
文章被收录于专栏:IT笔记IT笔记
运行总次数:0
代码可运行

今天iptables居然不能使用了,赶紧查看了一下Linux版本了。居然更新到了CentOS7。

这里分享下查看命令:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
cat /etc/redhat-release 
cat /etc/centos-release 
或者
rpm -q redhat-release 
rpm -q centos-release 

执行iptables命令,出现”Failed to restart iptables.service: Unit iptables.service failed to load: No such file or directory.”错误,在CentOS 7或RHEL 7或Fedora防火墙由firewalld来管理,当然你可以还原传统的管理方式。或则使用新的命令进行管理。

执行命令

systemctl stop firewalld systemctl mask firewalld

安装iptables-services:

yum install iptables-services

设置开机启动: systemctl enable iptables systemctl [stop|start|restart] iptables 或者 service iptables [stop|start|restart]

service iptables save 或者 /usr/libexec/iptables/iptables.init save

CentOS7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disable firewalld 禁用: systemctl stop 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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-02-22,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
CentOS 7 开放防火墙端口命令
CentOS 7 开放防火墙端口 命令         最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用firewalld代替了原来的iptables。 使用方法如下: >>> 关闭防火墙 systemctl stop firewalld.service             #停止firewall systemctl disable firewalld.service        #禁止firewa
庞小明
2018/03/08
3.8K0
linux防火墙查看状态firewall、iptable[通俗易懂]
CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前的版本Centos 6.x使用iptables不一样
全栈程序员站长
2022/08/03
8K0
linux防火墙查看状态firewall、iptable[通俗易懂]
Linux·CentOS 防火墙
Linux 中有两种防火墙软件,ConterOS7.0 以上使用的是 firewall,ConterOS7.0 以下使用的是 iptables,本文将分别介绍两种防火墙软件的使用。
数媒派
2022/12/01
4.9K0
centos 7 安装iptables防火墙 - 乐享诚美
[root@localhost ~]# firewall-cmd --zone=public --add-port=6379/tcp --permanent
司夜
2023/10/18
5050
服务器安全设置Centos7 防火墙firewall与iptables
一.>>>>>>启用centos7 iptables防火墙Centos7 防火墙firewall设置方法
网站安全专家
2019/07/24
3.2K0
服务器安全设置Centos7 防火墙firewall与iptables
CentOS 6 和 CentOS 7 差异
CentOS 6 和 CentOS 7 介绍 总体差异 想装回过去的一些工具 安装:yum install -y tree net-tools bind-utils tree sysstat vim-en* lrzsz NetworkManager-tui ntp ntpdate iftop tcpdump telnet traceroute 查看版本号/主机名 cat /etc/redhat-release cat /etc/hostname 常用配置差异 CentOS 网络配置 CentOS 图形界
星哥玩云
2022/05/28
8620
CentOS 6 和 CentOS 7 差异
centos linux命令
如果想要永久关闭防火墙则还需要禁用防火墙服务。 其他常用命令: systemctl disable firewalld.service #永久关闭防火墙则还需要禁用防火墙服务 systemctl stop firewalld.service #停止firewall firewall-cmd --reload #重启防火墙 firewall-cmd --state                          ##查看防火墙状态,是否是running firewall-cmd
凡夫
2022/02/28
9180
linux防火墙设置白名单_Linux永久关闭防火墙
如果防火墙开启,我们pingLinux服务器的IP会ping不通,所以我们要对防火墙进行设置(一般情况下只需执行1里边的命令就可以了):
全栈程序员站长
2022/11/08
5K0
CentOS 6和CentOS 7防火墙的关闭
CentOS6.5查看防火墙的状态: [linuxidc@localhost ~]$service iptable status   显示结果: [linuxidc@localhost ~]$service iptable status Redirecting to /bin/systemctl status  iptable.service ● iptable.service    Loaded: not-found (Reason: No such file or directory)    Activ
庞小明
2018/07/06
7.5K0
Centos7设置防火墙相关命令
命令含义: --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效
用户7162790
2022/03/23
2.8K0
CentOS7使用firewalld打开关闭防火墙与端口
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
herve
2018/08/10
6380
Centos7服务器运维服务系统安装过程中遇到的问题总结
由于我们Sinesafe的客户要求网站的服务器要装Centos7版本所以给大家分享下安装的过程与经验,如果需要深入的服务器运维服务也可以找我们。
网站安全专家
2019/07/24
1.2K0
Centos7服务器运维服务系统安装过程中遇到的问题总结
Centos7:防火墙常用操作
一、防火墙服务 # 开启防火墙服务 systemctl start firewalld.service # 关闭防火墙服务 systemctl stop firewalld.service # 重启防火墙服务 systemctl restart firewalld.service # 防火墙服务状态 systemctl status firewalld.service # 禁止防火墙服务开机启动 systemctl disable firewalld.service 二、防火墙操作 查询有哪些端口是
新码农
2021/01/04
6050
CentOS 7.2防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。 firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
拿我格子衫来
2022/01/24
5720
linux firewall指令
CentOS7中firewall防火墙详解和配置,.xml服务配置详解 修改防火墙配置文件之前,需要对之前防火墙做好备份
HUC思梦
2020/09/03
4.2K0
Centos7 配置默认防火墙Firewalld
转自Linux就该这么学 Centos7 更新后,默认防火墙由IPtables变为Firewalld,那么Firewalld配置端口的操作是怎么样的呢?让我们来学习一下吧! 1、基本操作  sys
用户1086810
2018/06/26
2.1K0
CentOS7使用httpd apache 和firewalld打开关闭防火墙与端口
systemctl 是Centos7的服务管理工具中的主要工具 ,它融合之前service和chkconfig的功能于一体
梅花
2020/09/28
1.8K0
linux防火墙相关配置命令及操作(centos和ubuntu)
大家在网上输入【linux 防火墙】等关键字搜索相关文章,有时候会出现命令用不了的情况,不是说他们的命令错误,而是因为操作系统版本的问题。 目前的话,比较常见的 Linux 系统就是 centos 和 ubuntu了吧 废话不多说了,直接开怼
bboy枫亭
2020/09/22
2.3K0
centos7 之 sshd,iptables,firewall,fail2ban 常用操作
# 在原端口 22 下,新增 sshd 端口 20000,并 开启账号密码登录、开启 root 账号登录
卓越笔记
2023/02/17
7210
浅谈CentOS防火墙命令
1、安装 yum install iptables-services #安装iptables 2、systemctl使用 systemctl unmask firewalld #执行命令,即可实现取消服务的锁定 systemctl mask firewalld # 下次需要锁定该服务时执行 systemctl start firewalld.service #启动防火墙 systemctl stop firewalld.service #停止防火墙 systemctl reloadt firewalld.s
院长技术
2020/09/07
4980
相关推荐
CentOS 7 开放防火墙端口命令
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验