tree: 1675dc63e202dee0175e94e521e92e8e458f6342 [path history] [tgz]
  1. data-plane-tracing.c
  2. data-plane-tracing.py
  3. README.md
  4. scenario.jpg
  5. test_setup.sh
  6. test_traffic.sh
examples/networking/vlan_filter/README.md

VLAN Filter

This is eBPF application to parse VXLAN packets and then extracts encapsulated VLAN packets to monitor traffic from each VLAN. Extracted packet header fields can be stored in a file or sent to remote server via Apache Kafka messaging system.

Also part of this example is a simulation of a multi-host environment. Simulation environment can be setup by using test_setup.sh script. Then a sample script (traffic.sh) can be used to send traffic from one client (VLAN=100) from host1 talking to another client at host2 and one client (VLAN=200) from host2 talking to another client at host1 while running vlan_filter application in parallel by using command ‘python data-plane-tracing -i veth7’.

picture

Usage Example

  • $ sudo python data-plane-tracing.py
TimestampHost NameHost IPIP VersionSource Host IPDest Host IPSource Host PortDest Host PortVNISource VM MACDest VM MACVLAN IDSource VM IPDest VM IPProtocolSource VM PortDest VM PortPacket Length
2018-05-24 18:43:30.386228Box1x.x.x.x410.1.1.1110.1.1.1254836478910fa:16:3e:ec:22:99fa:16:3e:1c:6f:2d100192.168.100.11192.168.100.1261285203021200

Implementation overview

Example application implementation is split into two parts: the former that exploits eBPF code, the latter that performs some additional processing in user space (python wrapper).

First part: eBPF Filter

This component filters VXLAN packets. The program is loaded as PROG_TYPE_SOCKET_FILTER and attached to a socket, bind to eth0. Packets matching VXLAN filter are forwarded to the user space, while other packets are dropped.

Python code in user space

The Python script reads filtered raw packets from the socket, extracts all the useful header fields and stores extracted packet into a file by default or can be sent to a remote server via Apache Kafka messaging system.

How to execute this example application

VLAN Filter application can be executed by using one of the below commands:

  • $ sudo python data-plane-tracing.py
  • $ sudo python data-plane-tracing -i eth2 -k vc.manage.overcloud:9092

How to install Required Dependencies

  • $ pip install kafka-python
  • $ pip install netifaces