Created
July 18, 2026 22:20
-
-
Save ge0rg/568d8ba77ab9ffc015e9103ccbc8fc91 to your computer and use it in GitHub Desktop.
Print the active route numbers for each BGP-over-WireGuard tunnel (DN42)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # function to format-print name ($1), count ($2) and percentage of total ($3) | |
| :local format do={ :put ($1 . ": " . $2 . " (" . ((100*$2)/$3) . "%)"); } | |
| :local total [ /ipv6/route/print count-only as-value where active bgp ] | |
| $format "total" $total $total | |
| # iterate all wireguard interfaces matching "wg-dn42-" | |
| :foreach interface in=[/interface/wireguard/print proplist=name as-value where name ~ "wg-dn42-" ] \ | |
| do={ | |
| :local ifname ($interface->"name") | |
| # count and print the active routes from BGP going through *@ifname | |
| :local matches [ /ipv6/route/print count-only as-value where gateway ~ "*" . $ifname active bgp ] | |
| $format $ifname $matches $total | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment