5. 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.

5.1. Packet-trace tool overview

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:

  1. Supplied input parameters
  2. Calculated egress interface and port through which a packet with the specified fields would forward to
  3. Applied ACL (both ingress and egress)
  4. Reason for a discarded packet
Note:

The packet-trace tool is not supported on the 7220 IXR-D1 system.

5.2. 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:

  1. Scapy file format: File specifying the packet format in Scapy packet definition form
  2. base64 format: String specifying the packet to send in base64 format
  3. pcap file format: File containing pcap data

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

5.2.1. 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 Table 4.

Table 4:  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

Example Scapy input file:

# bash cat icmp_pkt1.txt 
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()

Example command:

tools system packet-trace file icmp_pkt1.txt interface ethernet-1/2 
 

Example output:

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
================================================================================

5.2.2. 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 Table 5.

Table 5:  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

Example command:

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

Example output:

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 
================================================================================ 
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
================================================================================

5.2.3. Configuring the packet-trace tool (using pcap format)

Use this 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 Table 6.

Table 6:  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 npackeumber from the pcap file

Example command:

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

Example output:

+------------------------------------------------------------------------------+
| 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
    ================================================================================
    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
    ================================================================================

5.3. References

Refer to the SR Linux Data Model Reference for details about all packet-trace related commands and descriptions of all parameters.