2019-04-24 14:20:36 3001瀏覽
今天扣丁學(xué)堂Linux培訓(xùn)老師給大家分享一篇關(guān)于如何檢查L(zhǎng)inux中的開放端口列表的詳細(xì)介紹,首先如果你想檢查遠(yuǎn)程Linux系統(tǒng)上的端口是否打開請(qǐng)點(diǎn)擊鏈接瀏覽。如果你想檢查多個(gè)遠(yuǎn)程Linux系統(tǒng)上的端口是否打開請(qǐng)點(diǎn)擊鏈接瀏覽。如果你想檢查多個(gè)遠(yuǎn)程Linux系統(tǒng)上的多個(gè)端口狀態(tài)請(qǐng)點(diǎn)擊鏈接瀏覽。但是本文幫助你檢查本地系統(tǒng)上的開放端口列表。
# netstat -tplugn 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:25 0.0.0.0:* LISTEN 2038/master tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 1396/snmpd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1398/httpd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1388/sshd tcp6 0 0 :::25 :::* LISTEN 2038/master tcp6 0 0 :::22 :::* LISTEN 1388/sshd udp 0 0 0.0.0.0:39136 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:56130 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:40105 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:11584 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:30105 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:50656 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:1632 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:28265 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:40764 0.0.0.0:* 1396/snmpd udp 0 0 10.90.56.21:123 0.0.0.0:* 895/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 895/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 895/ntpd udp 0 0 0.0.0.0:53390 0.0.0.0:* 1396/snmpd udp 0 0 0.0.0.0:161 0.0.0.0:* 1396/snmpd udp6 0 0 :::123 :::* 895/ntpd IPv6/IPv4 Group Memberships Interface RefCnt Group --------------- ------ --------------------- lo 1 224.0.0.1 eth0 1 224.0.0.1 lo 1 ff02::1 lo 1 ff01::1 eth0 1 ff02::1 eth0 1 ff01::1
# # netstat -tplugn | grep :22 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1388/sshd tcp6 0 0 :::22 :::* LISTEN 1388/sshd
# ss -lntu Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port udp UNCONN 0 0 *:39136 *:* udp UNCONN 0 0 *:56130 *:* udp UNCONN 0 0 *:40105 *:* udp UNCONN 0 0 *:11584 *:* udp UNCONN 0 0 *:30105 *:* udp UNCONN 0 0 *:50656 *:* udp UNCONN 0 0 *:1632 *:* udp UNCONN 0 0 *:28265 *:* udp UNCONN 0 0 *:40764 *:* udp UNCONN 0 0 10.90.56.21:123 *:* udp UNCONN 0 0 127.0.0.1:123 *:* udp UNCONN 0 0 *:123 *:* udp UNCONN 0 0 *:53390 *:* udp UNCONN 0 0 *:161 *:* udp UNCONN 0 0 :::123 :::* tcp LISTEN 0 100 *:25 *:* tcp LISTEN 0 128 127.0.0.1:199 *:* tcp LISTEN 0 128 *:80 *:* tcp LISTEN 0 128 *:22 *:* tcp LISTEN 0 100 :::25 :::* tcp LISTEN 0 128 :::22 :::*
# # ss -lntu | grep ':25' tcp LISTEN 0 100 *:25 *:* tcp LISTEN 0 100 :::25 :::*
# nmap -sTU -O localhost Starting Nmap 6.40 ( http://nmap.org ) at 2019-03-20 09:57 CDT Nmap scan report for localhost (127.0.0.1) Host is up (0.00028s latency). Other addresses for localhost (not scanned): 127.0.0.1 Not shown: 1994 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http 199/tcp open smux 123/udp open ntp 161/udp open snmp Device type: general purpose Running: Linux 3.X OS CPE: cpe:/o:linux:linux_kernel:3 OS details: Linux 3.7 - 3.9 Network Distance: 0 hops OS detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 1.93 seconds
# nmap -sTU -O localhost | grep 123 123/udp open ntp
# lsof -i COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ntpd 895 ntp 16u IPv4 18481 0t0 UDP *:ntp ntpd 895 ntp 17u IPv6 18482 0t0 UDP *:ntp ntpd 895 ntp 18u IPv4 18487 0t0 UDP localhost:ntp ntpd 895 ntp 20u IPv4 23020 0t0 UDP CentOS7.2daygeek.com:ntp sshd 1388 root 3u IPv4 20065 0t0 TCP *:ssh (LISTEN) sshd 1388 root 4u IPv6 20067 0t0 TCP *:ssh (LISTEN) snmpd 1396 root 6u IPv4 22739 0t0 UDP *:snmp snmpd 1396 root 7u IPv4 22729 0t0 UDP *:40105 snmpd 1396 root 8u IPv4 22730 0t0 UDP *:50656 snmpd 1396 root 9u IPv4 22731 0t0 UDP *:pammratc snmpd 1396 root 10u IPv4 22732 0t0 UDP *:30105 snmpd 1396 root 11u IPv4 22733 0t0 UDP *:40764 snmpd 1396 root 12u IPv4 22734 0t0 UDP *:53390 snmpd 1396 root 13u IPv4 22735 0t0 UDP *:28265 snmpd 1396 root 14u IPv4 22736 0t0 UDP *:11584 snmpd 1396 root 15u IPv4 22737 0t0 UDP *:39136 snmpd 1396 root 16u IPv4 22738 0t0 UDP *:56130 snmpd 1396 root 17u IPv4 22740 0t0 TCP localhost:smux (LISTEN) httpd 1398 root 3u IPv4 20337 0t0 TCP *:http (LISTEN) master 2038 root 13u IPv4 21638 0t0 TCP *:smtp (LISTEN) master 2038 root 14u IPv6 21639 0t0 TCP *:smtp (LISTEN) sshd 9052 root 3u IPv4 1419955 0t0 TCP CentOS7.2daygeek.com:ssh->Ubuntu18-04.2daygeek.com:11408 (ESTABLISHED) httpd 13371 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13372 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13373 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13374 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13375 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN)
# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 1398 root 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13371 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13372 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13373 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13374 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN) httpd 13375 apache 3u IPv4 20337 0t0 TCP *:http (LISTEN)
想要了解更多關(guān)于Linux開發(fā)方面內(nèi)容的小伙伴,請(qǐng)關(guān)注扣丁學(xué)堂Linux培訓(xùn)官網(wǎng)、微信等平臺(tái),扣丁學(xué)堂IT職業(yè)在線學(xué)習(xí)教育有專業(yè)的Linux講師為您指導(dǎo),此外扣丁學(xué)堂老師精心推出的Linux視頻教程定能讓你快速掌握Linux從入門到精通開發(fā)實(shí)戰(zhàn)技能??鄱W(xué)堂Linux技術(shù)交流群:422345477。
【關(guān)注微信公眾號(hào)獲取更多學(xué)習(xí)資料】 【掃碼進(jìn)入HTML5前端開發(fā)VIP免費(fèi)公開課】
查看更多關(guān)于“Linux培訓(xùn)資訊”的相關(guān)文章>>