# Establish BGP Session

Bare Metal uses Border Gateway Protocol (BGP) to exchange routes between your CIDR Block network and your local network. If you have your own Autonomous System (ASN) and public IP range, enable our Global BGP and then configure a BGP peer for your local router to achieve a better network performance.

## Prerequisites

To successfully creating a Global BGP session, you need to have:

1. **A public ASN:** You have a registered public ASN. See [**Authorize ASN**](https://docs.console.zenlayer.com/welcome/global-bgp/authorize-asn) for details;
2. **Available BYOIPs:** Bring Your Own IP Addresses (BYOIP) must be registered and the registered organization name should match your account name on Console;
3. **Available Bare Metal Instance:** See [**Create a Bare Metal Instance**](https://docs.console.zenlayer.com/welcome/bare-metal/get-started/create-a-bare-metal-instance) for details;
4. **Available CIDR Block IP and correctly assigned:** See [**Create and assign a CIDR Block IP**](https://docs.console.zenlayer.com/welcome/bare-metal/get-started/create-a-cidr-block) for details.

## Procedures

<div align="left"><figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2FYxF779rJwQY6oj14tjRN%2Fimage.png?alt=media&#x26;token=94aad3b9-e283-41eb-9a41-76f68f7fad46" alt=""><figcaption><p>Establish BGP Session</p></figcaption></figure></div>

1. On the upper left corner of zenConsole, go to **Products** > **Global BGP** > **BGP Session** > **Establish BGP Session**.
2. Select your desired location to establish BGP session.\
   Only show specified zones with existing CIDR blocks here. If no desired zones, go to create new CIDR block in **BGP Enabled** zones.
3. Select your authorized ASN.
4. Configure BGP peer IP.\
   Choose CIDR block IPs of your Bare Metal instances as the peer IPs. The gateway of this CIDR block will automatically be configured as the router IP for the BGP peer.
5. *<mark style="color:green;">(Optional)</mark>* Add MD5 authentication for your BGP session.\
   If you enable MD5 authentication, ensure an identical key on both local router and peer router.
6. More settings\
   \- Label your BGP session\
   \- Select a resource group for your BGP session\
   \- Add a note for your BGP session

## Result

After the BGP session is established, you will find it in BGP Session list.

<div align="left"><figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2FpDGvdleyw5m0vwfMlx55%2Fimage.png?alt=media&#x26;token=b01d453c-ba48-43c3-a8c3-2d4d9e9cf6eb" alt=""><figcaption><p>BGP Session List</p></figcaption></figure></div>

### Details

Click the BGP session name to view the details.

<div align="left"><figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2Fe2kks1HdkVd3Fm2xnGmD%2Fimage.png?alt=media&#x26;token=e41e8f97-a0d7-4588-a45f-7a4001679ed2" alt=""><figcaption><p>BGP Session Details</p></figcaption></figure></div>

#### Add BYOIP

<div align="left"><figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2FExhMxXQyuJfVp06B91VI%2Fimage.png?alt=media&#x26;token=b1a488c3-f64a-4970-a470-770d9f89765a" alt="" width="561"><figcaption><p>Add BYOIP</p></figcaption></figure></div>

You can advertise BYOIPs to the BGP session and make these IPs reachable for the BGP peer. See [**Advertise BYOIP**](https://docs.console.zenlayer.com/welcome/global-bgp/advertise-byoip) for more details.

#### Delete

<div align="left"><figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2FhlqfbvOFT8P7o7RzFdRD%2Fimage.png?alt=media&#x26;token=f73fb4d5-f7b2-4e81-a5df-f2227dda83dd" alt="" width="300"><figcaption><p>Delete BGP Session</p></figcaption></figure></div>

You can delete the BGP session without any BYOIP advertised. You need to configure all the peer IPs if you want to enable this BGP session again.

#### Add Peer IP

<div align="left"><figure><img src="https://3201622183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3FDdkCL2HzhbPpPMFt%2Fuploads%2FoEyqfNYofEMRVzv7jL8H%2Fimage.png?alt=media&#x26;token=089fa4f9-5111-4b36-99ea-bb57187e4e19" alt="" width="563"><figcaption><p>Add Peer IP</p></figcaption></figure></div>

You can select CIDR block IPs that have been assigned to your bare metal instances as the peer IP, and add them to your BGP session.

#### Remove Peer IP

You can remove peer IP from the BGP session and add it back if you need.

#### Update Note

Update the information you want to note if you need.

### More Actions

In the BGP Session list, click **Actions** to add peer IP, add BYOIP or delete BGP session. See [**Details**](#details) for specific steps.&#x20;

## What to Do Next

After establishing your BGP session on zenConsole, to enable BGP interconnect, you need to configure BGP on your router. See [**Configure BGP on Your Router**](https://docs.console.zenlayer.com/welcome/global-bgp/establish-bgp-session/configure-bgp-on-your-router) for more details.
