.. _example_protocols_bgp_parameters_distance: ######## Distance ######## Scenario to verify BGP **distance** (administrative distance) configuration. Administrative distance is how a router decides which route to install when the same destination is reachable through multiple routing protocols. Each protocol has a default distance value, and the route with the lowest distance wins. The default values are: eBGP external routes use **20**, iBGP internal routes use **200**, locally originated routes use **200**, and static routes use **1**. This is why static routes typically win over BGP when both exist for the same destination. There are two commands to modify BGP distances. The first is ``distance global``, which modifies the distance for **external** routes learned from eBGP peers, **internal** routes learned from iBGP peers, and **local** routes originated locally. Each type can be configured independently and uses its default value if not explicitly set. The second command is ``distance prefix``, which sets the distance for all routes received from neighbors whose IP address matches a given prefix. This is useful when you want different distances for different BGP neighbors without changing the global settings. ************************ Test BGP Distance Global ************************ Description =========== The ``distance global`` command modifies the administrative distance for all BGP routes based on their type. It requires configuring all three values together: external, internal, and local. This test first verifies the default behavior where eBGP routes have distance 20 and static routes have distance 1, causing static to win. Then it applies ``distance global external 5`` to lower the eBGP distance below the static route distance of 10, making BGP the preferred path. Scenario ======== .. include:: distance/testbgpdistanceglobal .. raw:: html