關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • Linux 流量分析的指令

    Posted on January 10th, 2007 Sam Tang 3 comments

    在高流量的 Linux server 下分析流量十分有用,以下是幾個有用的指令:

    1. 列出每個連線 IP 的連線數量:

    netstat -nta | fgrep "ESTABLISHED" | cut -b 49-75 | cut -d ':' -f1 | sort | uniq -c | sort -n -r –key=1,7 | head -25

    2. 列出每個 IP 的 SYN_RECV 連線數量:

    netstat -nta | fgrep "SYN_RECV" | cut -b 49-75 | cut -d ':' -f1 | sort | uniq -c | sort -n -r –key=1,7 | head -25

    3. 列出 connection state 的連線數量:

    netstat -nta | fgrep ":" | cut -b 77-90 | sort | uniq -c


     

    3 responses to “Linux 流量分析的指令”

    1. [...] 參考來源:Real-Blog Linux流量分析的指令 [...]

    2. [...] http://www.real-blog.com/linux-bsd-notes/323 [...]

    3. [...] Linux 流量分析的指令 – Real-Blog (tags: Tech Linux Network Tips) [...]

    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word