EdgeRouter - Border Gateway Protocol


Overview


Readers will learn how Border Gateway Protocol (BGP) is used and configured between two Autonomous Systems.

NOTES & REQUIREMENTS:
Applicable to the latest EdgeOS firmware on all EdgeRouter models. Knowledge of the Command Line Interface (CLI) and basic networking knowledge is required. Please see the Related Articles below for more information.
 
Devices used in this article:

Table of Contents


  1. Network Diagram
  2. How to Configure BGP
  3. Peer Verification
  4. Learned Routes
  5. Full Internet Routes

Network Diagram


Back to Top

The network topology is shown below and the following interfaces are in use on the EdgeRouters:

ER-L

  • eth0 (WAN) - 203.0.113.1
  • eth1 - 1.0.0.0/24

ER-R

  • eth0 (WAN) - 192.0.2.1
  • eth1 - 2.0.0.0/24
bgp.001.png

How to Configure BGP


Back to Top

ER-L Configuration

1. Enter configuration mode.

configure

2. Set Router ID.

set protocols bgp 100 parameters router-id 203.0.113.1

3. Set neighbor.

set protocols bgp 100 neighbor 192.0.2.1 remote-as 200

4. Redistribute Static Routes.

set protocols bgp 100 redistribute static

5. Commit & Save.

commit; save;

 

ER-R Configuration

1. Enter configuration mode.

configure

2. Set Router ID.

set protocols bgp 200 parameters router-id 192.0.2.1

3. Set Neighbor.

set protocols bgp 200 neighbor 203.0.113.1 remote-as 100

4. Redistribute Static Routes.

set protocols bgp 200 redistribute static

5. Commit & Save.

commit; save;

Peer Verification


Back to Top

Use the show ip bgp neighbors command to verify that the peer is established.

ER-L

BGP neighbor is 192.0.2.1, remote AS 100, local AS 200, external link
  BGP version 4, remote router ID 192.0.2.1
  BGP state = Established, up for 00:21:02
  Last read 00:21:02, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received (old and new)
    4-Octet ASN Capability: advertised and received
    Address family IPv4 Unicast: advertised and received
  Received 105 messages, 1 notifications, 0 in queue
  Sent 156 messages, 2 notifications, 0 in queue
  Route refresh request: received 0, sent 0
  Minimum time between advertisement runs is 30 seconds
  Update source is 203.0.113.1
 For address family: IPv4 Unicast
  BGP table version 991, neighbor version 991
  Index 1, Offset 0, Mask 0x2
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor (both)
  3 accepted prefixes
  3 announced prefixes

 Connections established 4; dropped 3
Local host: 203.0.113.1, Local port: 179
Foreign host: 192.0.2.1, Foreign port: 48327
Nexthop: 203.0.113.1
Nexthop global: fe80::618:d6ff:fea0:a490
Nexthop local: ::
BGP connection: non shared network
Last Reset: 00:21:02, due to BGP Notification sent
Notification Error Message: (Cease/Other Configuration Change.)

ER-R

BGP neighbor is 203.0.113.1, remote AS 200, local AS 100, external link
  BGP version 4, remote router ID 203.0.113.1
  BGP state = Established, up for 00:24:25
  Last read 00:24:25, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received (old and new)
    4-Octet ASN Capability: advertised and received
    Address family IPv4 Unicast: advertised and received
  Received 188 messages, 2 notifications, 0 in queue
  Sent 129 messages, 1 notifications, 0 in queue
  Route refresh request: received 1, sent 1
  Minimum time between advertisement runs is 30 seconds
  Update source is 192.0.2.1
 For address family: IPv4 Unicast
  BGP table version 23, neighbor version 23
  Index 1, Offset 0, Mask 0x2
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor (both)
  3 accepted prefixes
  3 announced prefixes

 Connections established 5; dropped 4
Local host: 192.0.2.1, Local port: 48327
Foreign host: 203.0.113.1, Foreign port: 179
Nexthop: 192.0.2.1
Nexthop global: fe80::feec:daff:fe40:f8d5
Nexthop local: ::
BGP connection: non shared network
Last Reset: 00:24:30, due to BGP Notification received
Notification Error Message: (Cease/Other Configuration Change.)

Learned Routes


Back to Top

The show command checks R1 for learned routes, and the configuration commands redistribute static routes on R2, so R1 will learn routes from R2.

  • Use the show ip route bgp command to check R1 for bgp routes learned from peer R2.

ER-L

IP Route Table for VRF "default"
B    *> 1.0.0.0/24 [20/0] via 192.0.2.1, eth0, 00:07:06

Gateway of last resort is not set

ER-R

IP Route Table for VRF "default"
B    *> 2.0.0.0/24 [20/0] via 203.0.113.1, eth0, 00:10:55

Gateway of last resort is not set

Full Internet Routes


Back to Top

ATTENTION: Receiving a full Internet routing table will consume significant amounts of memory; therefore, we do NOT recommend that you use BGP for full routes on the EdgeRouter X models, EdgeRouter Lite, and EdgeRouter PoE which have limited amount of RAM.

Use the show ip route summary command to view the route summary.

admin@ubnt-bgp-test:~$ show ip route summary
Route Source Routes FIB
connected 3 3
static 3 2
ebgp 405543 405541
ibgp 0 0
------
Totals 405549 405546

We're sorry to hear that!