14

月光中的污点 | CentOS 7 防火墙相关命令

 3 years ago
source link: https://www.extlight.com/2020/12/18/CentOS-7-%E9%98%B2%E7%81%AB%E5%A2%99%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
1
systemctl start firewalld.service
1
systemctl stop firewalld.service
1
systemctl restart firewalld.service
1
2
3
4
5
systemctl status firewalld.service



firewall-cmd --state
1
2
# 例如:开放 80 端口
firewall-cmd --zone=public --add-port=80/tcp --permanent

开放端口需重启防火墙

1
firewall-cmd --reload
1
2
# 例如:关闭 80 端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent

查看开放的端口

1
firewall-cmd --zone=public --list-ports

查看监听的端口

1
netstat -lnpt

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK