百度
360搜索
搜狗搜索

linux下开启关闭防火墙命令详细介绍

在 Linux 系统中,防火墙管理工具因发行版而异。常见的防火墙管理工具有 iptablesfirewalld,下面为你介绍在不同工具下开启和关闭防火墙的命令。

1. 使用
firewalld(适用于 CentOS 7 及以上、Fedora 等)

  • 查看防火墙状态

bash

systemctl status firewalld

  • 开启防火墙

bash

systemctl start firewalld

  • 关闭防火墙

bash

systemctl stop firewalld

  • 设置防火墙开机自启

bash

systemctl  firewalld

  • 禁止防火墙开机自启

bash

systemctl disable firewalld

2. 使用
iptables(适用于 CentOS 6 及以下等)

  • 查看防火墙状态

bash

 iptables status

  • 开启防火墙

bash

 iptables start

  • 关闭防火墙

bash

 iptables stop

  • 设置防火墙开机自启

bash

 iptables on




912chkconfig iptables on

  • 禁止防火墙开机自启

bash

 iptables off




912chkconfig iptables off

使用上述命令时,你可能需要使用 sudo 来获取管理员权限,除非你是以 root 用户身份登录。

阅读更多 >>>  linux怎么修改runtime

文章数据信息:

本文主要探讨:"linux下开启关闭防火墙命令", 浏览人数已经达到26次, 首屏加载时间:1.499 秒。