Use the VARY TCPIP,,PKTTRACE command to set up tracing.
>>-Vary --TCPIP--,--+----------+--------------------------------> '-procname-' >--,--PKTtrace--+-------------+-------------------------------->< '-| Command |-' Command .-----------------------------. V | (1) (2) |--,--+---------------------------+--+-ON----+----+-------------------------+-+----------| +-LINKName--=--*--,---------+ +-OFF---+ +-| Packet Length |-------+ +-LINKName--=--link_name--,-+ '-CLEAR-' +-| Protocol Type |-------+ +-INTFName--=--*--,---------+ +-| Packet Dest Address |-+ '-INTFName--=--intf_name--,-' +-| Packet Source Port |--+ +-| Packet Dest Port |----+ +-| Packet Port Number |--+ '-| Packet Discard Code |-' Packet Length .-,FULL-------------------------. |--+-------------------------------+----------------------------| | .-=--200-----------. | '-,ABBREV--+------------------+-' '-=--abbrev_length-' Protocol Type .-,PROT--=--*---------------. |--+---------------------------+--------------------------------| +-,PROT--=--TCP-------------+ +-,PROT--=--UDP-------------+ +-,PROT--=--ICMP------------+ +-,PROT--=--ICMPV6----------+ '-,PROT--=--protocol_number-' Packet Dest Address .-,IPaddr--=--*---------------------------------------------. |--+-----------------------------------------------------------+--| | .-,SUBNet--=--255.255.255.255-. | +-,IPaddr--=--ipv4_address--+-----------------------------+-+ | +-,SUBNet--=--subnet_mask-----+ | | '-/num_mask_bits--------------' | | .-/128----------. | '-,IPaddr--=--ipv6_address--+---------------+---------------' '-/prefixLength-' Packet Source Port .-,SRCPort--=--*-----------. |--+--------------------------+---------------------------------| '-,SRCPort--=--source_port-' Packet Dest Port .-,DESTport--=--*----------------. |--+--------------------------------+---------------------------| '-,DESTport--=--destination_port-' Packet Port Number .-,PORTNUM--=--*-----------. |--+--------------------------+---------------------------------| '-,PORTNUM--=--port_number-' Packet Discard Code .-DISCard=NONE--------. |--+---------------------+--------------------------------------| +-DISCard=*-----------+ +-DISCard=ALL---------+ '-DISCard=reason_code-'
Specifies the name of the network interface that is defined on a preceding LINK or INTERFACE statement. If the LINKName/INTFName parameter is omitted or if an asterisk (*) is specified for either parameter, the PKTTRACE parameters apply to all IPv4 and IPv6 interfaces.
To facilitate defining packet tracing when many interfaces are involved, use the PKTTRACE statement with the LINKName=* or INTFName=* option to define packet tracing characteristics for the majority of the interfaces. Then use individual PKTTRACE statements with specific LINKName/INTFName parameters for each interface that must be defined differently from the majority.
The LINKName and INTFName parameters are interchangeable.
If you use LINKName=* or INTFName=* and all other parameters are defaults, even if the defaults are specified, the command results replaces any existing trace structures for all existing IPv4 and IPv6 interfaces.
If you use LINKName=link_name or INTFName=* and another non-default parameter, the command results are added to any existing trace structures. However, if the existing trace structure for link_name or intf_name is all defaults, the existing trace structure will be discarded.
If LINKName=* or INTFName=* and all other parameters are defaults, all trace structures are deactivated and removed from all existing IPv4 and IPv6 interfaces.
If LINKName=* or INTFName=* and PROT=UDP, all trace structures for all resources are analyzed; any matches are removed. If no trace structures remain, trace is deactivated for that resource.
If LINKName=link_name or INTFName=intf_name and there are no other parameters, all trace structures for link_name or intf_name are deactivated and removed.
If LINKName=link_name and IP=127.0.0.1 or INTFName=intf_name and IP=::1, that particular trace structure is removed if it is found. If there is only one trace structure, then that structure is removed and trace is deactivated for that resource.
IPSec Encapsulating Security Payload (ESP) packets cannot be traced by port number because the TCP or UDP headers are encrypted.
Guideline: SRCPORT and DESTPORT parameters should not be specified on the same PKTTRACE statement as the PORTNUM parameter. When the PORTNUM parameter is specified after the DESTPORT or SRCPORT parameters, the DESTPORT and SRCPORT parameters are ignored.
If an IPv6 address is specified, then an optional prefixLength (range 1 - 128) is allowed. IPv4 addresses and IPv4-mapped IPv6 addresses are treated as equivalent addresses. The default prefixLength is 128. If an IPv4 address is specified, then /num_mask_bits can be used. The num_mask_bits and SUBNET values are mutually exclusive. An error message is displayed if both are coded.
IPSec Encapsulating Security Payload (ESP) packets cannot be traced by port number because the TCP or UDP headers are encrypted.
IPsec Encapsulating Security Payload (ESP) packets cannot be traced by port number because the TCP or UDP headers are encrypted.
PKTTRACE ON,DISCARD=4138,PORTNUM=20
v tcpip,,pkt,on,dest=21
v tcpip,,pkt,on,srcp=21
The two commands will capture all the packets received and all the packets sent for a particular port. If other options are specified, then they should be the same on both commands.