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
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
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
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:
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.