summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2023-09-28 08:15:25 -0400
committerGitHub <noreply@github.com>2023-09-28 08:15:25 -0400
commit45eec10c839885205f5f94631d304a153e15bb0b (patch)
treec81fa24dfa56fa1cf237553dfcd73dae1da6c403
parent6a9fe6fac3876a180820418e83d9e4cb0ac30040 (diff)
parent5952e479e5af6d7daf69b259358c403da3ba1272 (diff)
Merge pull request #14502 from opensourcerouting/fix/document_on_how_to_set_the_distance_from_linux
doc: Add an example on how to set a distance for a route from the kernel
-rw-r--r--doc/user/bgp.rst9
-rw-r--r--doc/user/zebra.rst28
2 files changed, 33 insertions, 4 deletions
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index 1431cbdd28..210ae447a1 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -461,6 +461,15 @@ Administrative Distance Metrics
Sets the administrative distance for a particular route.
+ If the system has a static route configured from the kernel, it has a
+ distance of 0. In some cases, it might be useful to override the route
+ from the FRR. E.g.: Kernel has a statically configured default route,
+ and you received another default route from the BGP and want to install
+ it to be preferred over the static route. In such a case, you MUST set
+ a higher distance from the kernel.
+
+ .. seealso:: :ref:`administrative-distance`
+
.. _bgp-requires-policy:
Require policy on EBGP
diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst
index 8b2d727f36..7918fbd9d9 100644
--- a/doc/user/zebra.rst
+++ b/doc/user/zebra.rst
@@ -374,6 +374,8 @@ outgoing interface
Resolve PBR nexthop via ip neigh tracking
+.. _administrative-distance:
+
Administrative Distance
=======================
@@ -420,16 +422,34 @@ the same distances that other routing suites have chosen.
+------------+-----------+
An admin distance of 255 indicates to Zebra that the route should not be
-installed into the Data Plane. Additionally routes with an admin distance
+installed into the Data Plane. Additionally routes with an admin distance
of 255 will not be redistributed.
Zebra does treat Kernel routes as special case for the purposes of Admin
-Distance. Upon learning about a route that is not originated by FRR
-we read the metric value as a uint32_t. The top byte of the value
+Distance. Upon learning about a route that is not originated by FRR
+we read the metric value as a uint32_t. The top byte of the value
is interpreted as the Administrative Distance and the low three bytes
-are read in as the metric. This special case is to facilitate VRF
+are read in as the metric. This special case is to facilitate VRF
default routes.
+.. code-block:: shell
+
+ $ # Set administrative distance to 255 for Zebra
+ $ ip route add 192.0.2.0/24 metric $(( 2**32 - 2**24 )) dev lo
+ $ vtysh -c 'show ip route 192.0.2.0/24 json' | jq '."192.0.2.0/24"[] | (.distance, .metric)'
+ 255
+ 0
+ $ # Set administrative distance to 192 for Zebra
+ $ ip route add 192.0.2.0/24 metric $(( 2**31 + 2**30 )) dev lo
+ $ vtysh -c 'show ip route 192.0.2.0/24 json' | jq '."192.0.2.0/24"[] | (.distance, .metric)'
+ 192
+ 0
+ $ # Set administrative distance to 128, and metric 100 for Zebra
+ $ ip route add 192.0.2.0/24 metric $(( 2**31 + 100 )) dev lo
+ $ vtysh -c 'show ip route 192.0.2.0/24 json' | jq '."192.0.2.0/24"[] | (.distance, .metric)'
+ 128
+ 100
+
Route Replace Semantics
=======================