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
vrfsobject is a map of VRF names to VRF configurations. - The
routesobject is a map of route prefixes to route configurations. The prefix can be either IPv4 or IPv6. - The
next_hopsarray specifies a set of next-hop(s) for the static route. - Each next-hop can be a destination
ip_addr, an outgoingintf_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 system
{"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
This shows the count and state of VRF's learned from the system component and the active number of IPv4 and IPv6 static routes across all VRF's. 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@r70:~$ flockc static
{"sys_vrfs":{"vrf_count_active":1,"vrf_count_total":1},"ipv4":{"route_count":5},"ipv6":{"route_count":3},"intf_count":4}
Show Static prefixes
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 prefixes.
flock@r70:~$ flockc static -v default --af ipv4 -p
{"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", ...}}]}], ...}
Show a specific prefix.
flock@r01:~$ flockc static -v default --af ipv4 -p 40.40.40.0/24
{"40.40.40.0/24":[{"admin_dist":null,"origin":{"Static":"Conf"},"nhs":[...]}]}
defaultis the default vrf-name if the-voption is not specifiedipv6is the default AF type if theafoption is not given
Show Static prefixes in a VRF
flock@r01:~$ flockc static -v pink --af ipv4 -p
{...}
defaultis the default vrf-name if the-voption is not specifiedipv6is the default AF type if theafoption is not given
Show Static VRF's Overview
flock@r50:~$ flockc static -v
[{"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 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
idassigned by the kernel, if one exists - number of
attached_routesreferencing 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}
Static Operation Commands Reference
Help
flockc static -h
Overview
flockc static
All static interfaces
flockc static -i
Single interface
flockc static -i <interface-name>
All VRF 's
flockc static -v
Single VRF
flockc static -v <vrf-name>
Prefixes
flockc static [-v <vrf-name>] -p [<ip-network>] [--af {ipv4 | ipv6}]
defaultis the default vrf-name if the-voption is not specifiedipv6is the default AF type ifafoption is not specified