Linux打开端口方法

2022年12月17日08:53:33 发表评论
广告也精彩

1、开启防火墙

systemctl start firewalld

2、开放指定端口

firewall-cmd --zone=public --add-port=1935/tcp --permanent

命令含义:

systemctl start firewalld

--zone #作用域

--add-port=1935/tcp #添加端口,格式为:端口/通讯协议

--permanent #永久生效,没有此参数重启后失效

3、重启防火墙

firewall-cmd --reload

4、查看端口号

netstat -ntlp //查看当前所有tcp端口

netstat -ntulp |grep 1935 //查看所有1935端口使用情况

 

#开放端口:8080

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

  • 我的微信
  • 有问题可随时与我联系
  • weinxin
  • 微信小程序
  • 随时随地查看文章
  • weinxin
ts小陈

发表评论(请规范评论)--评论需审核

:?: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :cry: :mrgreen: :neutral: :razz:

已登录用户不需要填写以下内容