Computer >> Hướng Dẫn Máy Tính >  >> Kết Nối Mạng >> An Ninh Mạng

Các công cụ Linux giám sát bảo mật mạng (Network Security Monitoring)

Phân loại công cụ giám sát mạng trên Linux

LoạiCông cụ tiêu biểuMô tả
Network Traffic Analysis (NTA) / Packet Capture Wireshark, tcpdump, Zeek (Bro), Suricata, Arkime (Moloch), ntopng Thu thập, phân tích gói tin sâu (full packet capture), phát hiện bất thường, protocol analysis.
Network Intrusion Detection/Prevention (NIDS/NIPS) Suricata, Snort, Zeek, Snort3 Kiểm tra traffic theo signature (rules) & behavioral analysis, alert/chặn real-time.
Flow/NetFlow Analysis nfdump, nfsen, ElastiFlow (ELK), Kentik, SolarWinds (commercial) Thu thập metadata (NetFlow/sFlow/IPFIX) để xem traffic pattern, DDoS, anomaly.
Host-based Network Monitoring Auditd, Sysmon (Linux port), eBPF tools (bpftrace, BCC, Tetragon, Cilium) Giám sát system call, socket, process network activity ở kernel level.
Infrastructure/Device Monitoring Prometheus + Node Exporter, Zabbix, Nagios/Icinga2, Checkmk, Telegraf/InfluxDB/Grafana Giám sát health, bandwidth, CPU, RAM, interface errors của router/switch/server.
Log Collection & SIEM rsyslog/syslog-ng > Elasticsearch/Logstash/Kibana (ELK), Graylog, Wazuh, Splunk Tập trung log firewall, router, switch, server; correlation, alerting, dashboard.
Vulnerability Scanning / Asset Discovery OpenVAS (Greenbone), Nmap, Masscan, Nuclei, Lynis Quét lỗ hổng, phát hiện tài sản, kiểm tra cấu hình an toàn (CIS Benchmark).
Threat Hunting / Forensics Velociraptor, GRR, Osquery, KAPE (Windows), Volatility (memory) Truy vấn endpoint, timeline analysis, IOC matching.

Top công cụ miễn phí/mở (Open Source) phổ biến

1. Zeek (trước đây Bro) – Network Security Monitor chuẩn vàng

  • Phân tích protocol sâu (HTTP, DNS, SSL, SMB, v.v.), ghi log cấu trúc (JSON/TSV).
  • Scripting language mạnh để custom detection.
  • Tích hợp tốt với ELK, Splunk, Kafka.
  • Cài đặt: sudo apt install zeek (Ubuntu/Debian).

2. Suricata – IDS/IPS/NSM đa luồng, hiệu năng cao

  • Hỗ trợ multi-threading, GPU offload, Rust-based rules.
  • Ruleset: Emerging Threats (ET Pro), Snort VRT.
  • Chạy chế độ IDS (passive) hoặc IPS (inline NFQUEUE/AF_PACKET).
  • Output: Eve JSON (SIEM ready).

3. Wireshark / TShark – Phân tích gói tin chuyên sâu

  • GUI (Wireshark) hoặc CLI (TShark) cho capture & analyze pcap.
  • Filter display/capture mạnh mẽ, dissect hàng trăm protocol.
  • Dùng cho incident response, troubleshooting, malware traffic analysis.

4. ntopng – Web-based traffic visibility

  • Dashboard real-time: top talkers, flows, protocols, ASN, geoIP, alerts.
  • Hỗ trợ NetFlow/sFlow/IPFIX, nProbe agent.
  • Community edition miễn phí, Enterprise có thêm historical, API.

5. Arkime (Moloch) – Full Packet Capture & Search

  • Index gói tin (PCAP) vào Elasticsearch, tìm kiếm cực nhanh theo IP, domain, hash, string.
  • Session reconstruction, PCAP download, SPI view.
  • Phù hợp threat hunting, forensic.

6. Prometheus + Grafana – Metrics & Alerting

  • Node Exporter (host metrics), SNMP Exporter (network device), Blackbox Exporter (probing).
  • Alertmanager quản lý cảnh báo.
  • Dashboard mạng: bandwidth, errors, drops, BGP, interface status.

7. Lynis – Security Auditing & Hardening

  • Quét cấu hình hệ thống, kernel, network, services, packages, logging, crypto.
  • Điểm số hardening, khuyến nghị cụ thể (CIS, NIST).
  • Chạy: sudo lynis audit system.

8. Nmap / Ncat / Ndiff – Discovery & Scanning

  • Host discovery, port scan, service version, OS fingerprint, NSE scripts (vuln, auth, brute).
  • Ncat: Swiss-army knife network (connect, listen, proxy, SSL, broker).
  • Ndiff: so sánh kết quả scan theo thời gian.

Thực hành triển khai NSM trên Linux (Mini Architecture)

┌─────────────┐     SPAN/TAP      ┌──────────────┐
│  Core Switch │ ─────────────────▶ │  Sensor Box  │
│  (Aggregation)│  (Mirror traffic)  │  (Linux)     │
└─────────────┘                    │  - Zeek      │
                                   │  - Suricata  │
                                   │  - Arkime    │
                                   │  - Prometheus│
                                   └──────┬───────┘
                                          │ Logs/Metrics
                                          ▼
                                   ┌──────────────┐
                                   │   SIEM/Log   │
                                   │   Platform   │
                                   │ (ELK/Splunk/ │
                                   │  Graylog)    │
                                   └──────────────┘

Lệnh Linux hữu ích cho Network Monitoring

LệnhChức năng
ss -tulnpXem socket listening (thay netstat)
iptables -nvL / nft list rulesetXem firewall rules
tcpdump -i eth0 -w capture.pcapCapture gói tin ra file
nethogsBandwidth per process (top-like)
iftop -i eth0Bandwidth per connection (real-time)
bmonBandwidth monitor đa interface
vnstat -i eth0Lịch sử traffic (daily/monthly)
ip link set eth0 promisc onBật promiscuous mode cho sniffing
ethtool -S eth0NIC statistics (errors, drops, collisions)
sar -n DEV 1 10Network device stats (sysstat)

Phân phối Linux chuyên dụng cho Network Security

  • Security Onion 2: Distro sẵn sàng NSM (Zeek, Suricata, Elastic, Kibana, Stenographer, Playbook, Fleet, Osquery...). Cài xong chạy ngay.
  • Kali Linux: Offensive security, nhưng cũng có công cụ monitoring (Wireshark, Nmap, tcpdump, bettercap).
  • Parrot Security OS: Tương tự Kali, nhẹ hơn, có AnonSurf.
  • BlackArch: Arch-based, >2500 tools.
  • NST (Network Security Toolkit): Fedora-based, tập trung network analysis.

Best Practice triển khai NSM trên Linux

  1. Dùng Security Onion cho sensor chuyên dụng (SO sensor node).
  2. Thu thập Zeek logs + Suricata alerts về SIEM tập trung.
  3. Bật NetFlow/sFlow trên switch/router, thu thập bằng nfcapd/ElastiFlow.
  4. Triển khai eBPF (Cilium/Tetragon) trên Kubernetes/container host để visibility L7.
  5. Hardening sensor: minimal packages, no direct internet, dedicated management VLAN, full disk encryption.
  6. Backup config & rule sets (GitOps).
  7. Test detection thường xuyên (Atomic Red Team, Caldera, Red Canary).