Packet-trace tool

The packet-trace tool is a troubleshooting command that allows the specification of a probe packet that is injected into the specified interface forwarding context. The tool records the forwarding destination or egress port for the probe packet, as well as any matched ACL records.

The packet-trace tool calculates the egress interfaces for an IP forward flow, while taking into account ECMP and LAG hashing.

The tool reports the following output:

  • supplied input parameters

  • calculated egress interface and port through which a packet with the specified fields is forwarded

  • applied ACL (both ingress and egress)

  • reason for a discarded packet

See the SR Linux Data Model Reference for more information about all packet-trace related commands and descriptions of all parameters.

Configuring packet-trace tool commands

The packet-trace command is a tools command that reports the forwarding behavior for a test packet specified in one of the following formats:

  • Scapy file format: file specifying the packet format in Scapy packet definition form

  • base64 format: string specifying the packet to send in base64 format

  • pcap file format: file containing pcap data

Only physical interface types can be used as the ingress interface for injected packets.

Configuring the packet-trace tool (using Scapy file format)

Use this command to report the forwarding behavior for a specified test packet (file format) that contains a packet formatted in Scapy packet definition form:

# tools system packet-trace file <input file in Scapy format> interface <interface name>

Packet trace command parameters for specifying an input file are described in Packet trace command parameters using an input file.

Table 1. Packet trace command parameters using an input file

Command/parameter

Description

tools system packet-trace

Reports the forwarding behavior for a specified test packet (file format)

file <file name>

File containing the packet format in Scapy packet definition form. The format of the packet definition should match that of the Linux utility Scapy.

interface <interface name>

The name of the configured interface to inject the probe packet

Scapy input file

# bash cat /tmp/p1.txt
Ether(dst="50:E0:EF:3A:EA:D2",src="00:01:03:FF:00:41")/Dot1Q(vlan=100)/
IP(dst="100.1.5.1",src="192.35.1.1")/UDP(sport=6722,dport=6789)/"Hi"/
Raw(RandString(size=512))

command

# tools system packet-trace file /tmp/p1.txt interface ethernet-1/1

output (bridged)

Ether(dst="50:E0:EF:3A:EA:D2",src="00:01:03:FF:00:41")/Dot1Q(vlan=100)/IP(dst="100.1.5.1",src="192.35.1.1")/UDP(sport=6722,dport=6789)/"Hi"/Raw(RandString(size=512))
Generated packet:
###[ Ethernet ]###
  dst       = 50:e0:ef:3a:ea:d2
  src       = 00:01:03:ff:00:41
  type      = VLAN
###[ 802.1Q ]###
     prio      = 0
     id        = 0
     vlan      = 100
     type      = IPv4
###[ IP ]###
        version   = 4
        ihl       = 5
        tos       = 0x0
        len       = 542
        id        = 1
        flags     =
        frag      = 0
        ttl       = 64
        proto     = udp
        chksum    = 0x4ea8
        src       = 192.35.1.1
        dst       = 100.1.5.1
        \options   \
###[ UDP ]###
           sport     = 6722
           dport     = smc_https
           len       = 522
           chksum    = 0x251e
###[ Raw ]###
              load      = 'Hi9cmfMxg4lBV6iXRKbe3t2dUJyiGZb7s2GcTQ8YQ0A2PYnF8ntm45lGqCezZ6ncYF4ijsc7hqjxSUjIJdq4YhhRrNSnyUsHkhehhSifTpT1EEiQNOzNLWgF6DPdcQ078REyyjnI9hqzTNAk0XhgOmLtg55rkufD8nyOotgBgnz2mpQ0igLSEtYe84VDfdiCs5lWTvhGTYCClxsCYmXEozmSsWqBagdwHe1Ia0voCZ3deUUL6B7paAOb8ua5bZa44G7Z7LneJZ0YxH2VjbSqmeukaxyMrkg7NUIxs3aVIwD2jPqra3CBaxokvarX5TyIzNuK2qYeAwnjdzBZo2iZTonXomJjoDWB2cqG61iEGPLNg5juC7PTa9fglirYgEI2T9rTm8gpTjG6ZgN90g3w0xOxBgwYsNfuXMqp7u9wR8fvfNa4MmZseCC6UUKneSKK0zDyxyHgtSEKwHQgQA0HOh6wZttNQRFzST4YB0cFM1tTeo6mCgwAplYX8THGImjvis'
/system/packet-trace-base64:
================================================================================
Ingress information for Packet 3 Ingress Interface ethernet-1/1
================================================================================
Type                : Bridged
Interface           : ethernet-1/1 (4401020001)
Net Instance        : macvrf1
================================================================================
================================================================================
Egress information for Packet 3
================================================================================
Interface           : Flooded in macvrf1
Egress Net Instance : macvrf1
================= (routed)======================================================

output (routed)

smac='00:AA:33:44:55:66' 
dmac= '20:E0:9C:7A:DA:E2' 
Ether(src=smac,dst=dmac)/IP(src='120.1.7.1',dst='120.1.5.1')/ICMP()
 
Generated packet:
 ###[ Ethernet ]### 
dst = 20:e0:9c:7a:da:e2 
src = 00:aa:33:44:55:66 
type = IPv4 
###[ IP ]### 
     version = 4
     ihl = 5
     tos = 0x0
     len = 28
     id = 1
    flags = 
    frag = 0 
    ttl = 64 
    proto = icmp 
    chksum = 0x7edc
     src = 120.1.7.1 
     dst = 120.1.5.1
     \options \ 
###[ ICMP ]### 
        type = echo-request 
        code = 0 
        chksum = 0xf7ff 
        id = 0x0 
        seq = 0x0 
/system/packet-trace-base64:

================================================================================
Ingress information for Packet 1 Ingress Interface ethernet-4/29
================================================================================
Type                : Routed
Interface           : lag5 (14000000005)
Sub interface       : lag5.1
Net Instance        : red
Out Interface       : ethernet-4/22
Nexthop ip          : 192.35.1.1
================================================================================
================================================================================
Egress information for Packet 1 Egress Interface ethernet-4/22
================================================================================
Interface           : ethernet-4/22 (4404020016)
Sub interface       : ethernet-4/22.1
Mac Address         : 00:01:03:FF:00:08
================================================================================

Configuring the packet-trace tool (using base64 format)

Use this command to report the forwarding behavior for a specified test packet using packets specified in base64 format:

# tools system packet-trace-base64 interface <interface name> packet <value>

Packet trace command parameters for specifying base64 format are described in Packet trace command parameters using base64 string format.

Table 2. Packet trace command parameters using base64 string format

Command/parameter

Description

tools system packet-trace-base64

Reports the forwarding behavior for a specified test packet (packet specified in base64 format)

interface <interface name>

The name of the configured interface to inject the probe packet

packet <value>

Packet format in base64 string format

command (for routed)

# tools system packet-trace-base64 interface ethernet-1/1 packet
 "RQAAOgABAABABnS4AQEBAQICAgIAFABQAAAAAAAAAABQAiAAqscAAEdFVCAvIEhUVFAvMS4wDQoNCg=="

output (routed)

tools system packet-trace-base64 interface ethernet-1/3 packet 
"MjBFMDlDNzlCQUUzMDAwMTA3RkYwMDAwMDgwMDQ1MDAwMDJFMDAwMDAwMDA0MDExNTA3REMwMz 
kwMTA3NjQwMTA1MDExQTQyMUE4NTAwMUE1ODVGMDAwMTAyMDMwNDA1MDYwNzA4MDkwQTBCMEMwRDBFMEYxMD
ExM0VGMjA5OTM="
/system/packet-trace-base64: 
================================================================================ 
Ingress information for Packet 77 Ingress Interface ethernet-1/2 
================================================================================ 
Type          : Routed
Interface     : ethernet-1/2 (4401020002)
Sub interface : ethernet-1/2.1 
Instance id   : 1
Out Interface : ethernet-1/1 
Nexthop ip    : 120.1.5.1 
================================================================================ 
================================================================================ 
Egress information for Packet 77 Egress Interface ethernet-1/1 
================================================================================ 
Interface : ethernet-1/1 (4401020001) 
Sub interface : ethernet-1/1.1 
Mac Address : 00:22:33:44:55:66
================================================================================

command (for bridged)

tools system packet-trace-base64 packet UODvOurSAAED/wBBgQAAZAgARQACHgAB
AABAEU6owCMBAWQBBQEaQhqFAgpUvkhpQzVDODlhcUttaDVsRHNWRnk4WDRpYXRQbW81UllWenFweE9p
NEJNeXpPQWo5UktOVTRGNkFwTENhNVljNlFVMHViRTY2UUJzUkh5TWh0SHhQUTZOaFFTRk5LeXFKNGVn
VVZINDJlOFdBSmt1NlFZeHFicFRmZjEwdHVWdENwcENNMmQ5R1RCeHpseUY3aDZrQjBLMHRXNkF1a2Y0
QllNS3Jld2M5aUVGNGRUc1pPbEs0WVFEdkpxRjFOQ1BMMktXNjlnS212bXJmbTlZT2tHWE01MG9haTdp
R2l0amNzRHdkV3VBZEJ4OHJvek5tbnVQc2FCYVdPeVBWUjJBT0hVa1BrOW1mcldwYTFDVXVOcU8xZzJk
RVExRXhBNFhaYUlnNlJLZjJvc2swMVJZektac0dKZEFUVnBaSkQzM2tnY2c4UDJnM0dYZFYzZnp4VTNH
bEtEQzhRUUlzQTJVYUJOODM4TWNiNmw3MUdZdGNuZlNDdGZFYlB0TU9OS2xSejlhYWZHb3JaQzVMNFdw
TjZXRDVzZWlKelZtYWdrWUM2VThYY2dKWGpDSXJpR01lQjlobnY4RmFjNklDZnpROHFiZE5iZ21TTG9M
N0l0Tk4xZ1NmQ2JkeUE0RVFabHBGYlFEeVFFYUFJZUUycG9lbWRPU2x4a0FWYzBQU3kzZExEYWE=int
erface ethernet-1/1

output (bridged)

A:rifa# tools system packet-trace-base64 packet UODvOurSAAED/wBBgQAAZAgARQACHgAB
AABAEU6owCMBAWQBBQEaQhqFAgpUvkhpQzVDODlhcUttaDVsRHNWRnk4WDRpYXRQbW81UllWenFweE9p
NEJNeXpPQWo5UktOVTRGNkFwTENhNVljNlFVMHViRTY2UUJzUkh5TWh0SHhQUTZOaFFTRk5LeXFKNGVn
VVZINDJlOFdBSmt1NlFZeHFicFRmZjEwdHVWdENwcENNMmQ5R1RCeHpseUY3aDZrQjBLMHRXNkF1a2Y0
QllNS3Jld2M5aUVGNGRUc1pPbEs0WVFEdkpxRjFOQ1BMMktXNjlnS212bXJmbTlZT2tHWE01MG9haTdp
R2l0amNzRHdkV3VBZEJ4OHJvek5tbnVQc2FCYVdPeVBWUjJBT0hVa1BrOW1mcldwYTFDVXVOcU8xZzJk
RVExRXhBNFhaYUlnNlJLZjJvc2swMVJZektac0dKZEFUVnBaSkQzM2tnY2c4UDJnM0dYZFYzZnp4VTNH
bEtEQzhRUUlzQTJVYUJOODM4TWNiNmw3MUdZdGNuZlNDdGZFYlB0TU9OS2xSejlhYWZHb3JaQzVMNFdw
TjZXRDVzZWlKelZtYWdrWUM2VThYY2dKWGpDSXJpR01lQjlobnY4RmFjNklDZnpROHFiZE5iZ21TTG9M
N0l0Tk4xZ1NmQ2JkeUE0RVFabHBGYlFEeVFFYUFJZUUycG9lbWRPU2x4a0FWYzBQU3kzZExEYWE= int
erface ethernet-1/1
/system/packet-trace-base64:
================================================================================
Ingress information for Packet 4 Ingress Interface ethernet-1/1
================================================================================
Type                : Bridged
Interface           : ethernet-1/1 (4401020001)
Net Instance        : macvrf1
================================================================================
================================================================================
Egress information for Packet 4
================================================================================
Interface           : Flooded in macvrf1
Egress Net Instance : macvrf1
================================================================================

Configuring the packet-trace tool (using pcap format)

Use the following command to report the forwarding behavior for a specified test packet using packets specified in pcap format:

# tools system packet-trace pcap-file <file name> [interface <interface name>] [max-packet-count <value>] [packet-number <value>]

Packet trace command parameters for specifying pcap format are described in Packet trace command parameters using pcap format.

Table 3. Packet trace command parameters using pcap format

Command/parameter

Description

tools system packet-trace

Reports the forwarding behavior for a specified test packet (file format)

pcap-file <file name>

Input file in pcap format

interface <interface name>

The name of the configured interface to inject the probe packet

max-packet-count <value>

Number of packets to read from the file (default: 100)

packet-number <value>

Use packet with the specified packet number from the pcap file

packet-trace command using pcap format

# tools system packet-trace pcap-file data.pcap max-packet-count 1 packet-number 1 
 interface ethernet-1/2

output of packet trace in pcap format

+------------------------------------------------------------------------------+
| Number     Time     Ingress   Source    Destina   Protoco   Length    Info   |
|                      port                tion        l                       |
+==============================================================================+
| 1       0.046971   etherne   90.1.7.   2.1.1.4   UDP       2545     6722     |
|                                                                      \u2192  |
|                     t-1/2.1   1         8                            6789 Le |
|                                                                      n=2454  |
Enter packet number (default: [1]): 1                                          
###[ Ethernet ]### 
  dst       = 20:e0:9c:7a:da:e2
  src       = 00:aa:33:44:55:66
  type      = IPv4
###[ IP ]### 
     version   = 4
     ihl       = 5
     tos       = 0x0
     len       = 2482     
     id        = 0
     flags     = 
     frag      = 0
     ttl       = 64
     proto     = udp
     chksum    = 0xd09
     src       = 90.1.7.1
     dst       = 2.1.1.48
     \options   \
###[ UDP ]### 
        sport     = 6722
        dport     = smc_https
        len       = 2462
        chksum    = 0xcd6b
###[ Raw ]### 
           load      =
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\
x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f
!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_
`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x8
7\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\
x9a\x9b\x9c\x9d\x9e\x9f\xa0\....'
/system/packet-trace-base64:
    ================================================================================
    Ingress information for Packet 10 Ingress Interface ethernet-1/2
    ================================================================================
    Type                : Routed
    Interface           : ethernet-1/2 (4401020002)
    Sub interface       : ethernet-1/2.1
    Instance id         : 1
    Out Interface       : ethernet-1/1
    Nexthop ip          : 117.1.5.1
    ================================================================================
    ================================================================================
    Egress information for Packet 10 Egress Interface ethernet-1/1
    ================================================================================
    Interface           : ethernet-1/1 (4401020001)
    Sub interface       : ethernet-1/1.8
    Mac Address         : 00:22:33:44:55:6D