linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Introduction
  • Lessons
  • How it works
  • Simulator
  • Knowledge base
  • Interview prep
Index
Categories
All entries
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.
home/linux/kb/Commands/cmd-vtysh

kb/commands ── Commands ── advanced

vtysh: CLI for FRR (BGP/OSPF)

vtysh is the Cisco-style CLI for FRRouting. It lets you configure all routing daemons (zebra, bgpd, ospfd) in a single integrated session.

view as markdownaka: frr-cli, frr

What FRR and vtysh are

FRR (FRRouting) is an open-source implementation of classical routing protocols: BGP, OSPF, IS-IS, RIP, BFD, EIGRP. It is composed of a set of daemons:

  • zebra: the core: communicates with the kernel routing table, aggregates routes
  • bgpd: the BGP daemon (bgp)
  • ospfd: OSPF v2 for IPv4 (ospf)
  • ospf6d: OSPF v3 for IPv6
  • isisd, ripd, eigrpd: the corresponding protocols

Each daemon listens on its own UNIX socket with its own CLI. vtysh is a terminal that can talk to all daemons at once, providing a unified configuration interface (similar to Cisco IOS or Junos CLI).

Modes (same as Cisco)

router#                         ← privileged (read+show)
router# configure terminal      ← enter config mode
router(config)#                  ← configuration changes allowed here
router(config)# router bgp 65001
router(config-router)#          ← subcommand for a specific process
router(config-router)# exit
router(config)# exit
router#                         ← back to privileged

The show and debug commands are available in privileged mode. Configuration changes require configure mode.

Common commands

General diagnostics

bash
sudo vtysh -c "show version"
sudo vtysh -c "show running-config"      # current configuration
sudo vtysh -c "show ip route"             # all routes in the kernel + RIB
sudo vtysh -c "show interface brief"

BGP

bash
sudo vtysh -c "show ip bgp summary"        # neighbor table + state
sudo vtysh -c "show ip bgp"                # all received/advertised prefixes
sudo vtysh -c "show ip bgp neighbors 10.0.0.2"
sudo vtysh -c "show ip bgp neighbors 10.0.0.2 advertised-routes"
sudo vtysh -c "show ip bgp neighbors 10.0.0.2 received-routes"

What to look for in show ip bgp summary:

Neighbor         V  AS    MsgRcvd  MsgSent  ...  State/PfxRcd
10.0.0.2         4  65002  100      100     ...  5

A number in State/PfxRcd means the session is Established and you are receiving 5 prefixes. Active or Idle means the handshake did not complete (usually a network or configuration problem).

OSPF

bash
sudo vtysh -c "show ip ospf neighbor"       # adjacencies (you want 'Full')
sudo vtysh -c "show ip ospf interface brief" # which interfaces OSPF is running on
sudo vtysh -c "show ip ospf database"        # LSDB - topology map
sudo vtysh -c "show ip ospf route"           # SPF-computed routes

Applying config with a here-doc

A convenient way to apply configuration from a script:

bash
sudo vtysh <<'EOF'
configure terminal
router bgp 65001
 no bgp default ipv4-unicast
 neighbor 10.0.0.2 remote-as 65002
 address-family ipv4 unicast
  neighbor 10.0.0.2 activate
  network 10.0.0.0/24
 exit-address-family
exit
do write
EOF

do write saves the running config to /etc/frr/frr.conf so it survives a daemon restart.

§ команды

bash
sudo vtysh -c 'show version'

FRR version and the list of running daemons

bash
sudo vtysh -c 'show ip route'

RIB + FIB: all routes known to FRR

bash
sudo vtysh -c 'show ip bgp summary'

BGP neighbor state: AS numbers, sessions, and accepted prefixes

bash
sudo vtysh -c 'show ip ospf neighbor'

OSPF adjacencies. State should be Full for OSPF to work correctly.

bash
sudo vtysh

Enter the interactive CLI. Commands follow Cisco IOS syntax.

§ см. также

  • bgpBGP: Border Gateway Protocol**BGP** is the routing protocol between autonomous systems (AS). It is the language ISPs and large networks use to exchange reachability information: which AS owns which prefixes and how to reach them.
  • ospfOSPF: Open Shortest Path First**OSPF** is a link-state IGP inside one autonomous system. Each router knows the full topology (LSDB) and independently computes shortest paths with Dijkstra. Convergence takes seconds.
  • routing-tableRouting tableThe routing table lists where to send packets for each destination. The longest matching prefix wins.

§ упоминается в уроках

  • ›advanced-08-bgp-minimal
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies