首先应该查看有哪些端口是开放状态:
netstat -ntpl
Centos 7.0 曾经的版本。防火墙用的是 iptables。7.0 之后使用 firewalld 代替了 iptables。那么我们来分别观望这两种防火墙的命令操作:
iptables
1. 查看防火墙状态
systemctl status firewalld
service iptables status
2. 暂时关闭防火墙
systemctl stop firewalld
service iptables stop
3. 永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
4. 重启防火墙
systemctl enable firewalld
service iptables restart
5. 开放指定端口
写文件: vi /etc/sysconfig/iptables
添加开放端口:iptables -I INPUT -p tcp –dport 端口号 -j ACCEPT
保存配置:service iptables save
重启防火墙:service iptables restart
firewalld
1. 查看防火墙状态
systemctl status firewalld
firewall-cmd –state
2. 启动防火墙
systemctl start firewalld
3.禁用防火墙
systemctl stop firewalld
4.设置开机启动
systemctl enable firewalld
5.终止并禁用开机启动
sytemctl disable firewalld
6.重启防火墙
systemctl restart firewalld.service
firewall-cmd –reload
7. 开放指定端口
添加端口: firewall-cmd –zone=public –add-port=端口号/tcp –permanent
重启防火墙:systemctl restart firewalld.service
您还感兴趣的文章推荐- 十大帅哥明星排行榜 全球颜值排名前十男2021
- 好用的睫毛膏十大排行榜10强 大家用过最好用的睫毛膏
- 最帅的人是谁 第一名 2020全球最帅100人完整排行榜
- 全球最帅的男人排行榜 盘点历届全球最性感男人今昔对比照
- 搞笑韩剧排行榜前十名 浪漫搞笑爱情喜剧韩剧
以上就是由互联网推广工程师 网创网 整理编辑的,如果觉得有帮助欢迎收藏转发~
本文地址:https://www.wangchuang8.com/81836.html,转载请说明来源于:网创推广网
声明:本站部分文章来自网络,如无特殊说明或标注,均为本站原创发布。如若本站内容侵犯了原著者的合法权益,可联系进行处理。分享目的仅供大家学习与参考,不代表本站立场。
评论(2)
win7如何开放端口 教你服务器开放端口如何设置 这篇解答确实也是太好了
防火墙,端口,重启,状态,的是,端口号,这两种,命令,版本,操作
首先应该查看有哪些端口是开放状态:netstat -ntplCentos 7.0 曾经的版本。防火墙用的是 iptabl