Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Configuring BGP Trace Operations

 

Understanding Trace Operations for BGP Protocol Traffic

You can trace various BGP protocol traffic to help you debug BGP protocol issues. To trace BGP protocol traffic, include the traceoptions statement at the [edit protocols bgp] hierarchy level. For routing instances, include the traceoptions statement at the [edit routing-instances routing-instance-name protocols bgp] hierarchy level.

You can specify the following BGP protocol-specific trace options using the flag statement:

  • 4byte-as—4-byte AS events.

  • bfd—BFD protocol events.

  • damping—Damping operations.

  • graceful-restart—Graceful restart events.

  • keepalive—BGP keepalive messages.

  • nsr-synchronization—Nonstop active routing synchronization events.

  • open—BGP open packets. These packets are sent between peers when they are establishing a connection.

  • packets—All BGP protocol packets.

  • refresh—BGP refresh packets.

  • update—BGP update packets. These packets provide routing updates to BGP systems.

Global tracing options are inherited from the configuration set by the traceoptions statement at the [edit routing-options] hierarchy level. You can override the following global trace options for the BGP protocol using the traceoptions flag statement included at the [edit protocols bgp] hierarchy level:

  • all—All tracing operations

  • general—All normal operations and routing table changes (a combination of the normal and route trace operations)

  • normal—Normal events

  • policy—Policy processing

  • route—Routing information

  • state—State transitions

  • task—Routing protocol task processing

  • timer—Routing protocol timer processing

You can optionally specify one or more of the following flag modifiers:

  • detail—Detailed trace information.

  • filter—Filter trace information. Applies only to route and damping tracing flags.

  • receive—Packets being received.

  • send—Packets being transmitted.

Note

Use the all trace flag and the detail flag modifier with caution because these might cause the CPU to become very busy.

Note

If you only enable the update flag, received keepalive messages do not generate a trace message.

You can filter trace statements and display only the statement information that passes through the filter by specifying the filter flag modifier. The filter modifier is only supported for the route and damping tracing flags.

The match-on statement specifies filter matches based on prefixes. It is used to match on route filters.

Note

Per-neighbor trace filtering is not supported on a BGP per-neighbor level for route and damping flags. Trace option filtering support is on a peer group level.

Example: Viewing BGP Trace Files on Logical Systems

This example shows how to list and view files that are stored on a logical system.

Requirements

Overview

Logical systems have their individual directory structure created in the /var/logical-systems/logical-system-name directory. It contains the following subdirectories:

  • /config—Contains the active configuration specific to the logical system.

  • /log—Contains system log and tracing files specific to the logical system.

    To maintain backward compatibility for the log files with previous versions of Junos OS, a symbolic link (symlink) from the /var/logs/logical-system-name directory to the /var/logical-systems/logical-system-name directory is created when a logical system is configured.

  • /tmp—Contains temporary files specific to the logical system.

The file system for each logical system enables logical system users to view trace logs and modify logical system files. Logical system administrators have full access to view and modify all files specific to the logical system.

Logical system users and administrators can save and load configuration files at the logical-system level using the save and load configuration mode commands. In addition, they can also issue the show log, monitor, and file operational mode commands at the logical-system level.

This example shows how to configure and view a BGP trace file on a logical system. The steps can be adapted to apply to trace operations for any Junos OS hierarchy level that supports trace operations.

Tip

To view a list of hierarchy levels that support tracing operations, enter the help apropos traceoptions command in configuration mode.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Configuring Trace Operations

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure the trace operations:

  1. Configure trace operations on the logical system.

  2. If you are done configuring the device, commit the configuration.

Viewing the Trace File

Step-by-Step Procedure

To view the trace file:

  1. In operational mode on the main router, list the directories on the logical system.
    user@host> file list /var/logical-systems/A
  2. In operational mode on the main router, list the log files on the logical system.
    user@host> file list /var/logical-systems/A/log/
  3. View the contents of the bgp-log file.
    user@host> file show /var/logical-systems/A/log/bgp-log
  4. Filter the output of the log file.
    user@host> file show /var/logical-systems/A/log/bgp-log | match "flags 0x40"
  5. View the tracing operations in real time.
    user@host> clear bgp neighbor logical-system A
    Caution

    Clearing the BGP neighbor table is disruptive in a production environment.

  6. Run the monitor start command with an optional match condition.
    user@host> monitor start A/bgp-log | match 0.0.0.0/0
  7. Pause the monitor command by pressing Esc-Q.

    To unpause the output, press Esc-Q again.
  8. Halt the monitor command by pressing Enter and typing monitor stop.
    [Enter]
    user@host> monitor stop
  9. When you are finished troubleshooting, consider deactivating trace logging to avoid any unnecessary impact to system resources.

    When configuration is deactivated, it appears in the configuration with the inactive tag.To reactivate trace operations, use the activate configuration-mode statement.

    [edit protocols bgp group internal-peers]
    user@host:A# show
  10. To reactivate trace operations, use the activate configuration-mode statement.

Deactivating and Reactivating Trace Logging

Step-by-Step Procedure

To deactivate and reactivate the trace file:

  1. When you are finished troubleshooting, consider deactivating trace logging to avoid an unnecessary impact to system resources.

    When configuration is deactivated, the statement appears in the configuration with the inactive tag.

    [edit protocols bgp group internal-peers]
    user@host:A# show
  2. To reactivate logging, use the activate configuration-mode statement.

Results

From configuration mode, confirm your configuration by entering the show logical-systems A protocols bgp group internal-peers command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

Verification

Confirm that the configuration is working properly.

Verifying That the Trace Log File Is Operating

Purpose

Make sure that events are being written to the log file.

Action

user@host:A> show log bgp-log