FirewallD

Centos7 防火墙和Selinux 一些简单操作命令

眉间皱痕 提交于 2019-12-07 12:39:27
CentOS 7 缺省采用了 firewalld ,尽管还是可以安装并支持 iptables,但是还是跟上新东西为好!其实iptables 我也没有用过,哈哈哈! 防火墙功能很强大,但是,日常要做的最多的还是开放端口,记录一下,以便随时 copy 1、 开放 8080 端口 1. 查看防火墙状态 sudo systemctl status firewalld sudo firewall-cmd --state running 2. 防火墙基本命令 # 开启 service firewalld start # 重启 service firewalld restart # 关闭 sudo service firewalld stop # 查看防火墙规则 sudo firewall-cmd --list-all sudo firewall-cmd --state 3. 开启 8080 端口 sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent 重启防火墙 sudo systemctl restart firewalld.service sudo firewall-cmd --reload 4. 不知道为什么,就把自己关在外面了 ssh 连接不上去了! sudo firewall-cmd --list-all

CentOS7.6服务器部署VNC

耗尽温柔 提交于 2019-12-06 20:16:46
CentOS7.6服务器部署VNC 2019年04月22日 16:50:39 sukysun125 阅读数 268 CentOS7.6服务器部署VNC 安装vnc服务器 开启vnc 开启远程端口 查看服务器ip 关闭防火墙和selinux 远程访问 安装vnc服务器 [root@localhost ~]# yum install tigervnc-server 1 开启vnc [root@localhost ~]# vncserver You will require a password to access your desktops. Password: //输入密码 Verify: //重复密码 Would you like to enter a view-only password (y/n)? n //只可看的密码,一般选n A view-only password is not used xauth: file /root/.Xauthority does not exist New 'localhost.VD:1 (root)' desktop is localhost.VD:1 Creating default startup script /root/.vnc/xstartup Creating default config /root/.vnc/config

centos 6/7 防火墙操作

♀尐吖头ヾ 提交于 2019-12-06 06:15:07
centos 7 firewall(防火墙)开放端口/删除端口/查看端口 1.firewall的基本启动/停止/重启命令 #centos7启动防火墙 systemctl start firewalld.service #centos7停止防火墙/关闭防火墙 systemctl stop firewalld.service #centos7重启防火墙 systemctl restart firewalld.service #设置开机启用防火墙 systemctl enable firewalld.service #设置开机不启动防火墙 systemctl disable firewalld.service 2.新增开放一个端口号 firewall-cmd --zone=public --add-port=80/tcp --permanent 说明: --zone 作用域 --add-port=80/tcp 添加端口,格式为:端口/通讯协议 --permanent 永久生效,没有此参数重启后失效 3.开放多个端口 firewall-cmd --zone=public --add-port=80-90/tcp --permanent 查看本机已经启用的监听端口: #centos7以下使用netstat -ant,7使用ss ss -ant 4.查看 #centos7查看防火墙所有信息

Centos 7 firewalld常用命令

给你一囗甜甜゛ 提交于 2019-12-05 19:13:40
firewalld是centos7的一大特性,最大的好处有两个:支持动态更新,不用重启服务;第二个就是加入了防火墙的“zone”概念。 永久打开一个端口: firewall-cmd --permanent --add-port=8080/tcp 永久关闭一个端口: firewall-cmd --permanent --remove-port=8080/tcp 永久打开某项服务: firewall-cmd --permanent --add-service=http 永久关闭某项服务: firewall-cmd --permanent --remove-service=http 进行端口转发: firewall-cmd --permanent --add-forward-port=port=80:proto=tcp:toport=8080:toaddr=192.0.2.55 允许转发到其他地址: firewall-cmd --permanent --add-masquerade 重新加载防火墙: firewall-cmd --reload 运行、停止、禁用firewalld 启动:# systemctl start firewalld 查看状态:# systemctl status firewalld 或者 firewall-cmd –state 停止:# systemctl

Centos7防火墙firewalld基本配置与端口转发

六月ゝ 毕业季﹏ 提交于 2019-12-05 19:13:26
Centos7防火墙firewalld基本配置与端口转发 2018年12月14日 15:47:45 忒斯特 阅读数:69 1.firewalld基本介绍 Centos7开始已经放弃iptables,转而使用firewalld。从本质意义上讲,iptables和firewalld是防火墙软件,其实现方式都是调用内核Netfilter。firewalld提供了一个动态管理的防火墙,形成网络“zones”规则集,具备支持ipv4和ipv6的能力。firewalld程序提供了图形化的配置工具firewall-confighe、system-config-firewall和命令行firewall-cmd,用于配置firewalld永久性或非永久性规则。 2.firewalld服务配置 启动服务:systemctl start firewalld 关闭服务:systemctl stop firewalld 重启服务:systemctl restart firewalld 查看服务状态:systemctl status firewalld 开机自启服务:systemctl enable firewalld 开机禁用服务:systemctl disable firewalld 查看是否开机自启:systemctl is-enable firewalld PS:systemctl常见其他命令:

centos firewalld 操作

╄→гoц情女王★ 提交于 2019-12-05 09:28:10
CentOS7使用firewalld打开关闭防火墙与端口 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 查看已启动的服务列表

CentOS7使用firewall-cmd打开关闭防火墙与端口

二次信任 提交于 2019-12-05 09:27:58
一、centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewalld 1.firewalld的基本使用 启动: systemctl start firewalld 查状态:systemctl status firewalld 停止: systemctl disable firewalld 禁用: systemctl stop firewalld 在开机时启用一个服务:systemctl enable firewalld.service 在开机时禁用一个服务:systemctl disable firewalld.service 查看服务是否开机启动:systemctl is-enabled firewalld.service 查看已启动的服务列表:systemctl list-unit-files|grep enabled 查看启动失败的服务列表:systemctl --failed 2.配置firewalld-cmd 查看版本: firewall-cmd --version 查看帮助: firewall-cmd --help 显示状态: firewall-cmd --state 查看所有打开的端口: firewall-cmd --zone=public --list-ports 更新防火墙规则: firewall-cmd --reload 查看区域信息:

Centos开放查看端口 防火墙关闭打开

余生颓废 提交于 2019-12-05 09:27:45
###Centos 7 查看已经开放的端口: firewall-cmd --list-ports 开启端口 firewall-cmd --zone=public --add-port=80/tcp --permanent –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 关闭端口 firewall-cmd --zone=public --remove-port=9005/tcp --permanent 重启防火墙 firewall-cmd --reload #重启firewall systemctl start firewalld.service #启动 systemctl start firewalld.service #重启 systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running) CentOS 7 以下版本 iptables 命令 如要开放80,22,8080 端口,输入以下命令即可 /sbin/iptables -I

阿里云经典网络关闭端口不对公网开放

左心房为你撑大大i 提交于 2019-12-05 09:27:30
因为我们现在用的是以CentOS 7为主,主要使用的防火墙为firewall而不是CentOS 6的Iptables. 阿里云的服务器的防火墙默认是关闭的,请注意我这里说的不是专有网络而是经典网络,所以只要你开放了一个端口,外网就可以访问。 首先启动防火墙 service firewalld start 我们以redis的6379端口为例,配置只允许内网访问,外网不允许访问的配置,假如本机的IP为172.31.27.68,允许访问的IP为172.31.27.67,172.31.27.69。 firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.31.27.67" port protocol="tcp" port="6379" accept" firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.31.27.69" port protocol="tcp" port="6379" accept" 开放端口段 firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.31

CentOS 7.2/7.3:Failed to start IPv4 firewall with iptables

守給你的承諾、 提交于 2019-12-05 09:27:20
现在用下面的命令正好可以完美解决这个问题, 启动命令如下: systemctl start iptables.service 报错如下: Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details. 两台服务器都是同样的环境,但是一台一切正常,另一台却是这种情况,觉得有点不对劲,之后尝试了几种其他方式,也试过重装iptables服务和重启服务器的方式,但是依然会报这个错误。 执行journalctl -xe查看错误日志,查到了更加具体的原因,错误如下: Failed to start IPv4 firewall with iptables. 到这里大概知道问题的原因了。 解决办法 因为centos7默认的防火墙是firewalld防火墙,不是使用iptables,因此需要先关闭firewalld服务,或者干脆使用默认的firewalld防火墙。 因为这次报错的服务器是一台刚刚购买的阿里云服务器,所以在操作上忘记关闭默认防火墙的步骤了才导致浪费了些时间在这件事情上。 关闭firewalld: systemctl stop