zl程序教程

您现在的位置是:首页 >  系统

当前栏目

linux 放开8080端口命令_linux开放端口命令

Linux命令 端口 开放 8080 放开
2023-06-13 09:13:43 时间

大家好,又见面了,我是你们的朋友全栈君。

1.centos7版本对防火墙进行 加强,不再使用原来的iptables,启用firewall

1.查看已开放的端口(默认不开放任何端口)

firewall-cmd –list-ports

2.开启80端口

firewall-cmd –zone=public(作用域) –add-port=80/tcp(端口和访问类型) –permanent(永久生效)

firewall-cmd –zone=public –add-port=80/tcp –permanent

3.重启防火墙

firewall-cmd –reload

4.停止防火墙

systemctl stop firewalld.service

5.禁止防火墙开机启动

systemctl disable firewalld.service

6.删除

firewall-cmd –zone= public –remove-port=80/tcp –permanent

2.centos7以下版本

1.开放80,22,8080 端口

/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT

/sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT

/sbin/iptables -I INPUT -p tcp –dport 8080 -j ACCEPT

2.保存

/etc/rc.d/init.d/iptables save

3.查看打开的端口

/etc/init.d/iptables status

4.关闭防火墙

1) 永久性生效,重启后不会复原

开启: chkconfig iptables on

关闭: chkconfig iptables off

2) 即时生效,重启后复原

开启: service iptables start

关闭: service iptables stop

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/196515.html原文链接:https://javaforall.cn