Use the CLI monitor traffic command to display packet headers transmitted through network interfaces.
![]() |
Using the monitor traffic command can degrade Services Router performance. We recommend that you use filtering options—such as count and matching—to minimize the impact to packet throughput on the Services Router. |
Enter the monitor traffic command with the following syntax. Table 117 describes the monitor traffic command options.
user@host> monitor traffic <absolute-sequence>
<count number> <interface interface-name> <layer2-headers> <matching
"expression"> <no-domain-names>
<no-promiscuous> <no-resolve>
<no-timestamp> <print-ascii>
<print-hex> <size bytes>
<brief | detail | extensive>
To quit the monitor traffic command and return to the command prompt, press Ctrl-C.
If you want to capture and view packet headers using the J-Web interface, see Capturing and Viewing Packets with the J-Web Interface.
Table 117: CLI monitor traffic Command Options
|
Option |
Description |
|---|---|
|
absolute-sequence |
(Optional) Displays the absolute TCP sequence numbers. |
|
count number |
(Optional) Displays the specified number of packet headers. Specify a value from 0 through 100,000. The command quits and exits to the command prompt after this number is reached. |
|
interface interface-name |
(Optional) Displays packet headers for traffic on the specified interface. If an interface is not specified, the lowest numbered interface is monitored. |
|
layer2-headers |
(Optional) Displays the link-layer packet header on each line. |
|
matching "expression" |
(Optional) Displays packet headers that match an expression enclosed in quotation marks (" "). Table 118 through Table 120 list match conditions, logical operators, and arithmetic, binary, and relational operators you can use in the expression. |
|
no-domain-names |
(Optional) Suppresses the display of the domain name portion of the hostname. |
|
no-promiscuous |
(Optional) Specifies not to place the monitored interface in promiscuous mode. In promiscuous mode, the interface reads every packet that reaches it. In nonpromiscuous mode, the interface reads only the packets addressed to it. |
|
no-resolve |
(Optional) Suppresses the display of hostnames. |
|
no-timestamp |
(Optional) Suppresses the display of packet header timestamps. |
|
print-ascii |
(Optional) Displays each packet header in ASCII format. |
|
print-hex |
(Optional) Displays each packet header, except link-layer headers, in hexadecimal format. |
|
size bytes |
(Optional) Displays the number of bytes for each packet that you specify. If a packet header exceeds this size, the displayed packet header is truncated. The default value is 96. |
|
brief |
(Optional) Displays minimum packet header information. This is the default. |
|
detail |
(Optional) Displays packet header information in moderate detail. For some protocols, you must also use the size option to see detailed information. |
|
extensive |
(Optional) Displays the most extensive level of packet header information. For some protocols, you must also use the size option to see extensive information. |
To limit the packet header information displayed by the monitor traffic command, include the matching "expression" option. An expression consists of one or more match conditions listed in Table 118, enclosed in quotation marks (" "). You can combine match conditions by using the logical operators listed in Table 119 (shown in order of highest to lowest precedence).
For example, to display TCP or UDP packet headers, enter the following command:
user@host> monitor traffic matching “tcp
|| udp”
To compare the following types of expressions, use the relational operators listed in Table 120 (listed from highest to lowest precedence):
protocol [byte-offset <size>]
Replace protocol with any protocol in Table 118. Replace byte-offset with the byte offset, from the beginning of the packet header, to use for the comparison. The optional size parameter represents the number of bytes examined in the packet header—1, 2, or 4 bytes.
For example, the following command displays all multicast traffic:
user@host> monitor traffic matching “ether[0]
& 1 !=0”
Table 118: CLI monitor traffic Match Conditions
Table 119: CLI monitor traffic Logical Operators
Table 120: CLI monitor traffic Arithmetic, Binary, and Relational Operators
Following is sample output from the monitor traffic command:
user@host> monitor traffic count 4 matching
“arp” detail
Listening on fe-0/0/0, capture size 96 bytes 15:04:16.276780 In arp who-has 193.1.1.1 tell host1.site2.net 15:04:16.376848 In arp who-has host2.site2.net tell host1.site2.net 15:04:16.376887 In arp who-has 193.1.1.2 tell host1.site2.net 15:04:16.601923 In arp who-has 193.1.1.3 tell host1.site2.net