C9500 NetFlow 設定
1. flow record gl_record (流量記錄器):
進到全域設定模式(config)#
!
flow record gl_record
match ipv4 source address
match ipv4 destination address
match ipv4 protocol
match transport source-port
match transport destination-port
match flow cts source group-tag
match flow cts destination group-tag
collect counter bytes long
collect counter packets long
collect timestamp absolute first
collect timestamp absolute last
match ipv4 source address
match ipv4 destination address
match ipv4 protocol
match transport source-port
match transport destination-port
match flow cts source group-tag
match flow cts destination group-tag
collect counter bytes long
collect counter packets long
collect timestamp absolute first
collect timestamp absolute last
!
這定義了你要從網路流量中「記錄」或「收集」哪些欄位資訊。想像成一張清單,列出你關心流量的哪些細節。
匹配條件 (match):這些是 NetFlow 用來識別「同一條流量」的關鍵資訊。只有這些資訊都相同時,才會被視為同一條流量進行聚合。
- ipv4 source address:來源 IPv4 位址
- ipv4 destination address:目的 IPv4 位址
- ipv4 protocol:IP 協定 (例如 TCP、UDP、ICMP 等)
- transport source-port:來源傳輸層埠號 (TCP/UDP)
- transport destination-port:目的傳輸層埠號 (TCP/UDP)
- flow cts source group-tag:來源端 Cisco TrustSec (CTS) 群組標籤
- flow cts destination group-tag:目的端Cisco TrustSec群組標籤
收集資料 (collect):這些是當流量匹配上述條件後,額外要收集的統計數據或時間戳記。
- counter bytes long:流量的總位元組數 (長整數型態)
- counter packets long:流量的總封包數 (長整數型態)
- timestamp absolute first:流量開始時間的絕對時間戳
- timestamp absolute last:流量結束時間的絕對時間戳
2. flow exporter gl_export (流量匯出器):
進到全域設定模式(config)#
!
flow exporter gl_export
destination 192.168.11.111
transport udp 2055
!
這定義了收集到的 NetFlow 數據要傳送到哪裡。
將「流量記錄器」和「流量匯出器」連結起來。
- destination 192.168.11.111:數據將被送到這個 IP 的 NetFlow 收集器 (Collector)。
- transport udp 2055:使用 UDP 2055 埠號傳送,可以自行變更。
3. flow monitor gl_monitor (流量監控器):
進到全域設定模式(config)#
!
flow monitor gl_monitor
exporter gl_export
record gl_record
!
- exporter gl_export:指定使用哪個匯出器來傳送數據。
- record gl_record:指定使用哪個記錄器來定義要收集的流量資訊。
4. interface TwentyFiveGigE2/0/41 (介面應用):
進到全域設定模式(config)#
!
interface TwentyFiveGigE2/0/41
ip flow monitor gl_monitor input
ip flow monitor gl_monitor output
!
最後一步,將設定好的 monitor 應用到指定的介面上。- ip flow monitor gl_monitor input:在介面 TwentyFiveGigE2/0/41 的「輸入」流量上啟用monitor,監控從該介面進入交換器的流量。
- ip flow monitor gl_monitor output:在介面 TwentyFiveGigE2/0/41 的「輸出」流量上啟用monitor,監控從交換器經由該介面離開的流量。
參考資料:https://www.cisco.com/c/zh_tw/support/docs/switches/catalyst-9300-series-switches/218311-configure-and-verify-netflow-avc-and-e.html
留言
張貼留言