Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Static Component

Configuration Overview

The static route configuration is held under the top level static object in /etc/flockd/flockd.json. If the static object exists static routes will be enabled and the static master thread will be spawned.

In the configuration format:

  • The vrfs object is a map of VRF names to VRF configurations.
  • The routes object is a map of route prefixes to route configurations. The prefix can be either IPv4 or IPv6.
  • The next_hops array specifies a set of next-hop(s) for the static route.
  • Each next-hop can be a destination ip_addr, an outgoing intf_name, both, or a special next-hop string ("Discard" or "Reject").

In this example there is a single VRF containing a single static route to the 192.0.2.0/25 network. Traffic for that network will be forwarded to the neighboring device with the address 10.0.1.2.

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "192.0.2.0/25": {
                    "next_hops": [
                        { "ip_addr": "10.0.1.2" }
                    ]
                }
            }
        }
    }
}

Configuration in detail

If a next_hop only contains an ip_addr the static route is said to be "recursive" as a further lookup is needed to find the outgoing interface. If a next_hop has an outgoing intf_name defined the static route is said to be "attached" (non-recursive).

"Floating static" routes can also be defined using the distance object. A "floating static" route is given a high distance (Admin Distance) which means during normal operation the RIB will choose to use another protocol that has a lower distance. If there is a network outage and the preferred route is withdrawn from the RIB, the "floating static" route will take over.

Recursive route configuration

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "192.0.2.0/25": {
                    "next_hops": [
                        { "ip_addr": "10.0.1.2" }
                    ]
                }
            }
        }
    }
}

Attached route configuration

An attached route specifies both an ip_addr and an intf_name, pinning the route to a specific outgoing interface.

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "192.0.2.128/25": {
                    "next_hops": [
                        { "ip_addr": "10.0.1.2", "intf_name": "r1-n1" }
                    ]
                }
            }
        }
    }
}

Multi-path recursive route configuration

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "20.20.20.0/24": {
                    "next_hops": [
                        { "ip_addr": "10.10.10.2" },
                        { "ip_addr": "11.11.11.2" }
                    ]
                }
            }
        }
    }
}

Discard route configuration

A discard route silently drops matching traffic (similar to a blackhole route).

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "198.51.100.0/24": {
                    "next_hops": [
                        "Discard"
                    ]
                }
            }
        }
    }
}

Reject route configuration

A reject route drops matching traffic and sends an ICMP unreachable response to the sender.

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "203.0.113.0/24": {
                    "next_hops": [
                        "Reject"
                    ]
                }
            }
        }
    }
}

Floating static route configuration

"static": {
    "vrfs": {
        "default": {
            "routes": {
                "20.20.20.0/24": {
                    "next_hops": [
                        { "ip_addr": "10.10.10.2" }
                    ],
                    "distance": 120
                }
            }
        }
    }
}

Operational State Overview

Check Static is enabled

Check static is listed in the enabled_protocols field.

flock@r70:~$ flockc sys overview
{"host_info":{"hostname":"r70", ...},"system_info":{"name":"flockd", ...},"pid":1234,"log_level":"info","uptime":"days: 0, hours: 0, mins: 0, secs: 19","enabled_protocols":["BGPv4","OSPFv2","Static"],"software_errors":0, ...}

Show Static Overview

Shows the count and state of VRFs learned from the system component and the active number of IPv4 and IPv6 static routes across all VRFs.

flock@r70:~$ flockc static overview
{"sys_vrfs":{"vrf_count_active":1,"vrf_count_total":1},"ipv4":{"route_count":5},"ipv6":{"route_count":3}, ...}

Show Static VRFs

flock@r50:~$ flockc static list-vrfs
[{"vrf_id":1000,"route_count_ipv4":{"route_count":1024},"route_count_ipv6":{"route_count":42}},{"vrf_id":1001,"route_count_ipv4":{"route_count":73},"route_count_ipv6":{"route_count":56}}]

Show a single VRF

flock@r70:~$ flockc static vrf default show
{"vrf_id":254,"route_count_ipv4":{"route_count":5},"route_count_ipv6":{"route_count":3}, ...}

Show Static prefixes

Note that this is the static-protocol view, not the System RIB. Static routes are shown as they appear in the configuration. For an attached route, the entry is only programmed to the RIB once its interface has been assigned an ID by the system.

Look up a specific prefix:

flock@r01:~$ flockc static vrf default lookup 40.40.40.0/24
{"40.40.40.0/24":[{"admin_dist":null,"origin":{"Static":"Conf"},"nhs":[...]}]}

Walk all prefixes within a root (use 0.0.0.0/0 or ::/0 for the full IPv4 / IPv6 table):

flock@r70:~$ flockc static vrf default walk 0.0.0.0/0
{"70.0.0.0/8":[{"admin_dist":null,"origin":{"Static":"Conf"},"nhs":[{"SpecialNextHop":{"vrf_id":254,"special_next_hop_type":"Discard"}}]}],"70.0.75.0/24":[{"admin_dist":0,"origin":"Connected","nhs":[{"Connected":{"name":"r70-n75", ...}}]}], ...}

Static Operation Commands Reference

Help

flockc static --help

Overview

flockc static overview

All VRFs

flockc static list-vrfs

Single VRF

flockc static vrf <vrf-name> show

Prefix lookup

flockc static vrf <vrf-name> lookup <ip-network>

Prefix walk

flockc static vrf <vrf-name> walk <root> [--start-from <prefix>]