#808·metallb

Add support for AS path prepending

Author: enkelprifti98Created Feb 10, 2021Updated May 18, 2026
Labelsenhancementhelp wantedprotocol/BGP

It would be useful to have the ability of AS path prepending in MetalLB. There are many ways we could think about the implementation in terms of UX but here's an example by simply adding more ASNs on the my-asn value:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    peers:
    - peer-address: 10.0.0.1
      peer-asn: 64501
# prepending 2 times
      my-asn: 64500 64500 64500
      address-pools:
      - default

Another way would maybe be to just add a new parameter called as-path-prepending and provide either ASNs or the number of times to prepend the AS path.

I think the following example is the ideal UX but I will let the community provide their opinions.

Example:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    peers:
    - peer-address: 10.0.0.1
      peer-asn: 64501
      my-asn: 64500
# prepending 2 times by just giving ASNs
      as-path-prepending: 64500 64500
      address-pools:
      - default

Another example:

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    peers:
    - peer-address: 10.0.0.1
      peer-asn: 64501
      my-asn: 64500
# prepending 2 times by an integer of the amount of times you want to prepend.
      as-path-prepending: 2
      address-pools:
      - default