DescriptionFull information on the path travelled by packets is extremely important for network management and network security. We implemented two path tracking methods in hardware with P4. The first approach tracks a packet’s path by recording each node along the path of a packet (hop recording). The complete path a packet took can be extracted from the packet in the last node of the path. The second approach tracks a packet’s path by logging the forwarding state of a network (forwarding state logging). The complete path can be reconstructed based on the node where the packet entered a network. We conducted experiments with the two implemented approaches and showed that the paths of the packets are reconstructed correctly. The advantage of using P4 is that the control plane only gets involved when the path of a packet is reconstructed. We finally show how our work provides a working tool in P4 networks that can be used to gain deep insights in traffic patterns.