您的位置:首页技术文章

CentOS7防火墙和端口相关命令介绍

【字号: 日期:2023-02-08 11:05:58浏览:2作者:猪猪
目录
  • 1、查看防火墙当前状态
  • 2、启动防火墙服务
  • 3、关闭防火墙服务
  • 4、开放指定端口
  • 5、移除指定端口,需重启防火墙服务才能生效
  • 6、重启防火墙
  • 7、设置防火墙开机自启动
  • 总结

以下情况对应的linux系统版本为CentOS7,若使用的环境为CentOS6请使用service iptables state/start/stop/restart替换对应的systemctl status /start/stop/restart firewalld.service命令;

1、查看防火墙当前状态

方法1

[root@hu ~]# firewall-cmd --state
not running			---未运行
[root@hu ~]# firewall-cmd --state
running				---运行中

方法2

[root@hu ~]# systemctl status firewalld.service
正常运行中
标签: Apache Linux
相关文章: