-
Notifications
You must be signed in to change notification settings - Fork 717
VPP How_To_Use_The_Packet_Generator_and_Packet_Tracer
The VPP platform includes packet generation and packet tracing facilities.
The following example shows steps that you might typically use to run a debug version of the vpp executable file, generate packets, and to analyze results.
In the following steps, the VPP executable does not need to be started with superuser permissions. The VPP executable will not discover physical devices when run as a normal user.
From the command line, make the VPP source directory the working directory and run VPP as shown in the following example.
In the following example, including the dpdk argument means that no physical interfaces will be discovered.
$ ./build-root/install-vpp_debug-native/vpp/bin/vpp unix interactive plugins { plugin dpdk_plugin.so { disable } }
From the vpp debug command-line, execute the arp4 script.
DBGvpp# exec src/scripts/vnet/arp4
Let's tale a look at the contents of the setup script that you just executed. The script .../vpp/vnet/etc/scripts/arp4 contains:
packet-generator new {
name x
limit 1
node ip4-input
size 64-64
no-recycle
data {
ICMP: 1.0.0.2 -> 2.0.0.2
ICMP echo_request
incrementing 100
}
}
trace add pg-input 100
loop create
loop create
set int state loop0 up
set int state loop1 up
set int ip address loop0 1.0.0.1/24
set int ip address loop1 2.0.0.1/24
The first stanza creates a packet generator stream called "x" which sends a single ipv4 icmp echo-request when enabled. The trace add command arranges to trace 100 packets originating at the pg-input graph node. If you want to trace packets originating at the "ethernet-input" node - which is probably the most typical real-world use-case - make the substitution for that graph node.
Finally, the script configures a couple of loopback interfaces; primarily, so that ip4-input / ip4-lookup won't immediately ditch the generated packet.
On the vpp debug command-line, enable the packet generator.
DBGvpp# packet-generator enable
Use the show trace command to run the packet tracer.
DBGvpp# show trace
------------------- Start of thread 0 vpp_main -------------------
Packet 1
00:00:21:923147: pg-input
stream x, 64 bytes, sw_if_index 1
current data 0, length 64, buffer-pool 0, ref-count 1, trace handle 0x0
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:00:21:923216: ip4-input
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:00:21:923252: ip4-not-enabled
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:00:21:923261: error-drop
rx:pg0
00:00:21:923270: drop
null-node: blackholed packets
You can see in the trace above that the packet goes through "ip4-not-enabled" before being dropped. This is because the interface used to inject the packet (pg0 by default) has no IPv4 configuration and hence ARP is not enabled.
Inspecting the error counters you see what we might expect in light of the packet tracer output:
DBGvpp# sh err
Count Node Reason Severity
1 null-node blackholed packets error
You can enable IPv4 on pg0 by configuring it as eg. unnumbered:
DBGvpp# set int unnumbered pg0 use loop0
And look at the result when re-injecting the packet:
DBGvpp# clear trace
DBGvpp# trace add pg-input 10
DBGvpp# packet-generator enable-stream
DBGvpp# show trace
------------------- Start of thread 0 vpp_main -------------------
Packet 1
00:05:44:786471: pg-input
stream x, 64 bytes, sw_if_index 1
current data 0, length 64, buffer-pool 0, ref-count 1, trace handle 0x0
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:05:44:786501: ip4-input
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:05:44:786513: ip4-lookup
fib 0 dpo-idx 3 flow hash: 0x00000000
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:05:44:786523: ip4-glean
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:05:44:786547: ip4-drop
ICMP: 1.0.0.2 -> 2.0.0.2
tos 0x00, ttl 64, length 64, checksum 0x77ba dscp CS0 ecn NON_ECN
fragment id 0x0000
ICMP echo_request checksum 0x7a6e id 1
00:05:44:786568: error-drop
rx:pg0
00:05:44:786591: drop
ip4-glean: ARP requests sent
The packet generator can also replay a pcap file directly, for example:
DBGvpp# create packet-generator interface pg0
DBGvpp# packet-generator new pcap /tmp/mypcap.pcap source pg0 name s
DBGvpp# packet-generator enable-stream
- VPP-ABF
- VPP API Concepts
- VPP API Versioning
- VPP-ApiChangeProcess
- VPP-ArtifactVersioning
- VPP-BIER
- VPP-Bihash
- VPP-BugReports
- VPP Build System Deep Dive
- VPP Build, Install, And Test Images
- VPP-BuildArtifactRetentionPolicy
- VPP-c2cpel
- VPP-CodingTips
- VPP Command Line Arguments
- VPP Command Line Interface CLI Guide
- VPP-CommitMessages
- VPP-CommitterTasks-ApiFreeze
- VPP CommitterTasks Compare API Changes
- VPP-CommitterTasks-CutPointRelease
- VPP-CommitterTasks-CutRelease
- VPP-CommitterTasks-FinalReleaseCandidate
- VPP-CommitterTasks-PullThrottleBranch
- VPP-CommitterTasks-ReleasePlan
- VPP Configure An LW46 MAP E Terminator
- VPP Configure VPP As A Router Between Namespaces
- VPP Configure VPP TAP Interfaces For Container Routing
- VPP-CoreFileMismatch
- VPP-cpel
- VPP-cpeldump
- VPP-DHCPv6
- VPP-DistributedOwnership
- VPP DPOs And Feature Arcs
- VPP EC2 Instance With SRIOV
- VPP-elog
- VPP-FAQ
- VPP Feature Arcs
- VPP-g2
- VPP-HA
- VPP-HostStack
- VPP-HostStack-BuiltinEchoClientServer
- VPP-HostStack-EchoClientServer
- VPP-HostStack-ExternalEchoClientServer
- VPP HostStack Hs Test
- VPP-HostStack-LDP-iperf
- VPP-HostStack-LDP-nginx
- VPP-HostStack-LDP-sshd
- VPP-HostStack-nginx
- VPP-HostStack-SessionLayerArchitecture
- VPP-HostStack-TestHttpServer
- VPP-HostStack-TestProxy
- VPP-HostStack-TLS
- VPP-HostStack-VCL
- VPP-HostStack-VclEchoClientServer
- VPP How To Add A Tunnel Encapsulation
- VPP How To Build The Sample Plugin
- VPP How To Connect A PCI Interface To VPP
- VPP How To Create A VPP Binary Control Plane API
- VPP How To Deploy VPP In EC2 Instance And Use It To Connect Two Different VPCs
- VPP How To Optimize Performance %28System Tuning%29
- VPP How To Use The API Trace Tools
- VPP How To Use The C API
- VPP How To Use The Packet Generator And Packet Tracer
- VPP-Howtos
- VPP Installing VPP Binaries From Packages
- VPP Interconnecting vRouters With VPP
- VPP Introduction To IP Adjacency
- VPP Introduction To N Tuple Classifiers
- VPP-IPFIX
- VPP-IPSec
- VPP IPSec And IKEv2
- VPP-Macswapplugin
- VPP-Meeting
- VPP-MFIB
- VPP Missing Prefetches
- VPP Modifying The Packet Processing Directed Graph
- VPP MPLS FIB
- VPP-NAT
- VPP Per Feature Notes
- VPP Performance Analysis Tools
- VPP-perftop
- VPP Project Meeting Minutes
- VPP Pulling, Building, Running, Hacking And Pushing VPP Code
- VPP Pure L3 Between Namespaces With 32s
- VPP Pure L3 Container Networking
- VPP Pushing And Testing A Tag
- VPP Python API
- VPP-QuickTrexSetup
- VPP Random Hints And Kinks For KVM Usage
- VPP Release Plans Release Plan 26.06
- VPP-RM
- VPP-SecurityGroups
- VPP Segment Routing For IPv6
- VPP Segment Routing For MPLS
- VPP Setting Up Your Dev Environment
- VPP-SNAT
- VPP Software Architecture
- VPP STN Testing
- VPP The VPP API
- VPP Training Events
- VPP-Troubleshooting
- VPP-Troubleshooting-BuildIssues
- VPP-Troubleshooting-Vagrant
- VPP Tutorial DPDK And MacSwap
- VPP-Tutorials
- VPP Use VPP To Chain VMs Using Vhost User Interface
- VPP Use VPP To Connect VMs Using Vhost User Interface
- VPP Using mTCP User Mode TCP Stack With VPP
- VPP Using VPP As A VXLAN Tunnel Terminator
- VPP VPP BFD Nexus
- VPP VPP Home Gateway
- VPP-VPPCommunicationsLibrary
- VPP What Is VPP
- VPP Working With The 16.06 Throttle Branch