Configuring BGP

  1. Start BGP

    router{}edit conf myconfig
    router{conf:myconfig-rtg}router bgp ASN

    ASN of your local AS.


    You can alsop stop BGP:

    router{conf:myconfig-rtg}delete router bgp ASN
  2. Connect to a remote BGP router:

    router{conf:myconfig-rtg-bgp}neighbor A.B.C.D remote-as ASN

    IPv4 address of the remote BGP router.


    ASN of the remote BGP router.


    The remote BGP router should be a direct next hop of your local BGP router. Otherwise you are trying to configure a multihop BGP peering.

  3. Announce the network prefixes, which will be originated from your AS:

    router{conf:myconfig-rtg-bgp}network A.B.C.D/M

    IPv4 prefix that will be announced by your BGP router.


    Length of the mask of the A.B.C.D network.


    • The network prefix A.B.C.D/M should be an aggregated (summarized) prefix of the networks that you own and that you originate.Moreover, to avoid a routing loop, a black-hole route or a reject route should be configured.
    • The BGP network command has a different meaning than the RIP and OSPF v2 network command.
  4. Configure BGP 4:

    Let’s use the basic example of the figure below where rt1 belongs to the AS 65500, rt2 to the AS 65510, rt3 to the AS 65520 and rt4 to 65530.


Your first BGP 4 configuration

We suppose that:

  • rt1 has a peering with rt2 and rt3
  • rt2 has a peering with rt1 and rt4
  • rt3 has a peering with rt1 and rt4
  • rt4 has a peering with rt2 and rt3

The advertised networks are:

  • rt1 announces the network
  • rt2 announces the network
  • rt3 announces the network
  • rt4 announces the network

We will have the following configurations.


router bgp 65500
neighbor remote-as 65520
neighbor remote-as 65510


router bgp 65510
neighbor remote-as 65530
neighbor remote-as 65500


router bgp 65520
neighbor remote-as 65530
neighbor remote-as 65500


router bgp 65530
neighbor remote-as 65520
neighbor remote-as 65510
  1. Check the status of the BGP connection, type the command show routing ip bgp summary. This is the first thing to do to check whether the BGP session is ok.

    rt1{}show routing ip bgp summary
    BGP router identifier, local ASN 65500
    11 BGP AS-PATH entries
    0 BGP community entries
    Neighbor  V  AS     MsgRcvd  MsgSent TblVer InQ OutQ Up/Down State/PfxRcd  4  65510  35       35      0      0   0    00:26:10 4  4  65520  22       21      0      0   0    00:15:33 4
    Total number of neighbors 2
  2. Check the output of the state column, it must be blank in case the BGP connection is established, otherwise it reflects the state of the BGP connection. The different BGP session states are studied later in the section.

    This command is very helpful and gives a summary of the different BGP sessions.

    From the output we can conclude that router rt1 has two BGP neighbors, one in AS 65510 the other in AS 65520, and that rt1 is receiving 4 prefixes from each neighbor (PfxRcd).

    For more information about a given session, use the detailed command show routing ip bgp neighbors A.B.C.D.

    This command gives detailed BGP information about a given neighbor

    rt1{}show routing ip bgp neighbors
    BGP neighbor is, remote AS 65520, local AS 65500, external link
      BGP version 4, remote router ID
      BGP state = Established, up for 00:28:54
      Last read 00:00:54, hold time is 180, keepalive interval is 60 seconds
      Neighbor capabilities:
        Route refresh: advertised and received (old and new)
        Address family IPv4 Unicast: advertised and received
      Received 35 messages, 0 notifications, 0 in queue
      Sent 34 messages, 0 notifications, 0 in queue
      Route refresh request: received 0, sent 0
      Minimum time between advertisement runs is 30 seconds
     For address family: IPv4 Unicast
      Community attribute sent to this neighbor (both)
      4 accepted prefixes
      Connections established 1; dropped 0
    Local host:, Local port: 3902
    Foreign host:, Foreign port: 179
    Nexthop global: ::
    Nexthop local: ::
    BGP connection: shared network
    Read thread: on Write thread: off
  3. Check that BGP state is ESTABLISHED (marked in bold in the previous output).