---
title: BGP
slug: aidc/bgp
createdAt: 2025-12-01T11:11:08.000Z
---

## <font color="#1d50a2">BGP View</font>

<font color="#1d05a2">Table 1 BGP View</font>

| **Command**                                                                    | **Purpose**                                      |
| ------------------------------------------------------------------------------ | ------------------------------------------------ |
| **show ip bgp neighbors** \[*A.B.C.D*\|*X\:X\::X\:X* \[OPTIONs]]               | Display information of BGP neighbors.            |
| **show ip bgp** \[*A.B.C.D/M*\|*A.B.C.D*\|*X\:X\::X\:X/M*\|*X\:X\::X\:X*]      | Display network information of BGP neighbors.    |
| **show ip bgp summary&#x20;**\[**established**\|**failed**\|**json**]          | Display summary of BGP neighbor status.          |
| **show ip bgp community-list** \{*community\_list\_number*\|*community\_name*} | Display information of BGP community-list.       |
| **show ip bgp** \[**vrf all**\|*vrf\_name*]                                    | Display information of BGP.                      |
| **show bgp peer-group**                                                        | Display detailed information on BGP peer groups. |
| **show ip bgp statistics**                                                     | Display BGP RIB advertisement statistics.        |

### <font color="#1d50a2">show ip bgp neighbors \[*A.B.C.D|X\:X\:\:X\:X* \[*OPTIONs*\]\]</font>

**\[Command]**
**show ip bgp neighbors** \[*A.B.C.D|X\:X\::X\:X* \[*OPTIONs*]]

**\[Purpose]**
Display information of BGP neighbors.

**\[Parameters]**

| **Parameter** | **Description**                             |
| ------------- | ------------------------------------------- |
| *A.B.C.D*     | IPv4 neighbor to display information about. |
| *X\:X\::X\:X* | IPv6 neighbor to display information about. |

**\[Options]**

| **Option**            | **Description**                                              |
| --------------------- | ------------------------------------------------------------ |
| **routes**            | Display routes learned from neighbor.                        |
| **advertised-routes** | Display the routes advertised to a BGP neighbor.             |
| **received-routes**   | Display the received routes from neighbor.                   |
| **prefix-counts**     | Display detailed prefix count information.                   |
| **filtered-routes**   | Display the filtered routes received from neighbor.          |
| **bestpath-routes**   | Display the routes selected by best path.                    |
| **received**          | Display information received from a BGP neighbor.            |
| **flap-statistics**   | Display flap statistics of the routes learned from neighbor. |
| **dampened-routes**   | Display the dampened routes received from neighbor.          |
| **json**              | JavaScript Object Notation.                                  |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip bgp neighbors 10.0.0.1
BGP neighbor is 10.0.0.1, remote AS 65100, local AS 65100, internal link
Hostname: leaf-103
  BGP version 4, remote router ID 10.1.0.103, local router ID 10.1.0.221
  BGP state = Established, up for 00:11:35
  Last read 00:00:35, Last write 00:00:35
  Hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    AddPath:
      IPv4 Unicast: RX advertised IPv4 Unicast and received
    Route refresh: advertised and received(old & new)
    Address Family IPv4 Unicast: advertised and received
    Hostname Capability: advertised (name: sonic,domain name: n/a) received (name: leaf-103,domain name: n/a)
    Graceful Restart Capability: advertised and received
      Remote Restart timer is 120 seconds
      Address families by peer:
        none
  Graceful restart information:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
    Local GR Mode: Helper*
    Remote GR Mode: Helper
    R bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 120
    IPv4 Unicast:
      F bit: False
      End-of-RIB sent: Yes
      End-of-RIB sent after update: Yes
      End-of-RIB received: Yes
      Timers:
        Configured Stale Path Time(sec): 360
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  8          7
    Notifications:          2         10
    Updates:                2         14
    Keepalives:            34         30
    Route Refresh:          0          0
    Capability:             0          0
    Total:                 46         61
  Minimum time between advertisement runs is 0 seconds
 For address family: IPv4 Unicast
  Update group 7, subgroup 4
  Packet Queue length 0
  Community attribute sent to this neighbor(all)
  7 accepted prefixes
  Connections established 2; dropped 1
  Last reset 00:11:37,  No AFI/SAFI activated for peer
Local host: 10.0.0.2, Local port: 179
Foreign host: 10.0.0.1, Foreign port: 37052
Nexthop: 10.0.0.2
Nexthop global: fe80::1a17:25ff:fe37:6736
Nexthop local: fe80::1a17:25ff:fe37:6736
BGP connection: shared network
BGP Connect Retry Timer in Seconds: 120
Estimated round trip time: 1 ms
Read thread: on  Write thread: on  FD used: 24
```

### <font color="#1d50a2">show ip bgp \[*A.B.C.D/M*|*A.B.C.D*|*X\:X\:\:X\:X/M***|***X\:X\:\:X\:X*\]</font>

**\[Command]**
**show ipbgp** \[*A.B.C.D/M*|*A.B.C.D*|*X\:X\::X\:X/M*|*X\:X\::X\:X*]

**\[Purpose]**
Display network information of BGP neighbors.

**\[Parameters]**

| **Parameter**   | **Description**                                   |
| --------------- | ------------------------------------------------- |
| *A.B.C.D/M*     | IPv4 prefix.                                      |
| *A.B.C.D*       | IPv4 network in the BGP routing table to display. |
| *X\:X\::X\:X/M* | IPv6 prefix.                                      |
| *X\:X\::X\:X*   | IPv6 network in the BGP routing table to display. |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip bgp
BGP table version is 1282, local router ID is 10.1.0.32, vrf id 0
Default local pref 100, local AS 65100
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*= 192.177.0.0/25   10.0.0.59             0 64600 65534 64618 65100 ?
*>                  10.0.0.57            0 64600 65534 64618 65100 ?
*= 192.177.0.128/25 10.0.0.59              0 64600 65534 64618 65100 ?
*>                  10.0.0.57            0 64600 65534 64618 65100 ?
Display ed  2 routes and 1282 total paths
```

### <font color="#1d50a2">show ip bgp summary \[established|failed|json\]</font>

**\[Command]**
**show ip bgp summary** \[**established**|**failed**|**json**]

**\[Purpose]**
Display summary of BGP neighbor status.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip bgp summary
IPv4 Unicast Summary:
BGP router identifier 10.1.0.32, local AS number 65100 vrf-id 0
BGP table version 14084
RIB entries 1287, using 231 KiB of memory
Peers 2, using 41 KiB of memory
Peer groups 6, using 384 bytes of memory
Neighbor     V      AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   NeighborName
10.0.0.57    4   64600    5593    7340        0    0    0 02:57:22          640   ARISTA01T1
10.0.0.59    4   64600    5599    7118        0    0    0 02:57:17          640   ARISTA02T1
Total number of neighbors 2
```

### <font color="#1d50a2">show ip bgp community-list \{*community\_list\_number*|*community\_name*\}</font>

**\[Command]**
**show ip bgp community-list** \{*community\_list\_number*|*community\_name*}

**\[Purpose]**
Display information of BGP community-list.

**\[Parameters]**

| **Parameter**             | **Description**                             |
| ------------------------- | ------------------------------------------- |
| *community\_list\_number* | Community-list number, range from 1 to 500. |
| *community\_name*         | Community name.                             |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip bgp community-list
```

### <font color="#1d50a2">show ip bgp \[vrf all|*vrf\_name*\]</font>

**\[Command]**
**show ip bgp** \[**vrf all**|*vrf\_name*]

**\[Purpose]**
Display information of BGP.

**\[Parameters]**

| **Parameter** | **Description**                                       |
| ------------- | ----------------------------------------------------- |
| **all**       | All Views/VRFs.                                       |
| *vrf\_name*   | Specify the VRF name, the default VRF is **default**. |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip bgp vrf all
Instance default:
BGP table version is 2375, local router ID is 30.11.0.84, vrf id 0
Default local pref 100, local AS 65100
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0/0        30.11.13.9               0 65101  4200000001 i
```

### <font color="#1d50a2">show bgp peer-group</font>

**\[Command]**
**show bgp peer-group**

**\[Purpose]**
Display detailed information on BGP peer groups.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show bgp peer-group
BGP peer-group PEER_V4_EBGP
  Peer-group type is external
  Configured address-families: IPv4 Unicast; L2VPN EVPN;
  Peer-group members:
    30.11.122.1  Active
    30.11.122.137  Active
BGP peer-group PEER_V6_EBGP
  Peer-group type is external
  Configured address-families: IPv6 Unicast; L2VPN EVPN;
  Peer-group members:
    2022::2222  Active
    2022::2224  Active
```

### <font color="#1d50a2">show ip bgp statistics</font>

**\[Command]**
**show ip bgp statistics**

**\[Purpose]**
Display BGP RIB advertisement statistics.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ip bgp statistics
BGP IPv4 Unicast RIB statistics (VRF default)
Total Advertisements          :           25
Total Prefixes                :           25
Average prefix length         :        19.20
Unaggregateable prefixes      :           25
Maximum aggregateable prefixes:            0
BGP Aggregate advertisements  :            0
Address space advertised      :       985600
                  % announced :         0.02
                /8 equivalent :         0.06
               /24 equivalent :      3850.00
Advertisements with paths     :           25
Longest AS-Path (hops)        :            1
Average AS-Path length (hops) :         1.00
Largest AS-Path (bytes)       :            6
Average AS-Path size (bytes)  :         6.00
Highest public ASN            :            0
```

## <font color="#1d50a2">BGP Config</font>

<font color="#1d05a2">Table 2 BGP Config</font>

| **Command**                                                                                                                             | **Purpose**                                                               |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **bgp as-path access-list** *list\_name* \{**permit**\|**deny**} *LINE*                                                                 | Add a BGP autonomous system path filter.                                  |
| **bgp community-list** *community\_list\_number* \[**standard**\|**expanded**] \[**seq** *seq-num*] \{**permit**\|**deny**} *AA\:NN*    | Add a community list entry.                                               |
| **bgp extcommunity-list** *excommunity\_list\_number* \[**standard**\|**expanded**] \[**seq** *seq-num*] \{**permit**\|**deny**} *LINE* | Add an extended community list entry.                                     |
| **router bgp** *AS-number* \[**vrf** *vrf\_name*]                                                                                       | Enter BGP Configuration View.                                             |
| **address-family&#x20;**\{**ipv4**\|**ipv6**\|**l2vpn**}**&#x20;unicast**                                                               | Enter Address Family command mode.                                        |
| **aggregate-address** \{*A.B.C.D* *A.B.C.D*\|*A.B.C.D/M*} \[**as-set**\|**summary-only**\|**route-map** *route-map*]                    | Configure BGP aggregate entries.                                          |
| **bgp always-compare-med**                                                                                                              | Allow comparing MED from different neighbors.                             |
| **bgp bestpath&#x20;**\[**as-path&#x20;**\{**confed**\|**ignore**\|**multipath-relax**}\|**compare-routerid**]                          | Change the default bestpath selection.                                    |
| **bgp ebgp-requires-policy**                                                                                                            | Require in and out policy for eBGP peers (RFC8212).                       |
| **bgp graceful-restart**                                                                                                                | Global Graceful Restart command.                                          |
| **bgp router-id** *A.B.C.D*                                                                                                             | Override configured router identifier.                                    |
| **bgp route-reflector allow-outbound-policy**                                                                                           | Allow modifications made by out route-map and enable RR(route-reflector). |
| **bgp network import-check**                                                                                                            | Check BGP network route exists in IGP.                                    |
| **bgp shutdown** \[**message** *string*]                                                                                                | Administrative shutdown of the BGP instance.                              |
| **distance** \{**bgp** *external-distance internal-distance local-distance*\|*administrative-distance A.B.C.D/M*}                       | Define an administrative distance.                                        |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **advertisement-interval** *internal*                                                | Set the minimum interval between sending BGP routing updates.             |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **bfd**                                                                              | Enable BFD support.                                                       |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **description** *description*                                                        | Allow EBGP neighbors not on directly connected networks.                  |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **ebgp-multihop** *count*                                                            | Allow EBGP neighbors not on directly connected networks.                  |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **password** *password*                                                              | Set a password for BGP neighbor.                                          |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **peer-group** *peer-group*                                                          | Set to be the member of a peer-group.                                     |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **remote-as** *AS-number*                                                            | Specify a BGP neighbor.                                                   |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **shutdown**                                                                         | Administratively shut down this neighbor.                                 |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X\:X*\|*String*} **update-source** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*}                               | Specify the source of routing updates.                                    |
| **neighbor** *peer-group* **peer-group**                                                                                                | Add a peer-group.                                                         |
| **update-delay** *max-delay*                                                                                                            | Force initial delay for best-path and updates.                            |
| **network** \{*A.B.C.D/M\|A.B.C.D* \[mask *A.B.C.D*]} \[**route-map** *route-map*]                                                      | Specify a network to announce via BGP.                                    |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*} **activate**                                                                          | Enable the address family for this neighbor.                              |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*} **allowas-in** \[*number*\|**origin**]                                                | Accept as-path with my AS present in it.                                  |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*} **as-override**                                                                       | Override ASNs in outbound updates if as-path equals remote-as.            |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*} **default-originate** \[**route-map** *route-map*]                                    | Originate default route to this neighbor.                                 |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*} **next-hop-self \[force]**                                                            | Disable the next hop calculation for this neighbor.                       |
| **neighbor** \{*A.B.C.D*\|*X\:X\::X*:X\|*String*} **prefix-list** *list\_name* **\{in\|out}**                                           | Filter updates to/from this neighbor.                                     |
| **neighbor** \{*peer-group*\|*A.B.C.D*\|*X\:X\::X*:X\|*String*} **route-map** *route-map* \{**in\|out**}                                | Apply route map to neighbor.                                              |
| **redistribute** *src\_protocol* \[**metric** *metric\_value*\|**route-map** *route-map*]                                               | Redistribute information from another routing protocol.                   |

### <font color="#1d50a2">bgp as-path access-list *list\_name* \{permit|deny\} *LINE*</font>

**\[Command]**
**bgp as-path access-list** *list\_name* \{**permit**|**deny**} *LINE*

**\[Purpose]**
Add a BGP autonomous system path filter.

**\[Parameters]**

| **Parameter** | **Description**                                                                       |
| ------------- | ------------------------------------------------------------------------------------- |
| *list\_name*  | Regular expression access list name.                                                  |
| *LINE*        | A regular-expression (1234567890\_^\|\[, \{}() ]$\*+.?-\\) to match the BGP AS paths. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no bgp as-path access-list** *list\_name* \{**permit**|**deny**} *LINE* to delete AS path filter.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# bgp as-path access-list test permit 66
```

### <font color="#1d50a2">bgp community-list *community\_list\_number* \[standard|expanded\] \[seq *seq-num*\] \{permit|deny\} *AA\:NN*</font>

**\[Command]**
**bgp community-list** *community\_list\_number* \[**standard**|**expanded**] \[**seq** *seq-num*] \{**permit**|**deny**} *AA\:NN*

**\[Purpose]**
Add a community list entry.

**\[Parameters]**

| **Parameter**             | **Description**                                                                                                                                                                                                                                                                                                    |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| *community\_list\_number* | Community-list number, range from 1 to 500. 1-99 as standard and 100-500 as expanded.                                                                                                                                                                                                                              |
| **standard**              | Add a standard community-list entry.                                                                                                                                                                                                                                                                               |
| **expanded**              | Add an expanded community-list entry.                                                                                                                                                                                                                                                                              |
| *seq-num*                 | Sequence number of an entry, range from 1 to 4294967295.                                                                                                                                                                                                                                                           |
| *AA\:NN*                  | Community number in AA\:NN format (where AA and NN are (0-65535)) or local-AS\|no-advertise\|no-export\|internet\|graceful-shutdown\|accept-own-nexthop\|accept-own\|route-filter-translated-v4\|route-filter-v4\|route-filter-translated-v6\|route-filter-v6\|llgr-stale\|no-llgr\|blackhole\|no-peer or additive |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no bgp community-list** *community\_list\_number* \[**standard**|**expanded**] \[**seq** *seq-num*] \{**permit**|**deny**} *AA\:NN&#x20;*&#x20;to delete BGP community-list.
When seq is not specified, it is started from 5, and the increment interval is 5.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# bgp community-list standard 10 permit 12:13
```

### <font color="#1d50a2">bgp extcommunity-list *excommunity\_list\_number* \[standard|expanded\] \[seq *seq-num*\] \{permit|deny\} *LINE*</font>

**\[Command]**
**bgp extcommunity-list** *excommunity\_list\_number* \[**standard**|**expanded**] \[**seq** *seq-num*] \{**permit**|**deny**} *LINE*

**\[Purpose]**
Add an extended community list entry.

**\[Parameters]**

| **Parameter**               | **Description**                                                                                     |
| --------------------------- | --------------------------------------------------------------------------------------------------- |
| *excommunity\_list\_number* | Excommunity-list number, range from 1 to 500. 1-99 as standard and 100-500 as expanded.             |
| **standard**                | Specify standard extcommunity-list.                                                                 |
| **expanded**                | Specify expanded extcommunity-list.                                                                 |
| *seq-num*                   | Sequence number of an entry, range from 1 to 4294967295.                                            |
| *LINE*                      | Extended community attribute in 'rt aa\:nn\_or\_IPaddr\:nn' OR 'soo aa\:nn\_or\_IPaddr\:nn' format. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no bgp extcommunity-list** *excommunity\_list\_number* \[**standard**|**expanded**] \[**seq** *seq-num*] \{**permit**|**deny**} *LINE* to delete extended community list.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# bgp extcommunity-list standard TEST permit aa
```

### <font color="#1d50a2">router bgp *AS-number* \[vrf *vrf\_name*\]</font>

**\[Command]**
**router bgp** *AS*-*number* \[**vrf** *vrf\_name*]

**\[Purpose]**
Global Configuration View

**\[Parameters]**

| **Parameter** | **Description**                                      |
| ------------- | ---------------------------------------------------- |
| *AS-number*   | Range from 1 to 4294967295, the default AS is 65100. |
| *vrf\_name*   | VRF name, default VRF if not specified.              |

**\[View]**
BGP Configuration View

**\[Notes]**
BGP views use the core instance (i.e., the default VRF) to communicate with peers.
Run command **no router bgp** *AS-number* to delete configured BGP local AS number.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)#
```

### <font color="#1d50a2">address-family \{ipv4|ipv6|l2vpn\} unicast</font>

**\[Command]**
**address-family** \{**ipv4**|**ipv6|l2vpn**} **unicast**

**\[Purpose]**
Enter Address Family command mode.

**\[View]**
BGP Configuration View

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)#
```

### <font color="#1d50a2">aggregate-address \{*A.B.C.D* *A.B.C.D*|*A.B.C.D/M*\} \[as-set|summary-only|route-map *route-map*\]</font>

**\[Command]**
**aggregate-address** \{*A.B.C.D A.B.C.D|A.B.C.D/M*} \[**as-set**|**summary-only**|**route-map** *route-map*]

**\[Purpose]**
Configure BGP aggregate entries.

**\[Parameters]**

| **Parameter**    | **Description**                           |
| ---------------- | ----------------------------------------- |
| *A.B.C.D*        | Aggregate address.                        |
| *A.B.C.D*        | Aggregate mask.                           |
| *A.B.C.D/M*      | Aggregate prefix.                         |
| **as-set**       | Generate AS set path information.         |
| **summary-only** | Filter more specific routes from updates. |
| *route-map*      | Apply route map to aggregate network.     |

**\[View]**
BGP Configuration View/BGP IPv4 Unicast Address-family View

**\[Notes]**
Run command **no aggregate-address** \{*A.B.C.D A.B.C.D|A.B.C.D/M*} \[**as-set**|**summary-only**|**route-map** *route-map*] to delete BGP aggregate configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65200
sonic(config-router)# aggregate-address 100.1.1.0/24 as-set
sonic(config-router)# aggregate-address 110.1.1.0/19 summary-only
```

### <font color="#1d50a2">bgp always-compare-med</font>

**\[Command]**
**bgp always-compare-med**

**\[Purpose]**
**Allow comparing MED from different neighbors.**

**\[View]**
BGP Configuration View

**\[Notes]**
This command is mainly applied to control the MED attribute to change the routing policy of BGP. It allows BGP to compare the MED attribute values of routes from different AS. If there are multiple valid routes to reach the same destination address, the route with smaller MED parameter can be selected as the final route actually in use.
Run command **no bgp always-compare-med** to disable BGP always-compare-med.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp always-compare-med
```

### <font color="#1d50a2">bgp bestpath \[as-path \{confed|ignore|multipath-relax\}|compare-routerid\]</font>

**\[Command]**
**bgp bestpath** \[**as-path** \{**confed**|**ignore**|**multipath-relax**}|**compare-routerid**]

**\[Purpose]**
Change the default bestpath selection.

**\[Parameters]**

| **Parameter**        | **Description**                                                                     |
| -------------------- | ----------------------------------------------------------------------------------- |
| **confed**           | Compare path lengths including confederation sets & sequences in selecting a route. |
| **ignore**           | Ignore as-path length in selecting a route.                                         |
| **multipath-relax**  | Allow load sharing across routes that have different AS paths (but same length)     |
| **compare-routerid** | Compare router-id for identical EBGP paths.                                         |

**\[View]**
BGP Configuration View

**\[Notes]**
AS-Path relax is a routing-level switch that determines how the same route from different AS domains is handled.

- When is enabled, the next hop of the same route from different AS domains will be an ECMP group.
- When this is disabled, only one of the routes will be selected for forwarding.
  Run command **no bgp bestpath** \[**as-path** \{**confed** | **ignore** | **multipath-relax**}|**compare-routerid**] to delete BGP bestpath selection.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp bestpath as-path ignore
```

### <font color="#1d50a2">bgp ebgp-requires-policy</font>

**\[Command]**
**bgp ebgp-requires-policy**

**\[Purpose]**
Require in and out policy for eBGP peers (RFC8212).

**\[View]**
BGP Configuration View

**\[Notes]**
This command requires that there must be a routing policy applied to the EBGP session, if there is not, no routes will be accepted or announced, and is on by default.
In practice, we usually use **no bgp ebgp-requires-policy** command to disable the feature above.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# no bgp ebgp-requires-policy
```

### <font color="#1d50a2">bgp graceful-restart</font>

**\[Command]**
**bgp graceful-restart** \[**preserve-fw-state**|**restart-time** *restart-time*|**rib-stale-time** *rib-stale-time*|**select-defer-time** *select-defer-time*|**stalepath-time** *stalepath-time*]

**\[Purpose]**
Global Graceful Restart command.

**\[Parameters]**

| **Parameter**         | **Description**                                                                                                     |
| --------------------- | ------------------------------------------------------------------------------------------------------------------- |
| **preserve-fw-state** | Sets F-bit indication that fib is preserved while doing Graceful Restart.                                           |
| *restart-time*        | Set the time to wait to delete stale routes before a BGP open message is received in seconds. Range from 1 to 4095. |
| *rib-stale-time*      | Specify the stale route removal timer in rib in seconds. Range from 1 to 3600.                                      |
| *select-defer-time*   | Set the time to defer the BGP route selection after restart in seconds. Range from 0 to 3600.                       |
| *statlepath-time*     | Set the max time to hold onto restarting peer's stale paths in seconds. Range from 1 to 4095.                       |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no bgp graceful-restart** \[**preserve-fw-state**|**restart-time** *delay* |**rib-stale-time** *delay* |**select-defer-time** *delay* |**stalepath-time** *delay* ] to disable Graceful Restart.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp graceful-restart restart-time 200
```

### <font color="#1d50a2">bgp router-id *A.B.C.D*</font>

**\[Command]**
**bgp router-id** *A.B.C.D*

**\[Purpose]**
Override configured router identifier.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | BGP Route ID    |

**\[View]**
BGP Configuration View

**\[Notes]**
This command is optional. Use Loopback0 IP as the router ID by default.
Run command **no bgp router-id** *A.B.C.D* to delete BGP Route ID.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp router-id 1.1.1.1
```

### <font color="#1d50a2">bgp route-reflector allow-outbound-policy</font>

**\[Command]**
**bgp route-reflector allow-outbound-policy**

**\[Purpose]**
Allow modifications made by out route-map and enable RR(route-reflector).

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no bgp route-reflector allow-outbound-policy** to disable RR.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp route-reflector allow-outbound-policy
```

### <font color="#1d50a2">bgp network import-check</font>

**\[Command]**
**bgp network import-check**

**\[Purpose]**
Check BGP network route exists in IGP.

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no bgp network import-check** to disable check.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp network import-check
```

### <font color="#1d50a2">bgp shutdown \[message *string*\]</font>

**\[Command]**
**bgp shutdown** \[**message** *string*]

**\[Purpose]**
Administrative shutdown of the BGP instance.

**\[Parameters]**

| **Parameter** | **Description**                   |
| ------------- | --------------------------------- |
| *string*      | Add a shutdown message (RFC 8203) |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no bgp shutdown** \[**message** *string*] Startup all BGP sessions.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# bgp shutdown
```

### <font color="#1d50a2">distance \{bgp *external-distance internal-distance local-distance*|*administrative-distance A.B.C.D/M*\}</font>

**\[Command]**
**distance** \{**bgp** *external-distance internal-distance local-distance*|*administrative-distance* *A.B.C.D/M*}

**\[Purpose]**
Define an administrative distance.

**\[Parameters]**

| **Parameter**                       | **Description**                                              |
| ----------------------------------- | ------------------------------------------------------------ |
| *external-distance*                 | Distance for routes external to the AS, range from 1 to 255. |
| *internal-distance*                 | Distance for routes internal to the AS, range from 1 to 255. |
| *local-distance*                    | Distance for local routes, range from 1 to 255.              |
| *administrative-distance A.B.C.D/M* | Administrative distance, range from 1 to 255.                |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no distance** to delete distance configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# distance 123 1.1.1.1/32
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} advertisement-interval *internal*</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **advertisement-interval** *internal*

**\[Purpose]**
Set the minimum interval between sending BGP routing updates.

**\[Parameters]**

| **Parameter** | **Description**                       |
| ------------- | ------------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.                |
| *X\:X\::X\:X* | IPv6 neighbor address.                |
| *String*      | Interface name or neighbor tag.       |
| *internal*    | Time in seconds, range from 0 to 600. |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X*:X|*String*} **advertisement-interval** *internal* to delete configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 advertisement-interval 2
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} bfd</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **bfd**

**\[Purpose]**
Enable BFD support.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **bfd** to disable BFD support.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 10.0.0.1 bfd
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} description *description*</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **description** *description*

**\[Purpose]**
Set neighbor specific description.

**\[Parameters]**

| **Parameter** | **Description**                                              |
| ------------- | ------------------------------------------------------------ |
| *A.B.C.D*     | IPv4 neighbor address.                                       |
| *X\:X\::X\:X* | IPv6 neighbor address.                                       |
| *String*      | Interface name or neighbor tag.                              |
| *description* | Specify the description for the BGP neighbor in string form. |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X*:X|*String*} **description** *description* to delete description.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 description test
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} ebgp-multihop *count*</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **ebgp-multihop** *count*

**\[Purpose]**
Allow EBGP neighbors not on directly connected networks.

**\[Parameters]**

| **Parameter** | **Description**                          |
| ------------- | ---------------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.                   |
| *X\:X\::X\:X* | IPv6 neighbor address.                   |
| *String*      | Interface name or neighbor tag.          |
| *count*       | Maximum hop count, the range is \[1,255] |

**\[View]**
BGP Configuration View

**\[Notes]**
This feature must be enabled when using a Loopback interface to configure BGP neighbors. The normal maximum hop count is configured as 255.
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **ebgp-multihop** *count* to disable this feature.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 ebgp-multihop 2
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} password *password*</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **password** *password*

**\[Purpose]**
Set a password for BGP neighbor.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |
| *password*    | The password.                   |

**\[View]**
BGP Configuration View

**\[Notes]**
This command sets an MD5 password for the BGP neighbor to connect to the remote peer's TCP socket.
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **password** *password* to delete the password.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 password test1234
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} peer-group *peer-group*</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **peer-group** *peer-group*

**\[Purpose]**
Set to be the member of a peer-group.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |
| *peer-group*  | Peer-group name.                |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **peer-group** *peer-group* to unbind.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 peer-group PEER_V4_EBGP
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} remote-as *AS-number*</font>

<font color="#1d50a2">**\[Command\]**</font>
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **remote-as** *AS-number*

**\[Purpose]**
Specify a BGP neighbor.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |
| *AS-number*   | Range from 1 to 4294967295.     |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **remote-as** *AS-number* to delete the neighbor.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 10.0.0.1 remote-as 65200
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} shutdown</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **shutdown**

**\[Purpose]**
Administratively shut down this neighbor.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **shutdown** to administratively startup this neighbor.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 shutdown
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} update-source \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\}</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **update-source** \{*A.B.C.D*|*X\:X\::X\:X*|*String*}

**\[Purpose]**
Specify the source of routing updates.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |

**\[View]**
BGP Configuration View

**\[Notes]**
When using a Loopback interface to configure a BGP neighbor you must set the source to the Loopback interface.
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **update-source** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} to delete the source of routing updates.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor 1.1.1.1 update-source Ethernet49
```

### <font color="#1d50a2">neighbor *peer-group* peer-group</font>

**\[Command]**
**neighbor** *peer-group* **peer-group**

**\[Purpose]**
Add a peer-group.

**\[Parameters]**

| **Parameter** | **Description**  |
| ------------- | ---------------- |
| *peer-group*  | Peer-group name. |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no neighbor** *peer-group* **peer-group**  to delete this peer-group.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
```

### <font color="#1d50a2">update-delay *max-delay*</font>

**\[Command]**
**update-delay** *max-delay*

**\[Purpose]**
Force initial delay for best-path and updates.

**\[Parameters]**

| **Parameter** | **Description**                             |
| ------------- | ------------------------------------------- |
| *max-delay*   | Max delay in seconds, range from 0 to 3600. |

**\[View]**
BGP Configuration View

**\[Notes]**
Run command **no bgp update-delay** *max-delay* to delete this configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# bgp update-delay 2
```

### <font color="#1d50a2">network \{*A.B.C.D/M|A.B.C.D* \[mask *A.B.C.D*\]\} \[route-map *route-map*\]</font>

**\[Command]**
**network** \{*A.B.C.D/M|A.B.C.D* \[**mask** *A.B.C.D*]} \[**route-map** *route-map*]

**\[Purpose]**
Specify a network to announce via BGP.

**\[Parameters]**

| **Parameter** | **Description**                     |
| ------------- | ----------------------------------- |
| *A.B.C.D/M*   | IPv4 prefix                         |
| *A.B.C.D*     | Network number.                     |
| *A.B.C.D*     | Network mask.                       |
| *route-map*   | Route-map to modify the attributes. |

**\[View]**
BGP Configuration View/BGP IPv4 Unicast Address-family View

**\[Notes]**
Run command **no network** \{*A.B.C.D/M|A.B.C.D* \[**mask** *A.B.C.D*]} \[**route-map** *route-map*] to delete the network.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 1.1.1.0/24
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} activate</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **activate**

**\[Purpose]**
Enable the address family for this neighbor.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |

**\[View]**
BGP Address-family View

**\[Notes]**
By default, the switch will advertise IPv4 unicast address family to all neighbors. Using "no bgp default ipv4-unicast" will override this default, so all address families need to be explicitly enabled.
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **activate** to disable the address family for this neighbor.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 1.1.1.1 activate
sonic(config-router-af)# exit
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# network 1.1.1.1 activate
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} allowas-in \[*number*|origin\]</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X*:X|*String*} **allowas-in** \[*number*|**origin**]

**\[Purpose]**
Accept as-path with my AS present in it.

**\[Parameters]**

| **Parameter** | **Description**                                                        |
| ------------- | ---------------------------------------------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.                                                 |
| *X\:X\::X\:X* | IPv6 neighbor address.                                                 |
| *String*      | Interface name or neighbor tag.                                        |
| *number*      | Number of occurrences of AS number, the range is \[1,10].              |
| **origin**    | Only accept my AS in the as-path if the route was originated in my AS. |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **allowas-in** \[*number*|**origin**] to disable this feature.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 1.1.1.1 allowas-in 2
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} as-override</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **as-override**

**\[Purpose]**
Override ASNs in outbound updates if as-path equals remote-as.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X\:X* | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **as-override** to delete this configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 1.0.0.1 as-override
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} default-originate \[route-map *route-map*\]</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **default-originate** \[**route-map** *route-map*]

**\[Purpose]**
Originate default route to this neighbor.

**\[Parameters]**

| **Parameter** | **Description**                     |
| ------------- | ----------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.              |
| *X\:X\::X\:X* | IPv6 neighbor address.              |
| *String*      | Interface name or neighbor tag.     |
| *route-map*   | Route-map to modify the attributes. |

**\[View]**
BGP Address-family View

**\[Notes]**
BGP does not advertise the default route (0.0.0.0/0) by default, even if it is in the routing table. Use this command when you want to advertise the default route to the peer.
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **default-originate** \[**route-map** *route-map*] to disable this feature.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 1.1.1.1 default-originate route-map test
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} next-hop-self \[force\]</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **next-hop-self** \[**force**]

**\[Purpose]**
Disable the next hop calculation for this neighbor.

**\[Parameters]**

| **Parameter** | **Description**                                |
| ------------- | ---------------------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.                         |
| *X\:X\::X\:X* | IPv6 neighbor address.                         |
| *String*      | Interface name or neighbor tag.                |
| **force**     | Set the next hop to self for reflected routes. |

**\[View]**
BGP Address-family View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **next-hop-self** \[**force**] to disable this feature.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 1.1.1.1 next-hop-self
```

### <font color="#1d50a2">neighbor \{*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} prefix-list *list\_name* \{in|out\}</font>

**\[Command]**
**neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **prefix-list** *list\_name* \{**in**|**out**}

**\[Purpose]**
Filter updates to/from this neighbor.

**\[Parameters]**

| **Parameter** | **Description**                     |
| ------------- | ----------------------------------- |
| *A.B.C.D*     | IPv4 neighbor address.              |
| *X\:X\::X\:X* | IPv6 neighbor address.              |
| *String*      | Interface name or neighbor tag.     |
| *list\_name*  | Specify the name of IP prefix list. |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
Run command **no neighbor** \{*A.B.C.D*|*X\:X\::X\:X*|*String*} **prefix-list** name \[**in**|**out**] to disable this configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 1.1.1.1 prefix-list test in
```

### <font color="#1d50a2">neighbor \{*peer-group*|*A.B.C.D*|*X\:X\:\:X\:X*|*String*\} route-map *route-map* \{in|out\}</font>

**\[Command]**
**neighbor** \{*peer-group*|*A.B.C.D*|*X\:X\::X*:X|*String*} **route-map** *route-map* \{**in**|**out**}

**\[Purpose]**
Apply route map to neighbor.

**\[Parameters]**

| **Parameter** | **Description**                 |
| ------------- | ------------------------------- |
| *peer-group*  | Peer group name.                |
| *A.B.C.D*     | IPv4 neighbor address.          |
| *X\:X\::X*:X  | IPv6 neighbor address.          |
| *String*      | Interface name or neighbor tag. |
| *route-map*   | Route map name.                 |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
The route map needs to be pre-created before it can be bound to a neighbor. A neighbor can only bind to one route-map in in/out directions. Multiple configurations will override.
Run command **no neighbor** \{*PEER-GROUP*|*A.B.C.D*|*X\:X\::X*:X|*String*} **route-map** *route-map* **in**|**out** to delete this configuration.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 1.1.1.1 route-map test in
```

### <font color="#1d50a2">redistribute *src\_protocol* \[metric *metric\_value*|route-map *route-map*\]</font>

**\[Command]**
**redistribute** *src\_protocol* \[**metric** *metric\_value*|**route-map** *route-map*]

**\[Purpose]**
Redistribute information from another routing protocol.

**\[Parameters]**

| **Parameter**   | **Description**                                                                                                    |
| --------------- | ------------------------------------------------------------------------------------------------------------------ |
| *src\_protocol* | Set source protocol (babel\|connected\|eigrp\|isis\|kernel\|openfabric\|ospf\|rip\|static\|table\|vnc\|vnc-direct) |
| *metric\_value* | Metric for redistributed routes, range from 0 to 4294967295.                                                       |
| *route-map*     | Route map reference.                                                                                               |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
The redistribution for the same protocol is an overriding configuration.
Run command **no redistribute** *src\_protocol* \[**metric** *metric\_value*|**route-map** *route-map*] to cancel route redistribution.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# router bgp 65100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute ospf metric 200
```

