1 / 20

Netflow 建置與應用

Netflow 建置與應用. gslin@ccca.nctu.edu.tw 林嘉軒. 簡介. 前面會講 Netflow 的概念 運作方式 用途 後面會提到 Netflow 實做的部分 在 UNIX 上面安裝相關軟體 撰寫相關程式分析數據. 什麼是 Netflow ?. 紀錄流過封包的摘要,通常包括了: Protocol 種類 (ICMP/TCP/UDP/…) Port 號碼 (TCP/UDP/…) 封包數目 封包大小 一開始是在 Cisco Router 上所提供 幾乎是工業標準. Netflow 的用途 ?. 統計流量

raanan
Télécharger la présentation

Netflow 建置與應用

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Netflow 建置與應用 gslin@ccca.nctu.edu.tw 林嘉軒

  2. 簡介 • 前面會講 Netflow 的概念 • 運作方式 • 用途 • 後面會提到 Netflow 實做的部分 • 在 UNIX 上面安裝相關軟體 • 撰寫相關程式分析數據

  3. 什麼是 Netflow ? • 紀錄流過封包的摘要,通常包括了: • Protocol 種類 (ICMP/TCP/UDP/…) • Port 號碼 (TCP/UDP/…) • 封包數目 • 封包大小 • 一開始是在 Cisco Router 上所提供 • 幾乎是工業標準

  4. Netflow 的用途? • 統計流量 • 流量監控、流量分析、使用生態分析 • 詳細的連線記錄 • 連線記錄可以作為證據

  5. Netflow 運作方式 (1) 上游 有 Netflow 功能 Router 的作法 Packet Summary Netflow Router PC (統計用的主機) 內部網路

  6. Netflow 運作方式 (2) 上游 沒有 Netflow 功能 Router 的作法 沒有 Netflow 功能的 Router Packet (NOT SUMMARY!!!) 有 Port Mirror 功能的 Switch PC (統計用的主機) 內部網路

  7. Netflow 的硬體需求 • 製造 flow 的工具 • Cisco 7 series router,或是… • NTOP 以及一顆有 Port Mirror 功能的 Switch • 計算 flow 的工具 • 一台 PC • CPU 隨意,記憶體要大,最好有 512MB • 硬碟要大,看需要選擇用 IDE 或 RAID5

  8. Netflow 的軟體需求 • OS: • FreeBSD 或是 Linux 都可以 • 產生 flow 的軟體: • flow-tools • NetflowExporter • NTOP • 統計軟體: • 視需求自己撰寫或是修改程式

  9. 硬體的設定 • 在 Cisco Router 上設定: • ip flow-export <IP> <Port> • ip flow-export 192.168.1.1 56789

  10. 軟體的安裝 (flow-tools) • flow-tools 可以在下面這個網址抓到:http://www.splintered.net/sw/flow-tools/ • 在 FreeBSD 上有 ports 可以安裝 • /usr/ports/net/flow-tools • make all install clean

  11. 軟體的設定 (flow-tools) • flow-capture 接收 Router 丟過來的 Data • flow-capture -e 1440 -N 0 -n 143 -z 6 -w <PATH> • -e 1440 表示保留 1440 個檔案 (十天) • -N 0 請參考 man flow-capture 的說明 • -n 143 表示每天有 144 個檔案,也就是設定為十分鐘一個檔案。 • -z 6 表示壓縮率,通常 6 就夠用 • -w <PATH> 表示要把檔案放到那個路徑

  12. 無 Netflow 功能時使用的軟體 • 中央大學劉劍青先生寫的 NetflowExporter • http://sunsite.cc.ncu.edu.tw/NetflowExporter/ • NTOP • http://www.ntop.org/ (原始站台) • /usr/ports/net/ntop (FreeBSD Ports)

  13. 軟體的使用 - flow-print • flow-print 負責將存起來的 Rawdata 顯示出來 • flow-cat <PATH>/<FILE> | flow-print -f3 | less • -f3 為顯示的格式,請參考 man flow-print 裡面的說明 • less 是分頁用的工具

  14. 軟體的使用 - flow-print (範例) • srcIP dstIP prot srcPort dstPort octets packets • 140.113.146.74 202.216.248.253 6 1338 84 40 1 • 140.113.146.143 202.216.248.253 6 1604 85 40 1 • 140.113.146.38 202.216.248.253 6 1685 86 40 1 • 140.113.146.238 202.216.248.253 6 1325 87 40 1 • 140.113.146.252 202.216.248.253 6 1901 88 40 1 • 163.28.48.71 140.113.20.47 6 4379 80 44 1 • 140.113.146.66 202.216.248.253 6 1729 89 40 1 • 163.19.53.133 198.104.180.99 17 1029 137 78 1 • 140.113.146.164 202.216.248.253 6 1311 90 40 1 • 140.113.146.80 202.216.248.253 6 1109 91 40 1 • 140.113.20.47 163.28.48.71 6 80 4379 40 1 • 140.113.146.143 202.216.248.253 6 1952 92 40 1 • 66.79.10.211 163.28.64.112 6 80 3227 281 4

  15. 軟體的使用 - ACL • ACL 可以設定要過濾哪些 flow • 但是只包括 IP,不包括 Port • flow.acl (或者隨便取): • ip access-list standard nctu deny 140.113.96.0 0.0.3.255 (新竹中學的範圍) • ip access-list standard nctu permit 140.113.0.0 0.0.255.255

  16. 軟體的使用 - flow-filter • 透過 ACL 過濾 (filter) flow • flow-cat <PATH>/<FILE> | flow-filter -p 53 -S nctu -f flow.acl | flow-print -f3 | less • -p 53 是規定 source port 是 53 • -S 是 source ip 符合 nctu 的規定 • -f 是 ACL 的檔案位置

  17. 軟體的使用 - flow-filter (範例) • srcIP dstIP prot srcPort dstPort octets packets • 140.113.1.1 163.28.64.11 17 53 41633 77 1 • 140.113.1.1 163.28.64.11 17 53 41634 123 1 • 140.113.1.1 163.28.64.11 17 53 41635 85 1 • 140.113.1.1 163.28.64.11 17 53 41636 135 1 • 140.113.1.1 163.28.64.11 17 53 41637 128 1 • 140.113.1.1 163.28.64.11 17 53 41638 125 1 • 140.113.1.1 163.28.64.11 17 53 41639 83 1 • 140.113.20.1 61.222.153.82 17 53 2767 138 1 • 140.113.1.1 163.28.64.11 17 53 41640 108 1 • 140.113.1.1 163.28.64.11 17 53 41641 120 1

  18. 流量統計 (1) • http://netflow.hcrc.edu.tw/stat/ • 以 flow-print 顯示出來的訊息計算 • 以 Perl 撰寫 • 以 MySQL 儲存每天的統計資料 • 以 PHP 作為介面查閱資料

  19. 流量統計 (2)

  20. 結語 • 有問題請發問

More Related