Linux打开端口方法

2022年12月17日08:53:33 发表评论
微信搜一搜 ts小陈

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

小陈号卡
ts小陈

发表评论(不允许含有网址!)

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

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