Rate This Document
Findability
Accuracy
Completeness
Readability

Traffic Sampling

  1. Configure sFlow on the sender.
    Run the following command on host 1:
    ovs-vsctl -- --id=@sflow create sflow agent=enp3s0 target=\"<host2_ip>:6343\" header=128 sampling=64 polling=10 -- set bridge br-ovs sflow=@sflow
    • target: IP address of the collector.
    • agent: sFlow egress.
    • bridge: OVS bridge name

  2. Install the sflowtool on the collector.
    1
    2
    3
    4
    5
    6
    7
    git config --global http.sslVerify false
    git clone https://github.com/sflow/sflowtool
    cd sflowtool
    ./boot.sh
    ./configure
    make
    make install
    
  3. Use sFlow.
    Run the following command on host 2:
    ./src/sflowtool -p 6343
  4. Start two VMs on the sender to send packets. On the physical machine used to sample traffic, check the sampling result.

    The following information is displayed:

    1
    2
    3
    4
    5
    6
    7
    headerBytes E4-11-22-33-44-51-E4-11-22-33-44-50-08-00-45-00-00-54-D4-4E-00-00-40-01-22-DF-C0-A8-01-15-C0-A8-01-16-00-00-B9-20-2B-93-00-1A-D6-87-9A-5F-00-00-00-00-E7-77-04-00-00-00-00-00-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37
    dstMAC e41122334451
    srcMAC e41122334450
    IPSize 84
    ip.tot_len 84
    srcIP 192.168.1.21
    dstIP 192.168.1.22
    
  5. Delete the network.
    1
    ovs-vsctl del-br br-ovs
    
  6. Configure NetFlow on the sender.
    Run the following command on host 1:
    ovs-vsctl -- set Bridge br-ovs netflow=@nf -- --id=@nf create NetFlow target=\"<host2_ip>:2055\" active-timeout=60
  7. Use NetFlow.
    Run the following command on host 2:
    ./src/sflowtool -p 2055
  8. Repeat 4 and check the sampling result.

    The following information is displayed:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    startDatagram =================================
    datagramSourceIP 192.168.48.60
    datagramSize 120
    unixSecondsUTC 1607393677
    localtime 2020-12-08T10:14:37+0800
    datagramVersion 327682
    unexpected datagram version number
     (source IP = 192.168.48.60)
    00-05-00-02-<*>-00-00-d7-15-5f-ce-e1-ac-2a-e4-37-46
    00-00-00-01-5b-5b-00-00-c0-a8-63-0b-c0-a8-63-15
    00-00-00-00-00-09-00-01-00-00-00-08-00-00-02-a6
    00-00-5f-a7-00-00-60-1a-c9-26-14-51-00-1a-06-00
    00-00-00-00-00-00-00-00-c0-a8-63-15-c0-a8-63-0b
    00-00-00-00-00-01-00-09-00-00-00-07-00-00-01-da
    00-00-5f-a9-00-00-60-1a-14-51-c9-26-00-1a-06-00
    00-00-00-00-00-00-00-00
    caught exception: 2
    endDatagram   =================================