Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
external-header-nav
keyboard_arrow_up
close
keyboard_arrow_left
BGP User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

BGP Auto-Discovered Neighbors

date_range 20-Dec-24

Understanding BGP Auto-discovered Neighbor

Use BGP auto-discovered neighbor to configure BGP peering by interface rather than by specifying remote or local neighbor IP addresses.

To establish a BGP session between routers, you must explicitly configure BGP groups and peers by address. BGP peering sessions require that you identify source and destination IP addresses for endpoints of the TCP communication. Therefore, explicitly configuring these addresses is an obstacle to network scale-out and an opportunity for misconfiguration.

To streamline your BGP configuration, we have removed the need to configure per-peer address from BGP. Use BGP auto-discovered neighbor to configure BGP peering by interface rather than by specifying remote or local neighbor IP addresses. This includes use of implicit or protocol mechanisms to discover the IP addresses for use in the TCP peering sessions.

Figure 1: BGP Auto-discovered Neighbor BGP Auto-discovered Neighbor
Note:

Peering behavior and address usage must be explicitly configured to avoid peering changes based on interface address changes due to configuration or address validity (for example, IPv6 Duplicate Address Detection (DAD)).

BGP determines the address families to peer over based on the configuration. The peering sessions come up based on availability of the interface addresses for the determined families. The peer link-local address is discovered using IPv6 neighbor discovery (RFC4861) and creates a BGP session toward that neighbor. A link-local address is generated even when IPv6 interfaces have no addresses configured.

Note:

You must enable IPv6 neighbor discovery for this feature to work.

Benefits of BGP Auto-discovered Neighbor

  • Simplifies IGP deployment to a single-hop external BGP (EBGP)

  • Configures neighbors by interfaces and interface ranges instead of by IP addresses

  • Minimizes configuration on both sides with dynamic-neighbor groups

Limitations

The feature has the following limitations:

  • Scoped BGP link-local addresses do not currently support allow neighbor ranges.

  • BGP auto-discovered neighbor feature does not support IBGP or multi-hop EBGP.

  • BGP auto-discovered neighbor does not support discovering or peering with more than one remote neighbor on any given interface.

Example: Configuring BGP Auto-discovered Neighbor

This example shows how to configure BGP Auto-discovered Neighbor.

Overview

Starting in Junos OS Release 21.1R1, we support BGP auto-discovered neighbors using IPv6 Neighbor Discovery Protocol (ND). This feature allows BGP to create peer neighbor sessions using link-local IPv6 addresses of directly connected neighbor routers. You need not specify remote or local neighbor IP addresses.

Topology

The following figure shows a simplified sample topology.

Requirements

This example uses the following hardware and software components:

MX Series routers

Junos OS Release 21.1R1 or later

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

VM1

content_copy zoom_out_map
set interfaces interface-range tor-to-leaf member ge-0/0/4
set interfaces interface-range tor-to-leaf unit 0 family inet6
set interfaces ge-0/0/4 unit 0 family inet address 192.168.1.1/24
set interfaces lo0 unit 0 family inet address 192.168.30.1/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:70::1/128
set policy-options policy-statement DIRECT-RTS from protocol direct
set policy-options policy-statement DIRECT-RTS then accept
set policy-options policy-statement lb then load-balance per-packet
set policy-options as-list a-list members 1-65535
set routing-options autonomous-system 64500
set routing-options forwarding-table export lb
set routing-options forwarding-table ecmp-fast-reroute
set protocols router-advertisement interface tor-to-leaf
set protocols bgp group autodisc family inet unicast extended-nexthop
set protocols bgp group autodisc family inet6 unicast
set protocols bgp group autodisc export DIRECT-RTS
set protocols bgp group autodisc multipath multiple-as
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface tor-to-leaf
set protocols bgp group autodisc peer-as-list a-list
set protocols bgp group to-leaf-v4 family inet unicast extended-nexthop
set protocols bgp group to-leaf-v4 export DIRECT-RTS
set protocols bgp group to-leaf-v4 local-as 64500
set protocols bgp group to-leaf-v4 neighbor 192.168.1.2 peer-as 64496

VM2

content_copy zoom_out_map
set interfaces interface-range tor-to-leaf member ge-0/0/4
set interfaces interface-range tor-to-leaf unit 0 family inet6
set interfaces ge-0/0/4 unit 0 family inet address 192.168.2.1/24
set interfaces lo0 unit 0 family inet address 192.168.30.2/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:60::1/128
set policy-options policy-statement DIRECT-RTS from protocol direct
set policy-options policy-statement DIRECT-RTS then accept
set policy-options policy-statement lb then load-balance per-packet
set policy-options as-list a-list members 1-65535
set routing-options autonomous-system 64501
set routing-options forwarding-table export lb
set routing-options forwarding-table ecmp-fast-reroute
set protocols router-advertisement interface tor-to-leaf
set protocols bgp group autodisc family inet unicast extended-nexthop
set protocols bgp group autodisc family inet6 unicast
set protocols bgp group autodisc export DIRECT-RTS
set protocols bgp group autodisc multipath multiple-as
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface tor-to-leaf
set protocols bgp group autodisc peer-as-list a-list
set protocols bgp group to-leaf-v4 family inet unicast extended-nexthop
set protocols bgp group to-leaf-v4 export DIRECT-RTS
set protocols bgp group to-leaf-v4 local-as 64501
set protocols bgp group to-leaf-v4 neighbor 192.168.2.2 peer-as 64497

Leaf 1

content_copy zoom_out_map
set interfaces interface-range to-spine member "ge-0/0/[0-4]"
set interfaces interface-range to-spine unit 0 family inet
set interfaces interface-range to-spine unit 0 family inet6
set interfaces ge-0/0/4 unit 0 family inet address 192.168.1.2/24
set interfaces lo0 unit 0 family inet address 192.168.10.1/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:90::1/128
set policy-options policy-statement DIRECT-RTS from protocol direct
set policy-options policy-statement DIRECT-RTS then accept
set policy-options policy-statement lb then load-balance per-packet
set policy-options as-list a-list members 1-65535
set routing-options autonomous-system 64496
set routing-options forwarding-table export lb
set routing-options forwarding-table ecmp-fast-reroute
set protocols router-advertisement interface to-spine max-advertisement-interval 9
set protocols router-advertisement interface to-spine min-advertisement-interval 3
set protocols bgp group autodisc family inet unicast extended-nexthop
set protocols bgp group autodisc family inet6 unicast
set protocols bgp group autodisc export DIRECT-RTS
set protocols bgp group autodisc multipath multiple-as
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-spine
set protocols bgp group autodisc peer-as-list a-list
set protocols bgp group to-crpd-v4 family inet unicast extended-nexthop
set protocols bgp group to-crpd-v4 export DIRECT-RTS
set protocols bgp group to-crpd-v4 neighbor 192.168.1.1 peer-as 64500

Leaf 2

content_copy zoom_out_map
set interfaces interface-range to-spine member "ge-0/0/[0-4]"
set interfaces interface-range to-spine unit 0 family inet
set interfaces interface-range to-spine unit 0 family inet6
set interfaces ge-0/0/4 unit 0 family inet address 192.168.2.2/24
set interfaces lo0 unit 0 family inet address 192.168.10.2/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:90::2/128
set policy-options policy-statement DIRECT-RTS from protocol direct
set policy-options policy-statement DIRECT-RTS then accept
set policy-options policy-statement lb then load-balance per-packet
set policy-options as-list a-list members 1-65535
set routing-options autonomous-system 64497
set routing-options forwarding-table export lb
set routing-options forwarding-table ecmp-fast-reroute
set protocols router-advertisement interface to-spine max-advertisement-interval 9
set protocols router-advertisement interface to-spine min-advertisement-interval 3
set protocols bgp group autodisc family inet unicast extended-nexthop
set protocols bgp group autodisc family inet6 unicast
set protocols bgp group autodisc export DIRECT-RTS
set protocols bgp group autodisc multipath multiple-as
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-spine
set protocols bgp group autodisc peer-as-list a-list
set protocols bgp group to-crpd-v4 family inet unicast extended-nexthop
set protocols bgp group to-crpd-v4 export DIRECT-RTS
set protocols bgp group to-crpd-v4 neighbor 192.168.2.1 peer-as 64501

Spine 1

content_copy zoom_out_map
set interfaces interface-range to-leaf member "ge-0/0/[0-3]"
set interfaces interface-range to-leaf unit 0 family inet
set interfaces interface-range to-leaf unit 0 family inet6
set interfaces lo0 unit 0 family inet address 192.168.20.1/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:80::1/128
set policy-options policy-statement DIRECT-RTS from protocol direct
set policy-options policy-statement DIRECT-RTS then accept
set policy-options policy-statement lb then load-balance per-packet
set policy-options as-list a-list members 1-65535
set routing-options autonomous-system 64498
set routing-options forwarding-table export lb
set routing-options forwarding-table ecmp-fast-reroute
set protocols router-advertisement interface to-leaf max-advertisement-interval 9
set protocols router-advertisement interface to-leaf min-advertisement-interval 3
set protocols bgp group autodisc family inet unicast extended-nexthop
set protocols bgp group autodisc family inet6 unicast
set protocols bgp group autodisc export DIRECT-RTS
set protocols bgp group autodisc multipath multiple-as
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-leaf
set protocols bgp group autodisc peer-as-list a-list

Spine 2

content_copy zoom_out_map
set interfaces interface-range to-leaf member "ge-0/0/[0-3]"
set interfaces interface-range to-leaf unit 0 family inet
set interfaces interface-range to-leaf unit 0 family inet6
set interfaces lo0 unit 0 family inet address 192.168.20.2/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:80::2/128
set policy-options policy-statement DIRECT-RTS from protocol direct
set policy-options policy-statement DIRECT-RTS then accept
set policy-options policy-statement lb then load-balance per-packet
set policy-options as-list a-list members 1-65535
set routing-options autonomous-system 64499 
set routing-options forwarding-table export lb
set routing-options forwarding-table ecmp-fast-reroute
set protocols router-advertisement interface to-leaf max-advertisement-interval 9
set protocols router-advertisement interface to-leaf min-advertisement-interval 3
set protocols bgp group autodisc family inet unicast extended-nexthop
set protocols bgp group autodisc family inet6 unicast
set protocols bgp group autodisc export DIRECT-RTS
set protocols bgp group autodisc multipath multiple-as
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-leaf
set protocols bgp group autodisc peer-as-list a-list

Configuring VM1

To configure BGP auto-discovered neighbor, perform the following steps on VM1:

  1. Configure the device interfaces.

    content_copy zoom_out_map
    user@VM1# set interfaces interface-range tor-to-leaf member ge-0/0/4
    user@VM1# set interfaces interface-range tor-to-leaf unit 0 family inet6
  2. Create the loopback interface and configure the IP address.

    content_copy zoom_out_map
    user@VM1# set interfaces lo0 unit 0 family inet address 192.168.30.1/32      
    user@VM1# set interfaces lo0 unit 0 family inet6 address 2001:db8:70::1/128
    
  3. Enable routing policies.

    content_copy zoom_out_map
    user@VM1# set policy-options policy-statement DIRECT-RTS from protocol direct
    user@VM1# set policy-options policy-statement DIRECT-RTS then accept
    user@VM1# set policy-options policy-statement lb then load-balance per-packet
    user@VM1# set policy-options as-list a-list members 1-65535
    
  4. Configure the autonomous system (AS) number

    content_copy zoom_out_map
    user@VM1# set routing-options autonomous-system 64500 
  5. Apply the per-packet policy to enable load balancing of traffic and ECMP.

    content_copy zoom_out_map
    user@VM1# set routing-options forwarding-table export lb
    user@VM1# set routing-options forwarding-table ecmp-fast-reroute
    
  6. Configure BGP to establish internal and external peering sessions.

    content_copy zoom_out_map
    user@VM1# set protocols bgp group autodisc family inet unicast extended-nexthop
    user@VM1# set protocols bgp group autodisc family inet6 unicast
    user@VM1# set protocols bgp group autodisc export DIRECT-RTS
    user@VM1# set protocols bgp group autodisc multipath multiple-as
    user@VM1# set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd
    user@VM1# set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface tor-to-leaf
    user@VM1# set protocols bgp group autodisc peer-as-list a-list
    user@VM1# set protocols bgp group to-leaf-v4 family inet unicast extended-nexthop
    user@VM1# set protocols bgp group to-leaf-v4 export DIRECT-RTS
    user@VM1# set protocols bgp group to-leaf-v4 local-as 5
    user@VM1# set protocols bgp group to-leaf-v4 neighbor 192.168.1.2 peer-as 1
    
  7. If you are done configuring the device, commit the configuration.

    content_copy zoom_out_map
    user@VM1# commit

Results

From configuration mode, confirm your configuration by entering the show interfaces, show protocols, show policy-options, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

content_copy zoom_out_map
[edit]
user@VM1# show interfaces
interface-range tor-to-leaf {
    member ge-0/0/4;
    unit 0 {
        family inet6;
    }
}
ge-0/0/4 {
    unit 0 {
        family inet {
            address 192.168.1.1/24;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.30.1/32;
        }
        family inet6 {
            address 2001:db8:70::1/128;
        }
    }
}
content_copy zoom_out_map
[edit]
user@VM1# show protocols
router-advertisement {
    interface tor-to-leaf;
}
bgp {
    group autodisc {
        family inet {
            unicast {
                extended-nexthop;
            }
        }
        family inet6 {
            unicast;
        }
        export DIRECT-RTS;
        multipath {
            multiple-as;
        }
        dynamic-neighbor ndp {
            peer-auto-discovery {
                family inet6 {
                    ipv6-nd;
                }
                interface tor-to-leaf;
            }
        }
        peer-as-list a-list;
    }
    group to-leaf-v4 {
        family inet {
            unicast {
                extended-nexthop;
            }
        }
        export DIRECT-RTS;
        local-as 64500;
        neighbor 192.168.1.2 {
            peer-as 64496;
        }
    }
}
content_copy zoom_out_map
[edit]
user@VM1# show policy-options
policy-statement DIRECT-RTS {
    from protocol direct;
    then accept;
}
policy-statement lb {
    then {
        load-balance per-packet;
    }
}
as-list a-list members 1-65535;
content_copy zoom_out_map
[edit]
user@VM1# show policy-options
policy-statement DIRECT-RTS {
    from protocol direct;
    then accept;
}
policy-statement lb {
    then {
        load-balance per-packet;
    }
}
as-list a-list members 1-65535;

[
content_copy zoom_out_map
edit]
user@VM1# show routing-options
autonomous-system 64500;
forwarding-table {
    export lb;
    ecmp-fast-reroute;
}

Verification

Confirm that the configuration is working properly.

Verifying Auto-discovered neighbors

Purpose

Verify the auto-discovered BGP neighbors.

Action

From operational mode, run the show bgp summary auto-discovered command

On Leaf1

content_copy zoom_out_map
user@Leaf1> show bgp summary auto-discovered
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 2 Peers: 5 Down peers: 1
Auto-discovered peers: 4
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0
                      24         20          0          0          0          0
inet6.0
                      16         16          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
fe80::5668:a3ff:fe16:1049%ge-0/0/3.0       64499        194        195       0       1     1:25:18 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
fe80::5668:a3ff:fe16:104c%ge-0/0/4.0       64499        193        195       0       1     1:25:18 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
fe80::5668:a3ff:fe16:12c9%ge-0/0/1.0       64498        217        223       0       1     1:35:53 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
fe80::5668:a3ff:fe16:12ce%ge-0/0/2.0       64498        218        223       0       1     1:35:57 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0

On Spine1

content_copy zoom_out_map
user@Spine1> show bgp summary auto-discovered
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 1 Peers: 4 Down peers: 0
Auto-discovered peers: 4
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0
                      24         20          0          0          0          0
inet6.0
                      16         16          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
fe80::5668:a3ff:fe16:2e7%ge-0/0/0.0       64496        245        237       0       0     1:45:19 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
fe80::5668:a3ff:fe16:2f2%ge-0/0/1.0       64496        245        238       0       0     1:45:23 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
fe80::5668:a3ff:fe16:e49%ge-0/0/2.0       64497        245        243       0       0     1:45:19 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
fe80::5668:a3ff:fe16:e59%ge-0/0/3.0       64497        247        248       0       0     1:45:23 Establ
  inet.0: 5/6/6/0
  inet6.0: 4/4/4/0
Meaning

The output shows the summary of auto-discovered bgp neighbors. You can see the number of auto-discovered peers and its details.

Verifying BGP Auto-discovered Peers

Purpose

Verify the auto-discovered BGP neighbors.

Action

From operational mode, run the show bgp neighbor auto-discovered command.

On Leaf1

content_copy zoom_out_map
user@Leaf1> show bgp neighbor auto-discovered
Peer: fe80::5668:a3ff:fe16:1049%ge-0/0/3.0+65265 AS 64499 Local: fe80::5668:a3ff:fe16:2f6%ge-0/0/3.0+179 AS 64496
  Group: autodisc              Routing-Instance: master
  Forwarding routing-instance: master
  Type: External    State: Established    Flags: <Sync PeerAsList AutoDiscoveredNdp>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ DIRECT-RTS ]
  Options: <AddressFamily Multipath Refresh>
  Options: <MultipathAs>
  Options: <GracefulShutdownRcv>
  Address families configured: inet-unicast inet6-unicast
  Holdtime: 90 Preference: 170
  Graceful Shutdown Receiver local-preference: 0
  Number of flaps: 1
  Last flap event: RecvNotify
  Error: 'Cease' Sent: 0 Recv: 1
  Peer ID: 128.49.102.24   Local ID: 128.49.102.139    Active Holdtime: 90
  Keepalive Interval: 30         Group index: 2    Peer index: 2    SNMP index: 9
  I/O Session Thread: bgpio-0 State: Enabled
  BFD: disabled, down
  Local Interface: ge-0/0/3.0
  NLRI for restart configured on peer: inet-unicast inet6-unicast
  NLRI advertised by peer: inet-unicast inet6-unicast
  NLRI for this session: inet-unicast inet6-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  Restart flag received from the peer: Notification
  NLRI that restart is negotiated for: inet-unicast inet6-unicast
  NLRI of received end-of-rib markers: inet-unicast inet6-unicast
  NLRI of all end-of-rib markers sent: inet-unicast inet6-unicast
  ....................

On Spine1

content_copy zoom_out_map
user@Spine1>  show bgp neighbor auto-discovered
Peer: fe80::5668:a3ff:fe16:2e7%ge-0/0/0.0+60458 AS 64496 Local: fe80::5668:a3ff:fe16:12c9%ge-0/0/0.0+179 AS 64498
  Group: autodisc              Routing-Instance: master
  Forwarding routing-instance: master
  Type: External    State: Established    Flags: <Sync PeerAsList AutoDiscoveredNdp>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Export: [ DIRECT-RTS ]
  Options: <AddressFamily Multipath Refresh>
  Options: <MultipathAs>
  Options: <GracefulShutdownRcv>
  Address families configured: inet-unicast inet6-unicast
  Holdtime: 90 Preference: 170
  Graceful Shutdown Receiver local-preference: 0
  Number of flaps: 0
  Peer ID: 128.49.102.139  Local ID: 128.49.103.129    Active Holdtime: 90
  Keepalive Interval: 30         Group index: 1    Peer index: 3    SNMP index: 7
  I/O Session Thread: bgpio-0 State: Enabled
  BFD: disabled, down
  Local Interface: ge-0/0/0.0
  NLRI for restart configured on peer: inet-unicast inet6-unicast
  NLRI advertised by peer: inet-unicast inet6-unicast
  NLRI for this session: inet-unicast inet6-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  Restart flag received from the peer: Notification
  NLRI that restart is negotiated for: inet-unicast inet6-unicast
  NLRI of received end-of-rib markers: inet-unicast inet6-unicast
  NLRI of all end-of-rib markers sent: inet-unicast inet6-unicast
  Peer does not support LLGR Restarter functionality
  Peer supports 4 byte AS extension (peer-as 64496)
  Peer does not support Addpath
  NLRI that we support extended nexthop encoding for: inet-unicast
  NLRI that peer supports extended nexthop encoding for: inet-unicast
  Table inet.0 Bit: 20000
  ....................
Meaning

The output shows information about the auto-discovered BGP neighbors.

external-footer-nav