Now you have your first Upstream up and running, lets go one step further adding a second upstream.
At this point we might want to have a look at how our BGP Software Bird selects a path:
The two most common ways to work with are AS-Paths and Preferences,
-the longer the as-path the less preferred it is, eg. 34927 204438
will be preferred over 34927 209533 204438
. Which means we can influence traffic inbound traffic flow by pre-pending, adding our asn multiple times to the path.
In bird we can do this by adding: bgp_path.prepend(209533);
to our export filters:
export filter {
bgp_path.prepend(209533);
if proto ="static_bgp" then accept;
};
You can repeat that bgp_prepend
multiple times, don’t overdo it though, many networks filter too long paths (>40). Keep in mind, the average path length in the DFZ is about 4 to 5, so prepending 20 times will rarely do anything more than prepending 3 times.
-On each BGP Session we can set a preference by adding: default bgp_local_pref 200;
to our protocol.
protocol bgp upstream {
import filter {
accept;
};
default bgp_local_pref 200;
If we don’t specify a preference its per default 100. If we want to prefer a certain upstream, maybe because its cheaper, or local, we can set a preference of 120 instead of 100, this now means that most of our traffic will go out over this line as preference beats always as-path length.