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 minimal configuration file below;

  • The vrf object is an array of vrfs, indexed by vrf_name.
  • The static_routes object is an array of static routes, indexed by ip_net.
  • The ip_net object is used to specify the static route prefix. The prefix can be either IPv4 or IPv6.
  • The next_hops object is used to specify a set of next-hop(s) for the static route.
  • Each next-hop object is defined as either a destination ip_addr or an outgoing intf_name or both.

In this example there is a single vrf containing a single static route to the 20.20.20.0/24 network. Traffic for that network will be forwarded out of interface ens1 to the neighboring device with the address 10.10.10.2.

"static": {
    "vrf": [
        {
            "vrf_name": "default",
            "static_routes": [
                {
                    "ip_net": "20.20.20.0/24",
                    "next_hops": [
                        {
                            "ip_addr": "10.10.10.2",
                            "intf_name": "ens1"
                        }
                    ]
                }
            ]
        }
    ]
}

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 "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": {
    "vrf": [
        {
            "vrf_name": "default",
            "static_routes": [
                {
                    "ip_net": "20.20.20.0/24",
                    "next_hops": [
                        {
                            "ip_addr": "10.10.10.2"
                        }
                    ]
                }
            ]
        }
    ]
}

Non-recursive route configuration

"static": {
    "vrf": [
        {
            "vrf_name": "default",
            "static_routes": [
                {
                    "ip_net": "20.20.20.0/24",
                    "next_hops": [
                        {
                            "ip_addr": "10.10.10.2",
                            "intf_name": "ens1"
                        }
                    ]
                },
                {
                    "ip_net": "10:10::0/64",
                    "next_hops": [
                        {
                            "intf_name": "ens1"
                        }
                    ]
                }
            ]
        }
    ]
}

Multi-path recursive route configuration

"static": {
    "vrf": [
        {
            "vrf_name": "default",
            "static_routes": [
                {
                    "ip_net": "20.20.20.0/24",
                    "next_hops": [
                        {
                            "ip_addr": "10.10.10.2"
                        },
                        {
                            "ip_addr": "11.11.11.2"
                        }
                    ]
                }
            ]
        }
    ]
}

Floating static route configuration

"static": {
    "vrf": [
        {
            "vrf_name": "default",
            "static_routes": [
                {
                    "ip_net": "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@flocknet$ flockc system
"hostname": "flocknet"
"software": "Flock Networks Routing Suite"
"version": "20.4.0"
"model": "Large"
"base_os": "Linux"
"pid": 2423
"compile_mode": "Release"
"log_level": "info"
"uptime": Uptime { days: 0, hours: 0, mins: 0, secs: 19 }
"enabled_protocols": ["Static"]
flock@flocknet:~$

Show Static Overview

Shows the configured number of IPv4 and IPv6 static routes. It also shows the number of interfaces that the static component is aware of, these include both the system interfaces that are currently enabled as well as the interfaces that are not enabled in the system but are referred to by their names in the static route configuration.

flock@r01:~$ flockc static
{"ipv4":{"route_count":4},"ipv6":{"route_count":1},"intf_count":6}

Show all interfaces

Static tracks interfaces in the system. These include:

  • the interfaces that are enabled and have been assigned an interface ID by the kernel
  • the interfaces that are referred to by their names in the static routes but have not been assigned an interface ID by the kernel

Static shows the current interface state as follows:

  • the interface name
  • the interface id assigned by the kernel, if one exists
  • number of attached_routes referencing the interface

In the following example, ens4 interface has not been assigned an ID by the kernel

flock@r61:~$ flockc static -i
{"name":"ens1","id":2,"attached_routes":3}
{"name":"ens2","id":3,"attached_routes":2}
{"name":"ens3","id":4,"attached_routes":0}
{"name":"ens4","attached_routes":1}
{"name":"lo","id":1,"attached_routes":0}

Show Static prefix's

Note that this is not the System RIB. The static routes show all the routes from the configuration. For an attached route, it is only programmed in the RIB once its interface has been assigned an ID by the kernel.

Show all prefix's.

flock@r01:~$ flockc static -p --af ipv4
{"ip_net":"20.20.20.0/24"}
{"via":"10.10.10.2"}
{"ip_net":"30.30.30.0/24"}
{"intf":"ens3"}
{"ip_net":"40.40.40.0/24","admin_distance":100}
{"via":"10.10.10.2"}
{"via":"11.11.11.2"}

Show a specific prefix.

flock@r61:~$ flockc static -p 40.40.40.0/24 --af ipv4
{"ip_net":"40.40.40.0/24","nhs":[{"via":"10.10.10.2"},{"via":"20.20.20.2"}],"admin_distance":100}

ipv6 is the default AF type if the af option is not given

Static Operation Commands Reference

Help

flockc static -h

Overview

flockc static

All static interfaces

flockc static -i

Single interface

flockc static -i <interface-name>

Prefixes

flockc static -p [<ip-network>] [--af {ipv4 | ipv6}]

ipv6 is the default AF type if af option is not specified