系统相关
首页 > 系统相关> > linux-防火墙

linux-防火墙

作者:互联网

防火墙常用命令

安装Firewall命令:

yum install firewalld firewalld-config

Firewall开启常见端口命令:


firewall-cmd –zone=public –add-port=80/tcp –permanent
firewall-cmd –zone=public –add-port=443/tcp –permanent
firewall-cmd –zone=public –add-port=22/tcp –permanent
firewall-cmd –zone=public –add-port=21/tcp –permanent
firewall-cmd –zone=public –add-port=53/udp –permanent

Firewall关闭常见端口命令


firewall-cmd –zone=public –remove-port=80/tcp –permanent
firewall-cmd –zone=public –remove-port=443/tcp –permanent
firewall-cmd –zone=public –remove-port=22/tcp –permanent
firewall-cmd –zone=public –remove-port=21/tcp –permanent
firewall-cmd –zone=public –remove-port=53/udp –permanent

批量添加区间端口


firewall-cmd –zone=public –add-port=4400-4600/udp –permanent
firewall-cmd –zone=public –add-port=4400-4600/tcp –permanent

开启防火墙命令:

W

**重启防火墙命令:**

firewall-cmd –reload 或者 service firewalld restart

查看放行端口:


firewall-cmd --list-ports

**禁用防火墙**


systemctl stop firewalld

**设置开机启动**

systemctl enable firewalld

**停止并禁用开机启动**

sytemctl disable firewalld

**查看状态**

systemctl status firewalld或者 firewall-cmd –state

标签:zone,firewall,cmd,防火墙,public,permanent,linux,port
来源: https://www.cnblogs.com/RaymonGoGo/p/16640703.html