Linux防火墙相关常用操作
数字魔盒 -linux防火墙常用操作,包含了基本的防火墙启动/停止、端口开放设置、端口出入站设置等相关功能。由于Linux各个发行版使用的防火墙软件并不相同,特此整理该文档帮助大家能够进行速查。防火墙软件对照
以防火墙软件为索引,使用了该防火墙软件的Linux发行版如下清单所示:
firewall-cmd,适用于centos7。iptables,适用于centos6。一般性前置条件一般对防火墙进行操作时,需要使用具备系统管理者的身份执行指令。本文档所有操作命令示例均按已经获得系统管理者权限为前提。另外本文所有指令均已80端口为样例。
firewall-cmd软件查看防火墙状态firewall-cmd --state
开启防火墙systemctl start firewalld
关闭防火墙systemctl stop firewalld
设置开机启动systemctl enable firewalld
禁用开机启动sytemctl disable firewalld
重启防火墙firewall-cmd --reload
开放防火墙端口firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
关闭防火墙端口firewall-cmd --permanent --remove-port=80/tcp
firewall-cmd --reload
查看防火墙规则firewall-cmd --list-all
iptables软件查看防火墙状态firewall-cmd --state
开启防火墙service iptables start
关闭防火墙service iptables stop
设置开机启动chkconfig iptables on
禁用开机启动chkconfig iptables off
重启防火墙service iptables restartd
开放防火墙端口/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save
service iptables restart
关闭防火墙端口/sbin/iptables -I INPUT -p tcp --dport 端口号 -j DROP
/etc/init.d/iptables save
service iptables restart
查看防火墙规则/etc/init.d/iptables status
版权声明,本文首发于 数字魔盒 https://www.dm2box.com/ 欢迎转载。 特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。
上一篇: Linux命令的使用方法
下一篇: Linux之killall命令
Tags 标签
linuxiptablesfirewalld防火墙扩展阅读
Linux 常用命令
2019-01-12 11:26:35 []linux命令行查看系统有哪些用户
2020-06-28 19:09:43 []【问题合集】Problem with the SSL CA cert (path? access rights?)
2020-09-20 09:57:21 []关于 MAC 配置 Apache2 + PHP
2020-09-21 12:36:34 []Laravel项目上线注意点
2020-10-20 21:55:08 []PHP-FPM中-D命令的实现
2020-10-23 13:54:26 []2020年10月php面试笔记
2020-10-23 01:09:55 []协程 shell_exec 如何捕获标准错误流
2020-11-03 10:11:33 []亲测三遍!8步搭建一个属于自己的网站
2020-11-15 11:37:21 []lnmp.org如何更改TP6.0框架的pathinfo模式.
2020-11-15 15:21:36 []加个好友,技术交流

