首页
centos
常用命令linux_系统
Centos后台运行程序命令nohup
CentOS7启用阿里源yum安装Nginx
使用清华大学yum源
Linux下的压缩/解压缩
linux 使用 rz 和 sz 上传下载文件
Centos7下date怎么英文格式输出
Linux命令 之 watch命令
Centos 7查看系统最近一次启动时间和运行时间
Linux常用命令记录
CentOS7的systemd
CentOS设置环境变量
系统优化
Linux查看服务的启动状态是否开机自动启动
CentOS忘记密码
Centos7配置开机自启动脚本
常用命令linux_文本处理
计划任务crontab
CentOS7 SElinux和防火墙Firewall
Centos firewall-cmd配置软路由
CentOS7系统中使用iptables
iptables配置
iptables基础操作
Centos7 SSH登录日志分析
CentOS下查看tcp的网络连接状态数 netstat + awk
CentOS7上安装 Fail2Ban防SSH爆破
Fail2Ban开启邮件告警
SSH
CentOS 7 SSH配置免密码登录
CentOS7开启SSH访问配置
删除ssh客户端记录的主机密钥标识(指纹)
sshd启动失败解决
shell脚本
示例:jumpserver一键安装脚本
centos中使用ping日志记录网络通断
盘符挂载硬盘导致重启系统失败
CentOS_网络
centos路由配置
Linux 系统添加永久静态路由
centos 添加删除路由
Linux下使用TC实现网络限流
linux系统下的wifi启动不了
hosts文件配置
网络端口
Centos 网卡命名规则
Centos命令行中调用图形界面设置网卡
查看CentOS网口的使用带宽
定时备份删除文件
定时删除n日前的文件
备份指定目录下的文件
检查定时备份是否执行
inotify+rsync实时同步
rsync+lsync
CentOS7 使用SMTP发送邮件
Centos7部署开源SSH蜜罐cowrie
Centos7磁盘相关命令
centos 7 新增硬盘 分区并挂载
centos7加硬盘给根分区扩容--lvm模式
Linux中对lvm逻辑卷分区大小的调整(针对xfs与ext4不同文件系统)
CentOS7挂载4T磁盘
Centos7_NFS
CentOS7挂载samba共享文件夹
vsftpd主动模式和被动模式
CentOS清除旧硬盘格式
CentOS磁盘读写性能测试
本文档由 内网文摘 发布,转载请注明出处
-
+
home page
CentOS7 SElinux和防火墙Firewall
### CentOS 7关闭selinux #### 临时关闭 `getenforce` 获取当前selinux状态 Enforcing表示开启 `sudo setenforce 0`临时关闭selinux 重启失效 状态变为Disabled #### 永久关闭 `sudo vim /etc/sysconfig/selinux`或`vi /etc/selinux/config` 将SELINUX=enforcing改为SELINUX=disabled 设置后需要重启才能生效 ### CentOS 7防火墙Firewall #### Firewall开放端口 CentOS升级到7之后使用firewalld代替了原来的iptables 开启tcp端口80 [root@centos7 ~]# `firewall-cmd --zone=public --add-port=80/tcp --permanent` 开启udp端口53 [root@centos7 ~]# `firewall-cmd --zone=public --add-port=53/udp --permanent` 批量添加区间端口`firewall-cmd --zone=public--add-port=4400-4600/udp --permanent` #### Firewall关闭端口 `firewall-cmd --zone=public--remove-port=80/tcp --permanent` #### Firewall查询和重启 查询端口号80 是否开启: [root@centos7 ~]# `firewall-cmd --query-port=80/tcp` 重新载入防火墙配置: [root@centos7 ~]# `firewall-cmd --reload` 查询有哪些端口是开启的: [root@centos7 ~]# `firewall-cmd --list-port` #### 命令含义: --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效 **启停firewall** #### 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
local
Sept. 17, 2021, 6:07 p.m.
Share documents
Collection documents
Last
Next
Scan wechat
Copy link
Scan your mobile phone to share
Copy link
关于 LocalNetwork
LocalNetwork
是由mrdoc开源
LocalNetwork.cn
修改的在线文档系统,作为个人和小型团队的云笔记、文档和知识库管理工具。
如果此文档给你或你的团队带来了帮助,欢迎支持作者持续投入精力更新和维护!内网文摘 & LocalNetwork
>>>主页
logo
logo
Download markdown file
share
link
type
password
Update password