· 7 min read

BGP Multihoming: Local-Pref, AS-Path Prepend, Redundancy

BGP multihoming means connecting your ASN to two or more upstream providers and announcing your prefixes through all of them, so one failed link or provider does not take you offline. You control outbound traffic with local-preference, and you influence inbound traffic with AS-path prepending, more-specific prefixes, and provider communities.

The key point: you fully control only one direction. Outbound is your decision. Inbound is a suggestion that other networks may or may not follow. Most multihoming problems come from forgetting that.

What Multihoming Gives You (and What It Doesn't)

Multihoming protects you from:

It does not automatically give you:

Set your goal before you write config. "Primary/backup" is simple and predictable. "Balanced" takes ongoing tuning.

Prerequisites

If you need the building blocks first, see our guides on getting an ASN, ROAs, and IRR objects.

The examples below use documentation values: your ASN is AS64496, upstream A is AS64497, upstream B is AS64498, and your prefix is 192.0.2.0/24.

Step 1: Build Safe Export Filters First

The most damaging multihoming mistake is becoming an accidental transit network. If you re-announce routes learned from upstream A to upstream B, you invite traffic you can't carry. Export only your own prefixes.

# BIRD 2
define MY_AS = 64496;

ipv4 table master4;

protocol static my_prefixes {
    ipv4;
    route 192.0.2.0/24 blackhole;
}

filter export_to_upstreams {
    if net = 192.0.2.0/24 && source = RTS_STATIC then accept;
    reject;
}

Use the same export filter for every upstream, then add per-upstream attributes (like prepends) in separate filters. Never let a "default accept" slip into an export policy.

Step 2: Control Outbound Traffic With Local-Preference

Local-preference (local-pref) is evaluated early in best-path selection, before AS-path length. Higher wins. It is not sent to eBGP neighbors, so it only affects your own routers. That makes it the correct tool for outbound policy.

Primary/backup:

filter import_upstream_a {
    if net.len > 24 then reject;
    if net ~ [ 0.0.0.0/8+, 10.0.0.0/8+, 127.0.0.0/8+, 169.254.0.0/16+,
               172.16.0.0/12+, 192.168.0.0/16+, 224.0.0.0/3+ ] then reject;
    bgp_local_pref = 200;
    accept;
}

filter import_upstream_b {
    if net.len > 24 then reject;
    if net ~ [ 0.0.0.0/8+, 10.0.0.0/8+, 127.0.0.0/8+, 169.254.0.0/16+,
               172.16.0.0/12+, 192.168.0.0/16+, 224.0.0.0/3+ ] then reject;
    bgp_local_pref = 100;
    accept;
}

protocol bgp upstream_a {
    local as MY_AS;
    neighbor 198.51.100.1 as 64497;
    ipv4 { import filter import_upstream_a; export filter export_to_upstreams; };
}

protocol bgp upstream_b {
    local as MY_AS;
    neighbor 203.0.113.1 as 64498;
    ipv4 { import filter import_upstream_b; export filter export_to_upstreams; };
}

Everything is preferred via A. If A fails, B takes over automatically because its routes are already in the table.

Balancing outbound: Raise local-pref for specific destinations on the other upstream. For example, if upstream B has better reachability to a particular set of origin ASNs, match on bgp_path.last or an AS-path set and give those routes a higher value. Start with a handful of high-volume destinations rather than trying to split everything.

If you accept only a default route from each upstream, you can still prefer one by giving its default a higher local-pref. For the trade-offs, see our post on full table versus default route.

Step 3: Influence Inbound Traffic

Other networks choose how to reach you based on their own policy. Three levers work, in rough order of preference.

Provider communities

Many upstreams publish communities that set local-pref inside their network or prepend toward their peers. This is more reliable than raw prepending because it acts where the decision is made. Check each provider's documentation; the values differ per provider. Our communities guide covers the typical patterns.

More-specific prefixes

If you hold a /23, you can split it into two /24s and steer each differently:

The result is a rough split by prefix, because longest-match wins regardless of path length. With a single /24 you can't do this, since longer prefixes are filtered by most networks.

AS-path prepend

Prepending adds your ASN repeatedly to make a path look longer and less attractive. It is blunt but widely supported:

filter export_upstream_b_prepend {
    if net = 192.0.2.0/24 && source = RTS_STATIC then {
        bgp_path.prepend(MY_AS);
        bgp_path.prepend(MY_AS);
        accept;
    }
    reject;
}

Apply this filter on the session toward the backup provider. Remote networks that see equal local-pref for both paths will now prefer the shorter one through A.

Prepending has limits:

Change one thing at a time, wait a few minutes for propagation, then measure.

Step 4: Make Failover Fast

BGP default hold time can leave a dead link in place for minutes. Reduce that:

Also protect the routing table from runaway sessions with max-prefix limits and enable RPKI origin validation (ROV) so you drop invalid routes.

Step 5: Handle Asymmetric Routing

With multihoming, traffic often enters via upstream A and leaves via B. That's normal, but it breaks:

Use loose uRPF or none on upstream interfaces, and put stateful inspection where both directions are visible, or make sure state is synchronized.

Verify Your Policy

birdc show protocols
birdc show route for 192.0.2.10 all
birdc show route export upstream_b

Check that:

  1. Both sessions are Established.
  2. Your /24 is exported to both upstreams and nothing else is.
  3. Best path for outbound destinations matches your local-pref plan.

Then check from the outside. A public looking glass shows how others see your prefix, including AS-path and prepends. The Nixcon looking glass runs BGP route, ping, and traceroute queries from İzmir, Frankfurt, and the US, which is useful for confirming that prepends and communities took effect.

Common Mistakes and Fixes

Mistake Symptom Fix
Re-announcing upstream routes Unexpected traffic, upstream complaints Strict export filter: own prefixes only
Missing ROA for a backup path Prefix invalid at one provider Make sure the ROA authorizes your ASN with a correct max-length
Expecting prepend to balance 50/50 One link idle Use communities or split into more-specifics
Different prefix lists per upstream Failover doesn't carry all traffic Announce every prefix to every upstream, then shape
Strict uRPF on both links Legitimate traffic dropped Use loose mode
Single physical path to both providers Both sessions drop together Use diverse fiber or facilities

Where Nixcon Fits

Nixcon operates its own network, AS40368, with a main data center in İzmir, Turkey and POPs in Frankfurt and Fremont, California. If you want to try multihoming without buying a router, a BGP-enabled VDS lets you announce your own ASN and prefix from a BGP session on the VDS. You can choose unprotected or DDoS-protected announcements, and a full routing table or Nixcon routes only. ASN and prefix ownership is verified automatically through RPKI ROAs and RIR/IRR records, and your ASN is added to the AS-NIXCON AS-SET. Provisioning is automated, and Nixcon can be one of your upstreams alongside others.

Frequently asked questions

How many upstreams do I need for BGP multihoming?

Two is the minimum. Two providers on physically diverse paths cover most failure scenarios. More upstreams add options for traffic engineering but also more policy to maintain.

Does AS-path prepending control outbound or inbound traffic?

Inbound. Prepending lengthens the path you advertise, which influences how other networks reach you. Outbound traffic is controlled with local-preference on your own routers.

Can I multihome with a single /24?

Yes, for redundancy and prepend-based influence. But you can't split it into more-specifics, because most networks filter prefixes longer than /24 in IPv4.

Why isn't my traffic splitting evenly across upstreams?

Remote networks apply their own local-pref and path policies, so prepending is only a hint. Use provider communities or split a larger block into two /24s and steer each separately, then measure with flow data.

Test multihoming with your own ASN on a BGP-enabled VDS from Nixcon.Learn more