笨笨网美国主机,w ww.2 b p .n e t
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/tcpfirewall-cmd --reload
关闭防火墙端口firewall-cmd --permanent --remove-port=80/tcpfirewall-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
笨笨网美国主机,w ww.2 b p .n e t
提醒:《关闭防火墙linux命令(Linux 查看防火墙状态)》最后刷新时间 2025-03-21 11:17:20,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《关闭防火墙linux命令(Linux 查看防火墙状态)》该内容的真实性请自行鉴别。