美文网首页
centos7 防火墙

centos7 防火墙

作者: 不排版 | 来源:发表于2018-03-22 08:31 被阅读251次

启动防火墙: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;echo $?

查看已启动的服务列表:systemctl list-unit-files | grep enabled

查看防火墙状态:systemctl status firewalld.service

systemctl list-unit-files | grep firewalld.service

firewall-cmd --state

[ 复制代码

](javascript:void(0); "复制代码")

<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; box-sizing: border-box; font-family: "Courier New" !important; font-size: 12px !important;">[root@localhost bin]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 二 2018-03-06 23:00:54 CST; 2min 10s ago
Docs: man:firewalld(1)
Main PID: 37299 (firewalld)
Memory: 25.1M CGroup: /system.slice/firewalld.service
└─37299 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

3月 06 23:00:55 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -w --table filter --delete INPUT...ailed:
3月 06 23:00:55 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -i docker0 ...ailed:
3月 06 23:00:55 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -w --table filter --delete INPUT...ailed:
3月 06 23:00:55 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -i docker0 ...ailed:
3月 06 23:00:56 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C PREROUTING -m addrtype...ailed:
3月 06 23:00:56 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C OUTPUT -m addrtype --d...ailed:
3月 06 23:00:56 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -o docker0 ...ailed:
3月 06 23:00:56 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -o docker0 ...ailed:
3月 06 23:00:56 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -j DOCKER-I...ailed:
3月 06 23:00:56 localhost.localdomain firewalld[37299]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -D FORWARD -i docker0 -o docker0...ailed:
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost bin]# systemctl list-unit-files | grep firewalld.service
firewalld.service enabled

[root@localhost bin]# firewall-cmd --state
running </pre>

[ 复制代码

](javascript:void(0); "复制代码")

查看已经开放的端口

firewall-cmd --list-ports

<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; box-sizing: border-box; font-family: "Courier New" !important; font-size: 12px !important;">[root@localhost bin]# firewall-cmd --list-ports 8080/tcp</pre>

开启端口

firewall-cmd --zone=public --add-port=8080/tcp --permanent

命令含义:

--zone #作用域

--add-port=8080/tcp #天假端口,格式为:端口/通讯协议

--permanent #永久生效,没有此参数重启后失效

重启防火墙

firewall-cmd --reload

相关文章

  • linux命令

    centos7启动防火墙 centos7停止防火墙/关闭防火墙 centos7重启防火墙 注意:新增/删除操作需要...

  • CentOS7防火墙设置

    CentOS7 与之前版本在防火墙配置上不同,防火墙从iptables变成了firewalld Centos7默认...

  • Linux常用命令

    CentOS7 防火墙增加端口

  • Linux使用-FAQ

    CentOS7 关闭防火墙 参考:CentOS7 关闭防火墙 在我的虚拟机下启动服务 进程管理 文件管理 查看日志...

  • centos7关闭防火墙

    centos7 默认防火墙是firewalld 所以查看防火墙状态命令:systemctl status ...

  • linux防火墙查看状态firewall、iptable

    CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之...

  • CentOS 7.2 关闭防火墙

    CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之...

  • Linux防火墙命令

    CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之...

  • centos7和centos6的防火墙关闭命令

    CentOS7的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前...

  • linux服务器常用

    Centos7 打开80端口防火墙命令

网友评论

      本文标题:centos7 防火墙

      本文链接:https://www.haomeiwen.com/subject/inuoqftx.html