Commands / Services and tunnels

Services and tunnels

vtysh

Also frr, quagga, show ip ospf, show bgp, show ip route static, ip route (IOS), route-map, prefix-list, show rpki

The routing daemon's shell (FRR): shows and changes static routes, OSPF and BGP neighbours, databases and learned routes.

On a router running FRR, routes learned with OSPF or BGP are decided by the daemon, then installed in the kernel table (ip route shows them as proto ospf or proto bgp). vtysh -c 'COMMAND' runs one command in the daemon's Cisco-like shell. Start with the neighbours: no Full OSPF neighbour or no Established BGP session, and no routes will follow. Change configuration with vtysh -c 'configure terminal' -c '…'.

vtysh command usage

vtysh -c 'show …'
vtysh -c 'configure terminal' -c 'router ospf' -c '…'

Options

-c 'show ip route'
every route the daemon knows, marked O (OSPF), B (BGP), C (connected)
-c 'show ip ospf neighbor'
OSPF neighbours and their state (Full is good)
-c 'show ip ospf interface'
which cards run OSPF, with cost and timers
-c 'show bgp summary'
BGP sessions: state and prefixes received
-c 'show bgp ipv4 unicast'
every BGP route with its AS path
-c 'show rpki prefix-table'
the ROAs from the RPKI validator: prefix, max length, origin AS
-c 'show running-config'
the daemon's whole configuration

vtysh examples

vtysh -c 'show ip ospf neighbor'
Lists this router's OSPF neighbours and whether each adjacency is Full.
vtysh -c 'show ip route'
Lists every route the routing daemon knows and where each came from.
vtysh -c 'show bgp summary'
Lists the BGP sessions, whether each is established, and how many prefixes each sent.
vtysh -c 'show bgp ipv4 unicast'
Lists the BGP routes with their next hop and AS path.
vtysh -c 'show running-config'
Prints the routing daemon's configuration, to compare with a neighbour's.
vtysh -c 'configure terminal' -c 'interface eth1' -c 'ip ospf cost 50'
Makes OSPF see the link on eth1 as more expensive, so traffic prefers another path.
vtysh -c 'configure terminal' -c 'ip route 10.0.2.0/24 10.0.13.3 200'
Adds a static route with administrative distance 200: a floating backup, as on IOS.
vtysh -c 'show ip route static'
Lists the static routes, > marking the ones in use, with [distance/metric].
vtysh -c 'show bgp ipv4 unicast 10.0.4.0/24'
Shows every path to one prefix with its local preference, MED, communities and which one is best.
vtysh -c 'configure terminal' -c 'route-map FROM-B permit 10' -c 'set local-preference 200'
Writes a route-map that gives routes local preference 200, for neighbor … route-map FROM-B in to apply.
vtysh -c 'configure terminal' -c 'ip prefix-list CUSTOMER permit 10.0.5.0/24'
Allows only one prefix in a prefix list, to apply to a customer with neighbor … prefix-list CUSTOMER in.
vtysh -c 'show rpki prefix-table'
Lists the ROAs the RPKI validator sent: which AS may originate each prefix, and up to what length.
vtysh -c 'clear bgp ipv4 unicast * soft in'
Runs every route already received through the inbound policy again, after a prefix list was edited.

Pitfalls

  • Two OSPF neighbours must agree on network, area and timers, or they never become Full.
  • A BGP session stuck in Active or Connect: the peer address, AS number or TCP port 179 is wrong or blocked.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab