如何關(guān)閉linux端口?
Linux開(kāi)放端口和關(guān)閉端口的方法
一、查看哪些端口被打開(kāi) netstat -anp
二、關(guān)閉端口號(hào):
iptables -A OUTPUT -p tcp --dport 端口號(hào)-j DROP
三、打開(kāi)端口號(hào):
iptables -A INPUT -ptcp --dport 端口號(hào)-j ACCEPT
四、保存設(shè)置
service iptables save
五、以下是linux打開(kāi)端口命令的使用方法。
nc -lp 23 &(打開(kāi)23端口,即telnet) netstat -an | grep 23 (查看是否打開(kāi)23端口)
六、linux打開(kāi)端口命令每一個(gè)打開(kāi)的端口,都需要有相應(yīng)的監(jiān)聽(tīng)程序才可以
推薦Linux視頻教程,學(xué)習(xí)地址:https://www.php.cn/course/list/33.html