Loading...

實用的 netstat 查詢連線指令

Temperature: 0 °C

蘇恆永 蘇恆永
author_tools

以下是一些實用的 netstat 語法,可以檢查主機的連線數量:

netstat -na
顯示主機上所有已建立的連線。


netstat -an | grep :80 | sort
顯示所有 port 80 的連線,並把結果排序。


netstat -n -p|grep SYN_REC | wc -l
列出主機上有多少個 SYNC_REC,一般上這個數字應該相當低。


netstat -n -p | grep SYN_REC | sort -u
同樣是列出 SYNC_REC,但不只列出數字,而是將每個 SYNC_REC 的連線列出。


netstat -n -p | grep SYN_REC | awk ‘{print $5}’ | awk -F: ‘{print $1}’
列出發送 SYNC_REC 的所有 ip 地址。


netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
計算每一個 ip 在主機上建立的連線數量。


netstat -anp |grep ‘tcp|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
列出從 TCP 或 UDP 連線到主機的 ip 的數量。


netstat -ntu | grep ESTAB | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -nr
列出每個 ip 建立的 ESTABLISHED 連線數量。


netstat -plan|grep :80|awk {‘print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1
列出每個 ip 建立的 port 80 連線數量。


/misc/log/lighttpd # netstat -anl | grep 80 | awk '/^tcp/ {t[$NF]++}END{for(state in t){print state, t[state]} }'
列出 80 port 各種 tcp 狀態的數量統計


參考來源: http://www.phpini.com/linux/netstat-check-connections

捷運科技大樓站 Go

https://innstory.com/story-實用的_netstat_查詢連線指令-401
Linux 網管

Prev
 Linux_連線數調校

Next
ankhsvn_使用非標準_ssh_port,_及設定免密碼登入 

Nearby Attractions

捷運科技大樓站-Nearby Attractions

  • 李國鼎故居 Go
  • 陽明山中山樓 Go
  • 國立臺灣大學日式宿舍-福州街... Go
  • 七海寓所(蔣經國故居) Go
  • 臨濟護國禪寺 Go
  • 寶藏巖 Go

About the Author

蘇恆永

重新pickup本能中

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

vmware 的 vm 網卡如何改成固定 mac

vmware 的 vm 網卡...

http://wahlnetwork.com////rej...

ankhsvn 使用非標準 ssh port, 及設定免密碼登入

ankhsvn 使用非標準 ...

ankhsvn https://ankhsvn.open.c...

Python TimeUUID

Python TimeUUI...

參考這一篇: 什麼時候讓用 time UUID,https:...

Recommended reading

Other stories happened at this address

Linux 連線數調校.

Linux 連線數調校.

最近常常遇到連線數太多(因為底層 WebService 太忙了). web 最後連不上的問題. 後來...

ankhsvn 使用非標準 ssh port, 及設定免密碼登入

ankhsvn 使用非標準 ...

ankhsvn https://ankhsvn.open.c...

vmware 的 vm 網卡如何改成固定 mac

vmware 的 vm 網卡...

http://wahlnetwork.com////rej...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format