-
Bug
-
Resolution: Done
-
Medium
-
None
-
None
-
None
-
None
Description:
IPFIX among other parameters allows to configure a port of collector.
_______ _ _ _____ ___
__/ __/ _ \ (_)__ | | / / _ \/ _ \
_/ _// // / / / _ \ | |/ / ___/ ___/
/_/ /____(_)_/\___/ |___/_/ /_/
vpp# set ipfix exporter ?
set ipfix exporter set ipfix exporter collector <ip4-address> [port <port>] src <ip4-address> [fib-id <fib-id>] [path-mtu <path-mtu>] [template-interval <template-interval>]
vpp#
But if the port is set to different value than the default is,
e.g. 4444 instead of 4739 which is the default, then packets
with template will arrive at the configured 4444 port, but
packets with data will still go to port 4739.
Tested with VPP Version 20.01:
_______ _ _ _____ ___ __/ __/ _ \ (_)__ | | / / _ \/ _ \ _/ _// // / / / _ \ | |/ / ___/ ___/ /_/ /____(_)_/\___/ |___/_/ /_/ vpp# show version verbose cmdline Version: v20.01-rc2~11-gfce396738~b17 Compiled by: root Compile host: b81dced13911 Compile date: 2020-01-29T21:07:15 Compile location: /w/workspace/vpp-merge-2001-ubuntu1804 Compiler: GCC 8.3.0 Current PID: 1 Command line arguments: /usr/bin/vpp unix { nodaemon cli-listen 0.0.0.0:5002 cli-no-pager log /tmp/vpp.log full-coredump } plugins { plugin dpdk_plugin.so { disable } } api-trace { on } socksvr { default } statseg { default per-node-counters on } nat { endpoint-dependent translation hash buckets 1048576 translation hash memory 268435456 user hash buckets 1024 max translations per user 10000 } vpp#
Configuration:
1. Interfaces on VPP side
_______ _ _ _____ ___ __/ __/ _ \ (_)__ | | / / _ \/ _ \ _/ _// // / / / _ \ | |/ / ___/ ___/ /_/ /____(_)_/\___/ |___/_/ /_/ vpp# create tap id 1 host-if-name vpptap1 tap1 vpp# create tap id 2 host-if-name vpptap2 tap2 vpp# set int ip address tap1 10.10.10.1/24 vpp# set int ip address tap2 20.20.20.1/24 vpp# set int state tap1 up vpp# set int state tap2 up vpp# quit
2. Interfaces on Linux side:
root@73ba4f8caa85:/# ip addr add 10.10.10.2/24 dev vpptap1 root@73ba4f8caa85:/# ip addr add 20.20.20.2/24 dev vpptap2 root@73ba4f8caa85:/# ip link set dev vpptap1 up root@73ba4f8caa85:/# ip link set dev vpptap2 up root@73ba4f8caa85:/# ip -br -o a lo UNKNOWN 127.0.0.1/8 vpptap1 UNKNOWN 10.10.10.2/24 vpptap2 UNKNOWN 20.20.20.2/24 eth0@if254 UP 172.17.0.2/16 root@73ba4f8caa85:/#
3. IPFIX and Flowprobe configuration:
_______ _ _ _____ ___
__/ __/ _ \ (_)__ | | / / _ \/ _ \
_/ _// // / / / _ \ | |/ / ___/ ___/
/_/ /____(_)_/\___/ |___/_/ /_/
vpp# set ipfix exporter collector 10.10.10.2 port 4444 src 10.10.10.1 template-interval 20
Collector 10.10.10.2, src address 10.10.10.1, fib index -1, path MTU 512, template resend interval 20s, udp checksum disabled
vpp# flowprobe params record l2 l3 l4
vpp# flowprobe feature add-del tap2 l2
vpp#
Testing
To test it I've wrote basic UDP packets listener.
Traffic was generated using `ping`:
root@73ba4f8caa85:/# ping 20.20.20.1
Listener of UDP packets on port 4739:
Here you can see that only packets with data arrive.
packet-received: bytes=89 from=10.10.10.1:4739 +-------------------------------------------------------+ | IPFIX Message #12 | +-------------------------------------------------------+ Export Time: 2020-04-16 06:36:35 +0000 UTC Data Set ID: 260 +-------------------------------------------------------+ | END of Message | +-------------------------------------------------------+ packet-received: bytes=89 from=10.10.10.1:4739 +-------------------------------------------------------+ | IPFIX Message #13 | +-------------------------------------------------------+ Export Time: 2020-04-16 06:36:50 +0000 UTC Data Set ID: 260 +-------------------------------------------------------+ | END of Message | +-------------------------------------------------------+
Listener of UDP packets on port 4444:
Here you can see that only packets with templates arrive.
packet-received: bytes=84 from=10.10.10.1:4739 +-------------------------------------------------------+ | IPFIX Message #14 | +-------------------------------------------------------+ Export Time: 2020-04-16 06:37:20 +0000 UTC Template ID: 261 +-------------------------------------------------------+ | END of Message | +-------------------------------------------------------+ packet-received: bytes=68 from=10.10.10.1:4739 +-------------------------------------------------------+ | IPFIX Message #14 | +-------------------------------------------------------+ Export Time: 2020-04-16 06:37:25 +0000 UTC Template ID: 259 +-------------------------------------------------------+ | END of Message | +-------------------------------------------------------+ packet-received: bytes=84 from=10.10.10.1:4739 +-------------------------------------------------------+ | IPFIX Message #14 | +-------------------------------------------------------+ Export Time: 2020-04-16 06:37:40 +0000 UTC Template ID: 260 +-------------------------------------------------------+ | END of Message | +-------------------------------------------------------+
How does listener I've wrote choose if it is Template or Data?:
setID := binary.BigEndian.Uint16(buffer[16:18]) templateID := binary.BigEndian.Uint16(buffer[20:22]) if setID == 2 { fmt.Printf("Template ID: %v\n", templateID) } else { fmt.Printf("Data Set ID: %v\n", setID) }
Explanation:
> Set ID
>
> Identifies the Set. A value of 2 is reserved for Template Sets.
> A value of 3 is reserved for Options Template Sets. Values from 4
> to 255 are reserved for future use. Values 256 and above are used
> for Data Sets.
Copied from https://tools.ietf.org/html/rfc7011