見出し画像

softflowdのIPFIXでMACアドレスを送信する方法を見つけた

今朝は、3時20分に助手の猫さんが起こしてくれました。ご飯をあげて納まりましたが、眠かったので二度寝していると4時半ぐらいに、また起こしにきました。まだ、眠かったのですが、ひつこく起こされたので、起きることにしました。

何日か前に

でTWSNMP FC/FKでvYOSが送信するIPFIXの受信に問題がある話を書きました。最新のバージョンでは修正しましたが、テストで使っているsoftflowdでMACアドレスや時刻のフォーマットを変更できないか調べたので、今朝はその話を書きます。

softflowdについては、

で紹介しています。

 のipfix.cのソースコードを読んでみると、MACアドレスを送信するコードがありました。有効にする方法を追っていくと起動パラメータで指定できることがわかりました。

Usage: softflowd [options] [bpf_program]
This is softflowd version 1.0.0. Valid commandline options:
  -i [idx:]interface      Specify interface to listen on
  -r pcap_file            Specify packet capture file to read
  -t timeout=time         Specify named timeout
  -m max_flows            Specify maximum number of flows to track (default 8192)
  -n host:port            Send Cisco NetFlow(tm)-compatible packets to host:port
  -p pidfile              Record pid in specified file
                          (default: /var/run/softflowd.pid)
  -c socketfile           Location of control socket
                          (default: /var/run/softflowd.ctl)
  -v 1|5|9|10|psamp       NetFlow export packet version
                          10 means IPFIX and psamp means PSAMP (packet sampling)
  -L hoplimit             Set TTL/hoplimit for export datagrams
  -T full|port|proto|ip|  Set flow tracking level (default: full)
     vlan                 ("vlan" tracking means "full" tracking with vlanid)
     ether                ("ether" tracking means "vlan" tracking with ether header)
  -6                      Track IPv6 flows, regardless of whether selected
                          NetFlow export protocol supports it
  -d                      Don't daemonise (run in foreground)
  -D                      Debug mode: foreground + verbosity + track v6 flows
  -P udp|tcp|sctp         Specify transport layer protocol for exporting packets
  -A sec|milli|micro|nano Specify absolute time format form exporting records
  -s sampling_rate        Specify periodical sampling rate (denominator)
  -B bytes                Libpcap buffer size in bytes
  -b                      Bidirectional mode in IPFIX (-b work with -v 10)
  -a                      Adjusting time for reading pcap file (-a work with -r)
  -C capture_length       Specify length for packet capture (snaplen)
  -l                      Load balancing mode for multiple destinations
  -R receive_port         Specify port number for PSAMP receive mode
  -N                      Disable promiscuous mode
  -S send_interface_name  Specify send interface name
  -h                      Display this help

-T にetherと指定すれば、IPFIXで、送信元、宛先のMACアドレスをレポートするようになりました。-Aにmilliを指定するとタイムスタンプもvyOSと同じようにmSec単位のUNIXタイムで送信するようになりました。

他にもいろいろできるようです。
softflowwdが対応してないとか思ってしまって、申し訳ないです。

明日に続く


開発のための諸経費(機材、Appleの開発者、サーバー運用)に利用します。 ソフトウェアのマニュアルをnoteの記事で提供しています。 サポートによりnoteの運営にも貢献できるのでよろしくお願います。