// Module included in the following assemblies:
//
// * networking/metallb/metallb-configure-bgp-peers.adoc

:_mod-docs-content-type: REFERENCE
[id="nw-metallb-bgppeer-cr_{context}"]
= About the BGP peer custom resource

[role="_abstract"]
To establish network connectivity and advertise routes for load-balancer services, configure the properties of the MetalLB Border Gateway Protocol (BGP) peer custom resource (CR). Establishing these parameters ensures that your cluster authorizes specific routing peers to direct external traffic correctly to your application workloads.

The following table describes the parameters for the BGP peer CR:

.MetalLB BGP peer custom resource
[cols="1,1,3",options="header"]
|===

|Parameter
|Type
|Description

|`metadata.name`
|`string`
|Specifies the name for the BGP peer CR.

|`metadata.namespace`
|`string`
|Specifies the namespace for the BGP peer CR.

|`spec.myASN`
|`integer`
|Specifies the Autonomous System Number (ASN) for the local end of the BGP session. In all BGP peer CRs that you add, specify the same value. The range is `0` to `4294967295`.

|`spec.peerASN`
|`integer`
|Specifies the ASN for the remote end of the BGP session. The range is `0` to `4294967295`. If you use this parameter, you cannot specify a value in the `spec.dynamicASN` parameter.

|`spec.dynamicASN`
|`string`
| Detects the ASN to use for the remote end of the session without explicitly setting it. Specify `internal` for a peer with the same ASN, or `external` for a peer with a different ASN. If you use this parameter, you cannot specify a value in the `spec.peerASN` parameter.

|`spec.peerAddress`
|`string`
|Specifies the IP address of the peer to contact for establishing the BGP session. If you use this parameter, you cannot specify a value in the `spec.interface` parameter.

|`spec.interface`
|`string`
|Specifies the interface name to use when establishing a session. Use this parameter to configure unnumbered BGP peering.
You must establish a point-to-point, layer 2 connection between the two BGP peers. You can use unnumbered BGP peering with IPv4, IPv6, or dual-stack, but you must enable IPv6 RAs (Router Advertisements). Each interface is limited to one BGP connection.
If you use this parameter, you cannot specify a value in the `spec.peerAddress` parameter.

|`spec.sourceAddress`
|`string`
|Optional: Specifies the IP address to use when establishing the BGP session. The value must be an IPv4 address.

|`spec.peerPort`
|`integer`
|Optional: Specifies the network port of the peer to contact for establishing the BGP session. The range is `0` to `16384`.

|`spec.holdTime`
|`string`
|Optional: Specifies the duration for the hold time to propose to the BGP peer. The minimum value is 3 seconds (`3s`).
The common units are seconds and minutes, such as `3s`, `1m`, and `5m30s`. To detect path failures more quickly, also configure BFD.

|`spec.keepaliveTime`
|`string`
|Optional: Specifies the maximum interval between sending keep-alive messages to the BGP peer. If you specify this parameter, you must also specify a value for the `holdTime` parameter. The specified value must be less than the value for the `holdTime` parameter.

|`spec.routerID`
|`string`
|Optional: Specifies the router ID to advertise to the BGP peer. If you specify this parameter, you must specify the same value in every BGP peer custom resource that you add.

|`spec.password`
|`string`
|Optional: Specifies the MD5 password to send to the peer for routers that enforce TCP MD5 authenticated BGP sessions.

|`spec.passwordSecret`
|`string`
|Optional: Specifies name of the authentication secret for the BGP peer. The secret must live in the `metallb` namespace and be of type basic-auth.

|`spec.bfdProfile`
|`string`
|Optional: Specifies the name of a BFD profile.

|`spec.nodeSelectors`
|`object[]`
|Optional: Specifies a selector, using match expressions and match labels, to control which nodes can connect to the BGP peer.

|`spec.ebgpMultiHop`
|`boolean`
|Optional: Specifies that the BGP peer is multiple network hops away. If the BGP peer is not directly connected to the same network, the speaker cannot establish a BGP session unless this parameter is set to `true`. This parameter applies to _external BGP_.External BGP is the term that is used to describe when a BGP peer belongs to a different Autonomous System.

|`connectTime`
|`duration`
|Specifies how long BGP waits between connection attempts to a neighbor.

|===

[NOTE]
====
The `passwordSecret` parameter is mutually exclusive with the `password` parameter, and contains a reference to a secret containing the password to use. Setting both parameters results in a failure of the parsing.
====
