A method by a switch in a software defined networking, SDN, network to trace packets in a packet processing pipeline of the switch, comprising: receiving a packet; responsive to a determination at a trace table in the packet processing pipeline that the packet matches a trace criteria, creating a copy of the packet that is to function as a trace packet, setting a first trace indicator of the trace packet wherein the first trace indicator indicates that the packet is a trace packet, setting a second trace indicator of the trace packet wherein the second indicator remains set as the trace packet is processed in the packet processing pipeline, and directing the trace packet and the packet to a subsequent flow table; at each of one or more subsequent flow tables in the packet processing pipeline that the trace packet traverses, responsive to a determination that the first trace indicator of the trace packet is set, appending an identifier of that flow table to a recorded route of the trace packet, clearing the first trace indicator of the trace packet, resubmitting the trace packet to that flow table for normal packet processing operations, and setting the first trace indicator of the trace packet to a value of the second trace indicator of the trace packet before directing the trace packet to a subsequent flow table; and responsive to a determination at an egress flow table in the packet processing pipeline that the first trace indicator of the trace packet is set, sending the trace packet to a controller along with the recorded route of the trace packet, wherein each of the one or more subsequent flow tables is programmed to support packet tracing functionality and normal packet processing functionality. receiving a packet; responsive to a determination at a trace table in the packet processing pipeline that the packet matches a trace criteria, creating a copy of the packet that is to function as a trace packet, setting a first trace indicator of the trace packet wherein the first trace indicator indicates that the packet is a trace packet, setting a second trace indicator of the trace packet wherein the second indicator remains set as the trace packet is processed in the packet processing pipeline, and directing the trace packet and the packet to a subsequent flow table; at each of one or more subsequent flow tables in the packet processing pipeline that the trace packet traverses, responsive to a determination that the first trace indicator of the trace packet is set, appending an identifier of that flow table to a recorded route of the trace packet, clearing the first trace indicator of the trace packet, resubmitting the trace packet to that flow table for normal packet processing operations, and setting the first trace indicator of the trace packet to a value of the second trace indicator of the trace packet before directing the trace packet to a subsequent flow table; and responsive to a determination at an egress flow table in the packet processing pipeline that the first trace indicator of the trace packet is set, sending the trace packet to a controller along with the recorded route of the trace packet, wherein each of the one or more subsequent flow tables is programmed to support packet tracing functionality and normal packet processing functionality. <EOS>