win7如何开放端口 教你服务器开放端口如何设置
原创

win7如何开放端口 教你服务器开放端口如何设置

好文

首先应该查看有哪些端口是开放状态:

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

您还感兴趣的文章推荐

以上就是由互联网推广工程师 网创网 整理编辑的,如果觉得有帮助欢迎收藏转发~

分享到 :
相关推荐

回复 苏梦北 取消回复

登录... 后才能评论

评论(2)

  • 公主抱 永久VIP 2022年12月14日 01:27:34

    win7如何开放端口 教你服务器开放端口如何设置 这篇解答确实也是太好了

  • 且听风雨 永久VIP 2022年12月14日 01:27:34

    防火墙,端口,重启,状态,的是,端口号,这两种,命令,版本,操作

  • 苏梦北 永久VIP 2022年12月14日 01:27:34

    首先应该查看有哪些端口是开放状态:netstat -ntplCentos 7.0 曾经的版本。防火墙用的是 iptabl