BGP Juniper
BGP Juniper
AS 65502
AS 65503
                 Note: BGP Is an IETF standard defined in RFC 4271 (supersedes RFC 1771).
 2012 Juniper Networks, Inc. All rights reserved.                                               www.juniper.net | 2
     When Should I Use BGP?
      BGP is typically used in large enterprise environments
       where multiple ISP connections exist, and in all service
       provider environments
                                                       ISP A
                                                     AS 65502
                                       Customer A
                                                                   Single-homed customers typically
                                                                   use a default route to the Internet.
                                        AS 65501       BGP
                                                                                        Customer B
                                                                Static Routing
                                                     AS 65503
        Multihomed customers use BGP to
        control inbound and outbound traffic.
                                                       ISP B
                                AS 65501                            AS 65504
                                                        IGP
                                                       IBGP
AS 65503
BGP Connectivity
Established Neighbors
                                                     R1                                    R2
                                                               TCP Connectivity
BGP Connectivity
Established Neighbors
                                                     Route X                                     Route X
                                                R1                            R2                           R3
                                                                       ISP B
                                                                    (AS 65002)
                                      ISP A                                                       ISP C
                                   (AS 65001)                                                  (AS 65003)
   Static default
   route to ISP A
                                                     Static route to Customer A
R3
                            ISP A                                      R2                         ISP C       R4
                         (AS 65001)                                                            (AS 65003)
R1
Note: All BGP routes start as something other than BGP routes.
                                      ISP A                                                     ISP C
                                   (AS 65001)                                                (AS 65003)
                                                                                                     Customer B
                       Customer A                                                                    (AS 65501)
                                                                                                   172.31.128.0/20 is
                                                                                               reachable through AS 65003
                                                                       ISP B                         and AS 65501
                                                                    (AS 65002)
                                   ISP A                                                          ISP C
                                (AS 65001)                                                     (AS 65003)
                                                                                                             172.31.128.0/20
                                                                                                                is reachable
 Default static route                                                                                        through AS 65501
                                   ISP A                                                      ISP C
                                (AS 65001)                                                 (AS 65003)
                                                                                                        172.31.128.0/20 is
   Default static route                                                                                  reachable through
                                                                                                             AS 65501
                                                ISP A                                        ISP B
                                              AS 65501                                     AS 65502
R1 R2
R3
        2. Prefer the shortest AS-path length                     7. For EBGP-received routes, prefer the
                                                                      current active route; otherwise, prefer
                                                                      routes from the peer with the lowest RID
        3. Prefer the lowest origin value                         8. Prefer paths with the shortest cluster
                                                                     length
        4. Prefer the lowest MED value                            9. Prefer routes from the peer with the
                                                                     lowest peer ID
        5. Prefer routes learned from an
        EBGP peer over an IBGP peer
                                                        IGP
                                                       IBGP
                                AS 65501                        AS 65504
                                                        IGP
                                                       IBGP
AS 65503
                                                                                     AS 65503
                                                                                R1
                                                ge-0/0/1.0         ge-0/0/1.0
                 AS 65502                                                                            R2
                                                     (.1) 172.24.1.0/30 (.2)
                                                                                        IGP
                                                                                       IBGP
                                                                               AS 65503
                                                     Route X        Route X
                                                               R1                    R2                    R3
                  AS 65502
                                                                    IBGP Neighbors        IBGP Neighbors
                                                                                                               How do I get to
                                                                                           AS 65503             172.24.1.1?
                                               Route X                                   Route X
                  AS 65502                                                          R1                    R2
                           prefix X
                                                        EBGP                    IGP
                                                                               IBGP
                                                      IGP                                                 IGP
                                                     IBGP                                                IBGP
                                                 AS 65502                                             AS 65503
                                                                3. IBGP does not advertise
                                                                    any routes learned from IBGP
                                                  ISP A                                                ISP B
                                                AS 65501                                             AS 65502
                                                                ge-0/0/1.0     ge-0/0/1.0
                                 lo0/RID: 192.168.100.1                                          lo0/RID: 192.168.100.2
                                                           R1   (.1) 172.24.1.0/30 (.2)     R2
                                                                        IBGP
 2012 Juniper Networks, Inc. All rights reserved.                                                                 www.juniper.net | 28
     Case Study: Configuring BGP
           [edit]
           user@R1# show routing-options
           router-id 192.168.100.1;
           autonomous-system 65503;                  Devices assigned AS number
           [edit]
           user@R1# show protocols bgp
           group int-65503 {                           BGP group names are user-defined
               type internal;
               local-address 192.168.100.1;
               neighbor 192.168.100.2;                    BGP session type determines if the
           }                                              peering session is IBGP or EBGP
           group ext-65501 {
               type external;
               peer-AS 65501;                             EBGP peers assigned AS number
               neighbor 172.30.1.2;
           }
           [edit]
           user@R1# show protocols bgp
           group int-65503 {
               type internal;
               local-address 192.168.100.1;                           Policy is applied as an export
               export next-hop-self-policy;                           policy for the internal BGP group
               neighbor 192.168.100.2;
           }
           group ext-65501 {
               type external;
               peer-AS 65501;
               neighbor 172.30.1.2;
           }
           [edit]
           user@R1# show routing-options aggregate
           route 172.24.0.0/22;                                  Aggregate route defined
           [edit]
           user@R1# show policy-options policy-statement adv-aggregate
           term match-aggregate {
               from {
                   protocol aggregate;
                   route-filter 172.24.0.0/22 exact;      Redistribution policy defined
               }
               then accept;
           }
           [edit]
           user@R1# show protocols bgp group ext-65501
           type external;
                                                       Redistribution policy applied as an
           export adv-aggregate;                       export policy to the EBGP group
           peer-AS 65501;
           neighbor 172.30.1.2;
    Routes
  from BGP                                           Import       RIB-Local          Export                 Routes to
    peers                          RIB-In                       (Route table)                     RIB-Out   BGP peers
                                                      policy                         policy
           Note: You can add options to filter the output by BGP attributes such as AS path, next
           hop, and community.