一、前言

防火墙是Linux系统的 主要的安全工具 ,可以提供基本的安全防护,在Linux历史上已经使用过的防火墙工具包括:ipfwadm、ipchains、iptables (即Centos6就是使用的iptables) ,而在firewalld中新引入了 区域(Zone) 这个概念

二、相关命令

1)查看已开放的端口
firewall-cmd --list-ports

2)开放端口(开放后需要要重启防火墙才生效)
firewall-cmd --zone=public --add-port=3338/tcp --permanent

3)重启防火墙
firewall-cmd --reload

4)关闭端口(关闭后需要要重启防火墙才生效)
firewall-cmd --zone=public --remove-port=3338/tcp --permanent

5)开机启动防火墙
systemctl enable firewalld

6)开启防火墙
systemctl start firewalld

7)查看防火墙状态
firewall-cmd --state

8) 禁止防火墙开机启动
systemctl disable firewalld

9) 停止防火墙
systemctl stop firewalld

查看端口相关命令 

1) 查看已经被占用的端口状态
netstat -ntlp
2)产看某端口的状态
netstat -ntulp |grep 80

 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐