Troubleshooting (Debugging) BGP in Juniper using Traceoptions

The “traceoptions” statement in Juniper let you debug BGP protocol issues. If cannot connect BGP peering, you can set the “traceoptions” to understand further about the issue.

1. Configure “traceoptions” and name the log as debug-bgp

set protocols bgp group BGP-GROUP1 traceoptions file debug-bgp
set protocols bgp group BGP-GROUP1traceoptions file size 1m
set protocols bgp group BGP-GROUP1 traceoptions file files 2
set protocols bgp group BGP-GROUP1 traceoptions flag all

commit

where:
max trace file size = 1m
max trace files = 2
flag all = trace everything

It will look something like this:

user1@QFX-re0> show configuration protocols bgp group BGP-GROUP1

type external;
traceoptions {
file debug-bgp size 1m files 2;
flag all;

2. View the trace file to verify

user1@QFX-re0> file list /var/log/debug-bgp
/var/log/debug-bgp

3. View the contents

user1@QFX-re0> file show /var/log/debug-bgp
Dec 16 13:37:36 trace_on: Tracing to “/var/log/debug-bgp” started

4. Monitor the log
user1@QFX-re0> monitor start debug-bgp

[SAMPLE OUTPUT]

Dec 16 14:02:13.411153 bgp_connect_start: peer 192.168.10.200 (External AS 65510)
Dec 16 14:02:13.411158 bgp_event: peer 192.168.10.200 (External AS 65510) old state Active event ConnectRetry new state Connect
Dec 16 14:02:13.411355 task_get_socket: domain AF_INET  type SOCK_STREAM  protocol 0  socket 99
Dec 16 14:02:13.411370 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option RecvBuffer(0) value 16384
Dec 16 14:02:13.411378 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option SendBuffer(1) value 16384
Dec 16 14:02:13.411381 task_set_socket: task BGP_65510_65520.192.168.10.200 socket 99
Dec 16 14:02:13.411396 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option NonBlocking(8) value 1
Dec 16 14:02:13.411404 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option ReUsePort(38) value 1
Dec 16 14:02:13.411474 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option PathMTUDiscovery(26) value 0
Dec 16 14:02:13.411484 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option TOS(16) value 192
Dec 16 14:02:13.411493 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option DontRoute(5) value 1
Dec 16 14:02:13.411499 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option IifRestrict(36) value 1
Dec 16 14:02:13.411506 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option TTL(15) value 1
Dec 16 14:02:13.411518 Eval BFD turn-on, currently off for peer 192.168.10.200 (External AS 65510)(fl:)instance master (kern-id 0)
Dec 16 14:02:13.411595 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option TcpAggressiveTransmission(59) value 0
Dec 16 14:02:13.411608 task_set_option_internal: task BGP_65510_65520.192.168.10.200 socket 99 option EnableTcpNoDelay(63) value 0
Dec 16 14:02:13.411691 task_timer_reset: reset BGP_65510_65520.192.168.10.200_Connect
Dec 16 14:02:13.411698 task_timer_set_oneshot_latest: timer BGP_65510_65520.192.168.10.200_Connect interval set to 2:28
5. Stop monitoring using this command
user1@QFX-re0> monitor stop
6. Deactivate traceoptions if finished
user1@QFX-re0> deactivate protocols bgp group BGP-GROUP1 traceoptions
user1@QFX-re0> show configuration protocols bgp group BGP-GROUP1
type external;
inactive: traceoptions {
    file debug-bgp size 1m files 2;
    flag all;

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *