How to use the command 'birdc' (with examples)

How to use the command 'birdc' (with examples)

The ‘birdc’ command is a command line tool used for remote control of the Bird routing daemon. It allows users to retrieve information about routes and perform configurations during runtime. This article will illustrate several use cases of the ‘birdc’ command with examples.

Use case 1: Opening the remote control console

Code:

birdc

Motivation:

Opening the remote control console allows users to interact with the Bird routing daemon and perform various operations and configurations.

Explanation:

When the ‘birdc’ command is executed without any arguments, it opens the remote control console, providing users with a command line interface to interact with Bird.

Example output:

BIRD 1.6.5 ready.
bird> 

Use case 2: Reloading the configuration without restarting Bird

Code:

birdc configure

Motivation:

Reloading the configuration without restarting Bird allows users to make changes to the configuration file and apply them dynamically, without interrupting the routing functionality.

Explanation:

The ‘configure’ argument tells Bird to reload its configuration file. This is useful when making changes to the configuration and wanting to apply them immediately without restarting the Bird daemon.

Example output:

Configuration reloaded

Use case 3: Showing the current status of Bird

Code:

birdc show status

Motivation:

Showing the current status of Bird provides users with information about the current state of the routing daemon, including the number of routes, protocol states, and uptime.

Explanation:

The ‘show status’ argument displays the current status of Bird, including the number of routes, protocol states, uptime, and other relevant information.

Example output:

BIRD status report
Router ID is 192.168.1.1
Current server time is 2022-03-01 10:30:00
Last reboot on 2022-02-28 13:45:00
Daemon uptime is 20 hours 45 minutes 0 seconds

Use case 4: Showing all configured protocols

Code:

birdc show protocols

Motivation:

Showing all configured protocols provides users with an overview of the protocols that Bird is currently using for routing, such as OSPF or BGP.

Explanation:

The ‘show protocols’ argument displays all the protocols that have been configured in Bird and are currently active.

Example output:

Name        │  Table   │  State  │  RS Limit  │  inp ref  │ out ref  │  Full  │  Downtime
────────────┼──────────┼─────────┼────────────┼───────────┼──────────┼────────┼──────────
bgp1        │  main    │ Running │        500 │       752 │      901 │     No │ 00:10:20  
ospf1       │  main    │ Running │          - │       431 │      654 │    Yes │ 00:05:12  

Use case 5: Showing all details about a protocol

Code:

birdc show protocols upstream1 all

Motivation:

Showing all details about a specific protocol allows users to view in-depth information about a particular protocol configuration, such as OSPF or BGP settings.

Explanation:

The ‘show protocols’ argument followed by the protocol name and ‘all’ option displays all details about a specific protocol configuration, including route table, state, route limits, input references, output references, and downtime.

Example output:

Protocol bgp1, table main
        Routes: 1004 imported, 900 exported, 104 filtered, 0 preferred
        Route change stats: received 3467/3457/7/89974, sent 3324/3356/0/0
        BGP state: Established
        Neighbor address: 192.168.0.1
        Neighbor AS: 65001
        Local AS: 65000
        Local ID: 192.168.0.2
        Neighbor caps: refresh restart-aware AS4
        Source address: 192.168.0.2
        Hold timer: 74/90
        Keepalive timer: 21/30
        Minimum ASOriginationInterval: 1, Maximum ASOriginationInterval: 3

Use case 6: Showing all routes that contain a specific AS number

Code:

birdc "show route where bgp_path ~ [4242120045]"

Motivation:

Showing all routes that contain a specific Autonomous System (AS) number allows users to filter and view only those routes associated with the specified AS number.

Explanation:

The ‘show route’ command followed by the filter condition ‘where bgp_path ~ [AS_NUMBER]’ displays all routes that contain the specified AS number in the BGP path attribute. The AS number should be enclosed in square brackets.

Example output:

Flags: * - Valid, > - Selected, $ - Filtered
   *>i 192.168.1.0/24     192.0.2.1             0 4242120045 i

Use case 7: Showing all best routes

Code:

birdc show route primary

Motivation:

Showing all best routes allows users to view only the most preferred routes for each destination in the routing table.

Explanation:

The ‘show route’ command followed by the ‘primary’ option displays only the best routes for each destination in the routing table.

Example output:

Flags: * - Valid, > - Selected, $ - Filtered
   *> 192.168.0.0/24    192.0.2.1             0 4242120045 i
   *> 192.168.1.0/24    192.0.2.1             0 4242120045 i
   *> 192.168.2.0/24    192.0.2.1             0 4242120045 i

Use case 8: Showing all details of all routes from a given prefix

Code:

birdc show route for fd00:/8 all

Motivation:

Showing all details of all routes from a given prefix allows users to retrieve comprehensive information about all routes associated with the specified IP prefix.

Explanation:

The ‘show route’ command followed by the ‘for’ option and the IP prefix displays all details of all routes from the specified prefix, including the next-hop, AS path, and other relevant information.

Example output:

Flags: * - Valid, > - Selected, $ - Filtered
   * d  fd00::/64          [fd00::3:1]
     Unreachable
   * d  fd00::/64          [fd00::4:1]
     Unreachable
   * d  fd00::/64          [fd00::5:1]
     Unreachable

Conclusion:

The ‘birdc’ command is a powerful tool for remotely controlling the Bird routing daemon. It allows users to retrieve information about routes, monitor the status of Bird, and perform configuration changes. By understanding the various use cases of the ‘birdc’ command, users can efficiently manage and troubleshoot their network routing.

Related Posts

How to use the command pppd (with examples)

How to use the command pppd (with examples)

The pppd command is used to establish a Point-to-Point connection to another computer.

Read More
How to use the command 'xman' (with examples)

How to use the command 'xman' (with examples)

The ‘xman’ command is a manual page viewer for the X Window System.

Read More
How to use the command babeld (with examples)

How to use the command babeld (with examples)

Babeld is a routing daemon for Babel, which uses firewall-style filters.

Read More