日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

linux对方开放端口,Linux 开放端口

發布時間:2025/4/17 69 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux对方开放端口,Linux 开放端口 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

開放之前可以查看下哪些端口開放了,使用命令netstat -ntpl

[root@localhost ~]# netstat -ntpl

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1110/sshd

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1190/master

tcp 0 0 :::22 :: LISTEN 1110/sshd

tcp 0 0 ::1:25 :: LISTEN 1190/master

[root@localhost ~]#

如果要開放MySQL數據庫端口3306,使用下面的命令

1

2

3

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

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

/etc/init.d/iptables restart

執行過程登錄

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

[root@localhost ~]# /etc/rc.d/init.d/iptables save

iptables:將防火墻規則保存到 /etc/sysconfig/iptables: [確定]

[root@localhost ~]# /etc/init.d/iptables restart

iptables:將鏈設置為政策 ACCEPT:filter [確定]

iptables:清除防火墻規則: [確定]

iptables:正在卸載模塊: [確定]

iptables:應用防火墻規則: [確定]

[root@localhost ~]#

如果要關閉端口,使用下面的命令

1

2

3

4

/sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP

/sbin/iptables -I OUTPUT -p tcp --sport 3306 -j DROP

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

/etc/init.d/iptables restart

CentOS迷你版沒有firewall。需要安裝后才能使用。

安裝 yum install firewalld

systemctl start firewalld # 啟動,

systemctl enable firewalld # 開機啟動

systemctl stop firewalld # 關閉

systemctl disable firewalld # 取消開機啟動

開放端口和關閉端口

1

2

3

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

firewall-cmd --zone=public --remove-port=8090/tcp --permanent

使配置生效

1

firewall-cmd --reload

總結

以上是生活随笔為你收集整理的linux对方开放端口,Linux 开放端口的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。