# BGP

## 1. Protocol Overview

Various routing control protocols are currently used on the Internet. Each routing protocol has its own unique characteristics, but when we look at the scale of the network they handle, they can be categorized into two groups: IGP and EGP.

- IGP (Interior Gateway Protocol)
  Primarily used to control networks within an organization. Typical IGPs include RIP and OSPF.

- EGP (Exterior Gateway Protocol)
  Used to control networks between organizations that operate using IGP. A typical example of EGP is BGP (Boarder Gateway Protocol).

This product supports BGP-4+ (BGP version 4+) defined in RFC4271 and RFC4760.
BGP-4+ can handle both IPv4 and IPv6 routes.
Both IPv4 and IPv6 routes can only handle unicast routes, and cannot handle multicast routes.

## 2. Definition of Terms Used

- AS (Autonomous System) Number
  A number uniquely assigned on the Internet to each organization that controls routing, and is used to identify routes for each organization.
  AS numbers are assigned within the range from 1 to 4294967295, but numbers within the range from 64512 to 65535 are intended for use in private spaces and may be assigned in duplicate.

- BGP Peer
  Peer devices connected via BGP. Devices connected with the same AS number are called iBGP peers, while devices connected with a different AS number are called eBGP peers.

## 3. Applicable Models and Maximum Number of Routes

Models | IPv4 Routes | IPv6 Routes
SWX3200-28GT SWX3200-52GT | 4096 | 2048
SWX3220-16MT SWX3220-16TMs | 8192 | 8192
SWX3220-30MC SWX3220-30TCs | 16384 | 16384

## 4. Function Overview

### 4.1. AS (Autonomous System)

In BGP, each organization that controls routes is assigned a unique number on the Internet called an AS (Autonomous System) number, which identifies the routes of each individual organization.
AS numbers are assigned within the range from 1 to 4294967295, but numbers within the range from 64512 to 65535 are intended for use in private spaces and may be assigned in duplicate.
ASes can be classified into the following three types based on their connection status with other ASes and whether they relay communications between other ASes.

- Stub AS
  An AS that is connected to only one external AS.

- Multihomed AS
  An AS that is connected to multiple external ASes, with communication between external ASes discarded, allowing only communication to its own AS.

- Transit AS
  An AS that is connected to multiple external ASs and allows communication between external ASes.

### 4.2. iBGP and eBGP

In connections between devices where BGP operates, connections between devices belonging to the same AS are called iBGP, while connections between devices belonging to different ASes are called eBGP.

### 4.3. Router ID

BGP requires an identifier, called a router ID, that uniquely identifies each BGP-compatible device. The router ID is in IPv4 address format, and even if the device is operated solely with IPv6 addresses and does not have an IPv4 address, an IPv4-formatted router ID must be set when using BGP.

### 4.4. BGP Messages

In BGP, devices exchanging routes communicate using TCP port 179 and use the following five messages to establish peers, exchange routes, check connectivity, and report errors.

Message | Content
OPEN | At the initial stage of the connection, peers are established by exchanging information such as AS numbers and peer authentication. Once the peers are successfully established, an exchange of UPDATE and KEEPALIVE messages begins.
UPDATE | Exchange actual route information. A list of new routes and a list of deleted routes are stored, and path attributes are added to each piece of route information and are used for route control.
NOTIFICATION | When an error occurs, the peer is notified of the error.
KEEPALIVE | Verify connectivity between BGP peers. This message is exchanged periodically at intervals determined by the HoldTime parameter included in the OPEN message to detect peer downtime.
ROUTE-REFRESH | This message is used to request a BGP peer to resend all routes.

The flow from establishing a BGP session to exchanging routes is as follows:

### 4.5. Path Attributes

BGP route information includes information about the ASes that are passed through on the way to the destination, and is used as an element of information to represent the route.
The key path attributes are as follows:

No. | Attribute | Content
1 | ORIGIN | This indicates who created this route. When advertising route information to other devices, the ORIGIN attribute is generally not changed. There are three types of ORIGIN attributes: - IGP: Routes generated within the AS - EGP: Route originating outside the AS - INCOMPLETE: Routes obtained by methods other than IGP/EGP
2 | AS_PATH | A list of AS numbers passed through on the way to the destination
3 | NEXT_HOP | In eBGP, this is often the IP address of the advertising device. When a route received from eBGP is advertised via iBGP, the original NEXT_HOP of the route is used as is.
4 | MED (MULTI_EXIT_DISC) | When multiple eBGPs exist, this is used to determine the priority for the same route advertised by each eBGP. The route with the smaller MED is prioritized.
5 | LOCAL_PREF | This is added when advertising route information to iBGP. This is used to determine the priority of routes in the same way as MED, but routes with a higher LOCAL_PREF are given greater priority.
6 | ATOMIC_AGGREGATE | Indicates that this is an aggregated route.
7 | AGGREGATE | The identifier of the BGP speaker that aggregates the routes.
8 | COMMUNITIES | Indicates the community.
9 | ORIGINATOR_ID | The router ID of the received route.
10 | CLUSTER_LIST | This is used when route reflection is used, and route information is advertised to the appropriate range by notifying of the cluster ID.
14 | MP_REACH_NLRI | This is used to advertise IPv6 routes.
15 | MP_UNREACH_NLRI | This is used to advertise IPv6 routes.

### 4.6. Route Priority

In BGP, when there are multiple routes to a given destination, the route is selected according to the following rules:

Priority | Description
1 (High) | Prioritize the route with the highest LOCAL_PREF attribute
2 | Prioritize routes registered locally using the network command
3 | Prioritize the route with the smallest AS_PATH attribute This can be disabled by setting bgp bestpath as-path ignore
4 | Prioritize the route with the smallest ORIGIN attribute
5 | Prioritize the route with the smallest MED attribute This is enabled only when bgp always-compare-med is enabled
6 | Prioritize the route obtained via eBGP over those obtained via iBGP.
7 | Prioritize the route with the smallest IGP metric among those to the NEXT_HOP
8 | If only routes obtained via eBGP are available, the oldest one is given priority.
9 (Low) | Prioritize the route obtained from the BGP peer with the smallest router ID. This is enabled only when bgp bestpath compare-routerid is enabled.

### 4.7. Capabilities

In BGP, when starting a session with a BGP peer, capabilities are notified to each other via an OPEN message, allowing each peer to confirm what optional functions are supported.
This product supports the following capabilities:

Capabilities | Code | Description
Multi protocol Capability | 1 | Capability to advertise IPv6 routes over BGP sessions on IPv4 networks and vice versa
Route Refresh Capability | 2 | A capability indicating that route information can be resent to a BGP peer upon receiving a Route-Refresh message Notification can be enabled/disabled using the neighbor capability route-refresh command.
Outbound Route Filtering Capability | 3 | A capability that suppresses the notification of unnecessary route information by the BGP peer by notifying the BGP peer of conditions for unnecessary routes in advance Notification can be enabled/disabled using the neighbor capability route-refresh command.
Support for 4-octet AS number Capability | 65 | A capability added when AS numbers were expanded from 0-65535 to 0-4294967295

### 4.8. Management Distance

Route information has a priority commonly called Administrative Distance.
This is used to determine which is prioritized when route information to the same destination is registered with VLAN interface route information and static route information.
The priority of route information can be applied not only to static routing but also to dynamic routing.
The priority of static routing route information can be specified within the range of 1 to 255 using the ip route command.
The smaller the value, the higher the priority. In the initial state, the priority is as follows.

Type | Initial priority | How to change priority
VLAN interface route information | None (overrides any other route information) | Settings cannot be changed.
Static route information | 1 | This can be specified within the range of 1 to 255 by the option at the end of the p/ipv6 route command.
OSPF route information | 110 | This can be specified within the range of 1 to 255 using the distance command in OSPFv2/OSPFv3 mode.
RIP route information | 120 | This can be specified within the range of 1 to 255 using the distance command in RIP/RIPng mode.
BGP route information (obtained from eBGP peers) | 20 | This can be specified within the range of 1 to 255 using the distance command in BGP mode or BGP IPv6 address family mode.
BGP route information (obtained from iBGP peers) | 200 | This can be specified within the range of 1 to 255 using the distance command in BGP mode or BGP IPv6 address family mode.

## 5. Handling BGP Peers in IPv4/IPv6 and IPv4/IPv6 Routes

This product can exchange IPv4 and IPv6 route information with BGP peers established on either IPv4 or IPv6 networks.

| BGP peers established on an IPv4 network | BGP peers established on an IPv6 network
IPv4 route exchange | Yes | Yes
IPv6 route exchange | Yes | Yes

This product uses the following modes to clearly distinguish between IPv4 and IPv6 route settings.

- IPv4 Route Settings
  Configure settings in BGP mode, which is switched to using the router bgp command.

- IPv6 Route Settings
  Configure settings in BGP IPv6 address family mode, which is switched to using the address-family ipv6 command in BGP mode.

This product begins exchanging IPv4 routes immediately upon establishing a session with a BGP peer. To disable automatic initiation of IPv4 route exchange, enable bgp default ipv4-unicast disable.
Even if bgp default ipv4-unicast disable is enabled, you can start exchanging IPv4 routes using the neighbor activate command in BGP mode.
IPv6 routes will not be exchanged unless the neighbor activate command is explicitly used in BGP IPv6 address family mode.

## 6. Setup Guide

This section explains the procedure for setting up BGP.

### 6.1. Basic settings

The basic settings from establishing a session with a BGP peer to exchanging routes are as follows:

6-1-1. Common Settings

1. Use the router bgp command to switch to BGP mode and enable the BGP process.
   The router bgp command specifies the AS number to which your device belongs. Here, AS number 65000 is used as an example.

       Yamaha> enable
       Yamaha# configure terminal
       Yamaha(config)#
       Yamaha(config)# router bgp 65000
       Yamaha(config-router)#

2. Specify the router ID with the bgp router-id command.
   If you do not specify a router ID, the IPv4 address assigned to the VLAN interface will automatically be used as the router ID, but explicitly configure the router ID.
   If only an IPv6 address is specified on a VLAN interface and no IPv4 address is specified, the router ID must be specified explicitly.

       Yamaha(config-router)# bgp router-id 192.168.100.240

6-1-2. Establish a BGP peer on an IPv4 network and exchange IPv4 routes.

1. To explicitly specify the routes to be advertised by BGP, use the network command in BGP mode.

       Yamaha(config-router)# network 172.16.0.0/24

2. When notifying Connected routes using BGP, or when notifying routes obtained via RIP or OSPF, use the redistribute command to specify the type of route to be notified.

       Yamaha(config-router)# redistribute connected
       Yamaha(config-router)# redistribute rip
       Yamaha(config-router)# redistribute ospf 1

3. Once you have completed configuring the routes to be notified, specify the BGP peer using the neighbor remote-as command.
   The neighbor remote-as command specifies the IP address of the BGP peer and the AS number to which the BGP peer belongs.

       Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65000

   When the neighbor remote-as command is configured and a session with a BGP peer is established, IPv4 routes are immediately exchanged.
   To prevent IPv4 route exchange immediately after a session is established, use the bgp default ipv4-unicast command.
   If bgp default ipv4-unicast disable is enabled, setting the neighbor activate command in BGP mode activates IPv4 route exchange.

       Yamaha(config-router)# bgp default ipv4-unicast disable
       Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65000
       Yamaha(config-router)# neighbor 192.168.100.250 activate

6-1-3. Establish a BGP peer on an IPv6 network and exchange IPv6 routes.

1. To explicitly specify the routes to be advertised by BGP, use the network command in BGP IPv6 address family mode.

       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# network 1001::/64
       Yamaha(config-router-af)# exit-address-family

2. When notifying Connected routes or static routes using BGP, or when notifying routes obtained via RIP or OSPF, use the redistribute command in BGP IPv6 address family mode to specify the type of route to be notified.

       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# redistribute connected
       Yamaha(config-router-af)# redistribute static
       Yamaha(config-router-af)# redistribute rip
       Yamaha(config-router-af)# redistribute ospf 1
       Yamaha(config-router-af)# exit-address-family

3. Once you have completed configuring the routes to be advertised, use the neighbor remote-as command in BGP mode to specify the BGP peer.
   The neighbor remote-as command specifies the IPv6 address of the BGP peer and the AS number to which the BGP peer belongs.

       Yamaha(config-router)# neighbor 1000::100 remote-as 65000

   Even if you configure the neighbor remote-as command and establish a session with a BGP peer, IPv6 routes will not be exchanged immediately.
   To start exchanging IPv6 routes, configure the neighbor activate command in BGP IPv6 address family mode.
   To prevent unintended IPv4 route exchange from starting, it is advisable to configure bgp default ipv4-unicast disable in advance.

       Yamaha(config-router)# bgp default ipv4-unicast disable
       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# neighbor 1000::250 activate
       Yamaha(config-router-af)# exit-address-family

6-1-4. Exchange Both IPv4 and IPv6 Routes.

1. To explicitly specify the IPv4 route to be advertised by BGP, use the network command in BGP mode.

       Yamaha(config-router)# network 172.16.0.0/24

2. To explicitly specify the IPv6 routes to be advertised by BGP, use the network command in BGP IPv6 address family mode.

       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# network 1001::/64
       Yamaha(config-router)# exit-address-family

3. When notifying IPv4 Connected routes or IPv4 static routes using BGP, or when notifying IPv4 routes obtained using RIPv2 or OSPFv2, use the redistribute command in BGP mode to specify the type of route to be notified.

       Yamaha(config-router)# redistribute connected
       Yamaha(config-router)# redistribute static
       Yamaha(config-router)# redistribute rip
       Yamaha(config-router)# redistribute ospf 1

4. When notifying IPv6 Connected routes or IPv6 static routes using BGP, or when notifying IPv6 routes obtained via RIPng or OSPFv3, use the redistribute command in BGP IPv6 address family mode to specify the type of route to be notified.

       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# redistribute connected
       Yamaha(config-router-af)# redistribute static
       Yamaha(config-router-af)# redistribute rip
       Yamaha(config-router-af)# redistribute ospf 1
       Yamaha(config-router)# exit-address-family

5. Once you have completed configuring the routes to be notified, specify the BGP peer using the neighbor remote-as command.
   The neighbor remote-as command specifies the IP address of the BGP peer and the AS number to which the BGP peer belongs.

       Yamaha(config-router)# neighbor [BGPピアのIPアドレス(IPv4 or IPv6)] remote-as 65000

   When the neighbor remote-as command is configured and a session with a BGP peer is established, IPv4 routes are immediately exchanged.
   To prevent IPv4 route exchange immediately after a session is established, use the bgp default ipv4-unicast command.
   If bgp default ipv4-unicast disable is enabled, setting the neighbor activate command in BGP mode activates IPv4 route exchange.

       Yamaha(config-router)# bgp default ipv4-unicast disable
       Yamaha(config-router)# neighbor [BGPピアのIPアドレス] remote-as 65000
       Yamaha(config-router)# neighbor [BGPピアのIPアドレス] activate

   Even if you configure the neighbor remote-as command and establish a session with a BGP peer, IPv6 routes will not be exchanged immediately.
   To start exchanging IPv6 routes, configure the neighbor activate command in BGP IPv6 address family mode.

       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# neighbor neighbor [BGPピアのIPアドレス] activate
       Yamaha(config-router-af)# exit-address-family

### 6.2. Aggregation of Route Information

In BGP, multiple pieces of route information contained in the prefix specified by the aggregate-address command can be aggregated and advertised to BGP peers.
For example, by specifying 172.16.0.0/16 with the aggregate-address command, when there is route information for 172.16.1.0/24 and 172.16.2.0/24, they will be aggregated into a single route for 172.16.0.0/16 and advertised to BGP peers.

    Yamaha(config-router)# aggregate-address 172.16.0.0/16

If you do not specify the summary-only keyword with the aggregate-address command, both the individual routes before aggregation and the aggregated routes are advertised to BGP peers.
To advertise only summarized routes to BGP peers, specify the summary-only keyword.

    Yamaha(config-router)# aggregate-address 172.16.0.0/16 summary-only

To aggregate IPv6 routes, specify aggregate-address in BGP IPv6 address family mode.

    Yamaha(config-router)# address-family ipv6
    Yamaha(config-router-af)# aggregate-address 1000::/64 summary-only
    Yamaha(config-router-af)# exit-address-family

### 6.3. Route Information Filtering

There are the following methods for filtering route information advertised to BGP peers and route information received from BGP peers.

- Filtering of Route Information to be Advertised to BGP Peers
  Filtering operates in the following order:

  1. Outbound Filtering Using AS Path Access Lists
     By using an AS path access list, you can filter the AS_PATH attribute of route information when sending an UPDATE message.
     AS path access lists are defined using the ip as-path access-list command and applied to BGP peers using the neighbor filter-list command.
     In the following example, only route information generated by the AS to which the device belongs is advertised to the BGP peers 192.168.100.250 and 1000::250.

         Yamaha# configure terminal
         Yamaha(config)# ip as-path access-list 1 permit ^$
         Yamaha(config)# router bgp 65000
         Yamaha(config-router)# neighbor 192.168.100.250 filter-list 1 out
         Yamaha(config-router)# address-family ipv6
         Yamaha(config-router-af)# neighbor 1000::250 filter-list 1 out

  2. Outbound Filtering Using Distribution Lists
     By using a distribution list, you can filter route information for specific destinations when sending UPDATE messages.
     A distribution list defines a filter with the access-list command and applies it to a BGP peer using the neighbor distribute-list command.
     To filter IPv6 route information, use the neighbor distribute-list command in BGP IPv6 address family mode.
     In the following example, all IPv4 route information except for routes to 172.16.10.0/24 and 172.16.20.0/24 is advertised to the BGP peer 192.168.100.250.

         Yamaha# configure terminal
         Yamaha(config)# access-list 1 deny 172.16.10.0 0.0.0.255
         Yamaha(config)# access-list 1 deny 172.16.20.0 0.0.0.255
         Yamaha(config)# access-list 1 permit any
         Yamaha(config)# router bgp 65000
         Yamaha(config-router)# neighbor 192.168.100.250 distribute-list 1 out

- Filtering Route Information Received from BGP Peers
  Filtering operates in the following order:

  1. Inbound Filtering Using AS Path Access Lists
     By using an AS path access list, you can filter the AS_PATH attribute of route information when sending an UPDATE message.
     AS path access lists are defined using the ip as-path access-list command and applied to BGP peers using the neighbor filter-list command.
     In the following example, routes generated with AS number 65100 are discarded, while other route information is accepted from BGP peers 192.168.100.250 and 1000::250.

         Yamaha# configure terminal
         Yamaha(config)# ip as-path access-list 1 deny _65100$
         Yamaha(config)# ip as-path access-list 1 permit .*
         Yamaha(config)# router bgp 65000
         Yamaha(config-router)# neighbor 192.168.100.250 filter-list 1 in
         Yamaha(config-router)# address-family ipv6
         Yamaha(config-router-af)# neighbor 1000::250 filter-list 1 in

  2. Inbound Filtering Using Distribution Lists
     By using a distribution list, you can filter route information for specific destinations when receiving UPDATE messages.
     A distribution list defines a filter with the access-list command and applies it to a BGP peer using the neighbor distribute-list command.
     To filter IPv6 route information, use the neighbor distribute-list command in BGP IPv6 address family mode.
     In the following example, all IPv4 route information except for routes to 172.16.10.0/24 and 172.16.20.0/24 is accepted from the BGP peer 192.168.100.250.

         Yamaha# configure terminal
         Yamaha(config)# access-list 1 deny 172.16.10.0 0.0.0.255
         Yamaha(config)# access-list 1 deny 172.16.20.0 0.0.0.255
         Yamaha(config)# access-list 1 permit any
         Yamaha(config)# router bgp 65000
         Yamaha(config-router)# neighbor 192.168.100.250 distribute-list 1 in

### 6.4. TCP MD5 Authentication

This device can protect BGP sessions using TCP MD5 authentication.
Use the neighbor password command to configure TCP MD5 authentication.
The same password must be set on the peer device that will become a BGP peer. If the passwords are different, the BGP session will not be established.

    Yamaha(config)# router bgp 65000
    Yamaha(config-router)# neighbor 192.168.100.250 password PASSWORD4
    Yamaha(config-router)# neighbor 1000::250 password PASSWORD6

### 6.5. Route Reflection

Within an AS, it is necessary to establish iBGP peer sessions with all devices that use BGP, but the greater the number of iBGP peers, the greater the impact on internal resources and maintenance work.
In such cases, route reflection allows you to use BGP efficiently with fewer sessions.

- If there are five devices using BGP within an AS, a total of 10 iBGP sessions are required.

- By using route reflection, the total number of iBGP sessions will be four.

In route reflection, when a client advertises a route to a route reflector, the route reflector re-advertises the route to other clients.
This allows you to share route information with all iBGP peers without establishing a full mesh session.
The route reflector and its clients are collectively called a cluster, and one cluster appears as one iBGP peer when viewed from an iBGP peer that is not part of the cluster.

To configure route reflection, use the neighbor route-reflector-client command on the device that will become the route reflector, for the IP address of the device that will become the client. No special configuration is required on the device that will become the client.
The root reflector’s router ID is used for the cluster ID, but if you want to specify it explicitly, use the bgp cluster-id command.
In the example below, 192.168.100.240, belonging to AS number 65000, becomes the root reflector, and the four devices 192.168.100.250 to 253 become clients.

- Route Reflector Configuration

      Yamaha(config)# router bgp 65000
      Yamaha(config-router)# bgp cluster-id 192.168.100.240
      Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.250 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.251 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.251 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.252 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.252 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.253 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.253 route-reflector-client

- Client Configuration

      Yamaha(config)# router bgp 65000
      Yamaha(config-router)# neighbor 192.168.100.240 remote-as 65000

Route reflection allows you to configure redundancy for route reflectors by placing multiple route reflectors within a single cluster.
Implementing redundancy allows the cluster to remain operational even if a single root reflector fails due to malfunction or other reason, but the number of sessions will increase accordingly.

When deploying multiple route reflectors within a single cluster, you must specify a common cluster ID for all route reflectors.
Configure a common cluster ID using the bgp cluster-id command on all route reflectors.
In the example below, 192.168.100.240 and 192.168.100.241, belonging to AS number 65000, become the root reflectors, and the four devices 192.168.100.250 to 253 become clients.

- Configuration on Route Reflector A

      Yamaha(config)# router bgp 65000
      Yamaha(config-router)# bgp cluster-id 192.168.100.240
      Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.250 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.251 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.251 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.252 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.252 route-reflector-client

- Configuration on Route Reflector B

      Yamaha(config)# router bgp 65000
      Yamaha(config-router)# bgp cluster-id 192.168.100.240
      Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.250 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.251 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.251 route-reflector-client
      Yamaha(config-router)# neighbor 192.168.100.252 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.252 route-reflector-client

- Client Configuration

      Yamaha(config)# router bgp 65000
      Yamaha(config-router)# neighbor 192.168.100.240 remote-as 65000
      Yamaha(config-router)# neighbor 192.168.100.241 remote-as 65000

### 6.6. AS Confederation

Like route reflection, AS confederation is a mechanism for reducing the number of iBGP sessions.
You can reduce the number of sessions by defining sub-AS within a single AS and grouping iBGP peers.
However, it is necessary to establish a full mesh of BGP sessions within the sub-AS, and private AS numbers (64512 to 65535) are used as the sub-AS numbers.

To build the above configuration, apply the following settings:

- Conditions:

  - SW1 : 192.168.100.240/24

  - SW2 : 192.168.100.241/24

  - SW3 : 192.168.100.242/24

  - SW4 : 192.168.100.243/24

  - SW5 : 192.168.100.244/24

  - SW6 : 192.168.100.250/24

- SW1 (192.168.100.240/24) Configuration

      Yamaha(config)# router bgp 65001
      Yamaha(config-router)# bgp confederation identifier 65000
      Yamaha(config-router)# neighbor 192.168.100.241 remote-as 65001      ## SW2とiBGPを確立
      Yamaha(config-router)# neighbor 192.168.100.242 remote-as 65001      ## SW3とiBGPを確立

- SW2 (192.168.100.241/24) Configuration

      Yamaha(config)# router bgp 65001
      Yamaha(config-router)# bgp confederation identifier 65000
      Yamaha(config-router)# bgp confederation peers 65002
      Yamaha(config-router)# neighbor 192.168.100.240 remote-as 65001      ## SW1とiBGPを確立
      Yamaha(config-router)# neighbor 192.168.100.242 remote-as 65001      ## SW3とiBGPを確立
      Yamaha(config-router)# neighbor 192.168.100.243 remote-as 65002      ## SW4とeBGPを確立
      Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65010      ## SW6とeBGPを確立

- SW3 (192.168.100.242/24) Configuration

      Yamaha(config)# router bgp 65001
      Yamaha(config-router)# bgp confederation identifier 65000
      Yamaha(config-router)# neighbor 192.168.100.240 remote-as 65001      ## SW1とiBGPを確立
      Yamaha(config-router)# neighbor 192.168.100.241 remote-as 65001      ## SW2とiBGPを確立

- SW4 (192.168.100.243/24) Configuration

      Yamaha(config)# router bgp 65002
      Yamaha(config-router)# bgp confederation identifier 65000
      Yamaha(config-router)# bgp confederation peers 65001
      Yamaha(config-router)# neighbor 192.168.100.241 remote-as 65001      ## SW2とeBGPを確立
      Yamaha(config-router)# neighbor 192.168.100.244 remote-as 65002      ## SW5とiBGPを確立

- SW5 (192.168.100.244/24) Configuration

      Yamaha(config)# router bgp 65002
      Yamaha(config-router)# bgp confederation identifier 65000
      Yamaha(config-router)# neighbor 192.168.100.243 remote-as 65002      ## SW4とiBGPを確立

- SW6 (192.168.100.250/24) Configuration

      Yamaha(config)# router bgp 65010
      Yamaha(config-router)# neighbor 192.168.100.241 remote-as 65000      ## SW2とeBGPを確立

### 6.7. BGP Peer Groups

When applying common settings such as route information filtering to multiple BGP peers, you can apply the settings to multiple BGP peers at once by grouping the BGP peers and configuring the settings for that group.
The setting procedure for BGP peer groups is as follows:

1. Creating a BGP Peer Group
   Use the neighbor peer-group command to create a BGP peer group with any name.

       Yamaha(config)# router bgp 65000
       Yamaha(config-router)# neighbor SAMPLE_GROUP peer-group

2. Specifying the AS number to which the BGP peer group belongs Use the neighbor remote-as command to specify the AS number to which the BGP peer group belongs.

       Yamaha(config-router)# neighbor SAMPLE_GROUP remote-as 65010

3. Enabling Route Exchange for a BGP Peer Group
   Use the neighbor activate command to enable route exchange for a BGP peer group.
   To exchange IPv6 routes, you must enable route exchange in BGP IPv6 address family mode.

       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# neighbor SAMPLE_GROUP activate
       Yamaha(config-router-af)# exit-address-family

4. Adding Settings to Apply to the BGP Peer Group
   Configure the settings you want to apply to the BGP peer group, such as route information filtering.
   As an example, discard routes to 172.16.10.0/24 and 172.16.20.0/24 from the routes received from BGP peers, and accept all other routes.

       Yamaha(config-router)# exit
       Yamaha(config)# access-list 1 deny 172.16.10.0 0.0.0.255
       Yamaha(config)# access-list 1 deny 172.16.20.0 0.0.0.255
       Yamaha(config)# access-list 1 permit any
       Yamaha(config)# router bgp 65000
       Yamaha(config-router)# neighbor SAMPLE_GROUP distribute-list 1 in

5. Registering a BGP Peer to a BGP Peer Group
   Use the neighbor peer-group command to register a BGP peer to a BGP peer group.
   To register an IPv4 BGP peer, use the neighbor peer-group command in BGP mode.
   To register an IPv6 BGP peer, use the neighbor peer-group command in BGP IPv6 address family mode.

       Yamaha(config-router)# neighbor 192.168.100.241 peer-group SAMPLE_GROUP
       Yamaha(config-router)# neighbor 192.168.100.242 peer-group SAMPLE_GROUP
       Yamaha(config-router)# address-family ipv6
       Yamaha(config-router-af)# neighbor 1000::241 peer-group SAMPLE_GROUP
       Yamaha(config-router-af)# neighbor 1000::242 peer-group SAMPLE_GROUP

### 6.8. Next-Hop Trigger

BGP periodically checks the routing table at the interval specified by the bgp scan-time command, and if there are any changes in the route information, the changes are reflected in the BGP route table. Therefore, there is a certain delay between when a change is made to the routing table and when the changed route is advertised via BGP. While it is possible to shorten the interval between periodic checks, using next-hop triggers allows for immediate updates to the BGP routing table upon changes in the routing table.
However, caution is required when the routing table is unstable and routes are frequently updated within a short period, as all such route updates will be reflected in the BGP routing table and notified to BGP peers. When the next-hop trigger is enabled on this device, it suppresses frequent route change notifications by reflecting changes in the BGP routing table only after the time specified by the `bgp nexthop-trigger delay` command has elapsed following a routing table update. Additionally, if frequent route updates occur in a short period of time, the next hop trigger will be temporarily disabled.
The next-hop trigger is disabled by default and can be enabled using the bgp nexthop-trigger command.

    Yamaha(config)# bgp nexthop-trigger enable

### 6.9. Manipulating Route Attribute Values Using Route Maps

In BGP, various attribute values can be added to the route information exchanged with BGP peers. Use the route map to manipulate this attribute value. You can individually manipulate the attribute values of the route information received from BGP peers and the attribute values of the route information sent to BGP peers.
The configuration method for manipulating BGP route attribute values is as follows:

1. Defining a Route Map
   Use the route-map command to define a route map.

       Yamaha(config)# route-map 1

2. Setting Applicable Conditions
   Use commands beginning with "match" to define the conditions for the route information whose attribute values are to be changed.
   The settings for targeting route information with a MED value of 10000 are as follows:

       Yamaha(config-route-map)# match metric 10000

3. Setting Processing Details
   Use commands beginning with "set" to set the attribute value to be changed and its value.
   The settings for adding 65001 and 65002 to the beginning of the AS_PATH attribute in route information are as follows.

       Yamaha(config-route-map)# set as-path prepend 65001 65002

4. Specifying Target BGP Peers
   Switch to BGP mode and associate the defined route map with any BGP peer.
   The configuration for applying rules defined in a route map to route information received from a BGP peer with IP address 192.168.100.250 is as follows:

       Yamaha(config-route-map)# exit
       Yamaha(config)# router bgp 65000
       Yamaha(config-router)# neighbor 192.168.100.250 remote-as 65000
       Yamaha(config-router)# neighbor 192.168.100.250 route-map 1 in

### 6.10. How to Check Settings and Status

To check the IPv4 BGP routing table, use the show ip bgp command.

    Yamaha# show ip bgp
    BGP table version is 3193, local router ID is 192.168.100.241
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
                  l - labeled, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete

       Network          Next Hop            Metric LocPrf Weight Path
    *> 33.33.33.0/24    192.168.100.33                     32768 ?
    *> 44.44.44.0/24    192.168.100.44                     32768 ?

    Number of prefixes 2

To check the IPv6 BGP route table, use the show ipv6 bgp command.

    Yamaha# show bgp ipv6
    BGP table version is 3196, local router ID is 192.168.100.240
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
                  l - labeled, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete

        Network          Next Hop            Metric    LocPrf         Weight Path
    *>   c::/64           1000::c              0        100          32768    ?
    *>   d::/64           1000::d              0        100          32768    ?
    *>i  e::/64           1000::242(fe80::ae44:f2ff:fea2:88bc)
                                               0        100          0        ?
    *>i  f::/64           1000::242(fe80::ae44:f2ff:fea2:88bc)
                                               0        100          0        ?

    Total number of prefixes 4

To check BGP peer information, use the show ip bgp neighbor command.

    Yamaha# show ip bgp neighbors
    BGP neighbor is 192.168.100.242, remote AS 20000, local AS 20000, internal link
      BGP version 4, remote router ID 192.168.100.242
      BGP state = Established, up for 2d05h19m
      Last read 2d05h19m, hold time is 90, keepalive interval is 30 seconds
      Neighbor capabilities:
        Route refresh: advertised and received (old and new)
        Address family IPv6 Unicast: advertised and received
      Received 6488 messages, 2 notifications, 0 in queue
      Sent 6500 messages, 21 notifications, 0 in queue
      Route refresh request: received 0, sent 0
      Minimum time between advertisement runs is 5 seconds
     For address family: IPv6 Unicast
      BGP table version 3202, neighbor version 3202
      Index 2, Offset 0, Mask 0x4
      Community attribute sent to this neighbor (both)
      2 accepted prefixes
      2 announced prefixes

     Connections established 5; dropped 4
    Local host: 192.168.100.240, Local port: 40635
    Foreign host: 192.168.100.242, Foreign port: 179
    Nexthop: 192.168.100.240
    Nexthop global: 1000::240
    Nexthop local: fe80::ae44:f2ff:fe84:efb0
    BGP connection: non shared network
    Last Reset: 2d05h22m, due to BGP Notification received
    Notification Error Message: (Cease/Administratively Shutdown.)

### 6.11. Disconnecting and Resetting BGP Sessions

You can reset sessions with BGP peers using the clear ip bgp command or the clear ipv6 bgp command.

Reset sessions with all IPv4 BGP peers.

    Yamaha# clear ip bgp *

By specifying the in or out keyword, you can reset only the route information while maintaining the session with the BGP peer.

    Yamaha# clear ip bgp * in

To temporarily leave a session with a specific BGP peer disconnected, use the neighbor shutdown command.

    Yamaha(config-router)# neighbor 192.168.100.250 shutdown
    Yamaha(config-router)# neighbor 1000::250 shutdown

## 7. Points of Caution

1. When stacking is enabled, the following restrictions apply:

   - BGP peer configuration using an IPv6 address is invalid.

   - IPv6 route settings cannot be configured.

2. iBGP with Yamaha routers is not supported.

Search result
No more search results.
There are no topics that match your search query.