linux开启端口访问被外部访问

firewalld的基本使用

基本命令

启动:systemctl start firewalld

开机自启动:systemctl enable firewalld

停止:systemctl disable firewalld

禁用:systemctl stop firewalld

添加一个需要开启的端口:
firewall-cmd --zone=public --add-port=9333/tcp --permanent (–permanent永久生效,没有此参数重启后失效)

重新载入,让端口生效:
firewall-cmd --reload

删除端口:
firewall-cmd --zone=public --remove-port=9333/tcp --permanent

查看firewall是否运行:
systemctl status firewalld 或 firewall-cmd --state

查看开启了那些端口:/usr/lib/firewalld/services下面的xml文件
查看开启了那些端口命令行:firewall-cmd --list-ports

猜你喜欢

转载自blog.csdn.net/qq_46970849/article/details/110423171
今日推荐