Description

This KB explains the condition when BGP comes up with loopback as source without local-address configuration

Symptoms

BGP establishes without local-address knob present globally, group level or neighbor level

Solution

This KB explains the condition when BGP forms peering with loopbacks IPs
 
 
Scenario1 : >>> 
 
When BGP is configured with neighbor address as loopback IPs for both end and no local-address or default-address-selection is configured on either end
 
lo0 ---R1 -----------------R2—lo0
 
R1 : 
 
root@DEVICE> show configuration interfaces | display set
Jul 13 10:18:27
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.1/24
set interfaces lo0 unit 0 family inet address 192.168.1.1/32
 
root@DEVICE> show configuration protocols | display set
Jul 13 10:18:34
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.2
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
 
root@DEVICE> show configuration routing-options | display set
Jul 13 10:18:44
set routing-options router-id 192.168.1.1
set routing-options autonomous-system 64512
 
root@DEVICE> show configuration system | display set
Jul 13 10:18:50
set system ports console log-out-on-disconnect
root@DEVICE>
 
R2 : 
 
root@DEVICE2> show configuration interfaces | display set
Jul 13 10:19:35
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.2/24
set interfaces lo0 unit 0 family inet address 192.168.1.2/32
root@DEVICE2> show configuration protocols | display set
Jul 13 10:19:42
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.1
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
 
root@DEVICE2> show configuration routing-options | display set
Jul 13 10:19:50
set routing-options router-id 192.168.1.2
set routing-options autonomous-system 64512
root@DEVICE2> show configuration system | display set
Jul 13 10:19:56
set system ports console log-out-on-disconnect
root@DEVICE2>
BGP State: 
R1 :
root@DEVICE> show bgp summary
Jul 13 10:20:17
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 1 Peers: 1 Down peers: 1
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0               
                       0          0          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.1.2           64512          1          0       0       0        2:16 Active
 
root@DEVICE> ping 192.168.1.2 source 192.168.1.1   
Jul 13 10:20:42
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=0 ttl=64 time=1.959 ms
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=2.174 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=2.001 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=1.834 ms
^C
--- 192.168.1.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.834/1.992/2.174/0.122 ms
 
BGP will not come up.
 
Reason: BGP by default use egress IP as source and remote peer is expecting source as loopback IP and hence both peers will stuck in idle/active state
 
Scenario2 : >>> 
 
When BGP is configured with neighbor address as loopback IPs for both end and local-address is configured on one end:
lo0 ---R1 --(local-address)---------------R2---lo0
 
R1 :
 
root@DEVICE> show configuration routing-options | display set       
Jul 13 10:24:01
set routing-options router-id 192.168.1.1
set routing-options autonomous-system 64512
 
root@DEVICE> show configuration system | display set
Jul 13 10:24:07
set system ports console log-out-on-disconnect
 
root@DEVICE>
Jul 13 10:24:08
 
root@DEVICE> show configuration protocols bgp | display set
Jul 13 10:24:17
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers local-address 192.168.1.1
set protocols bgp group internal-peers neighbor 192.168.1.2
 
root@DEVICE>
 
R2:
 
root@DEVICE2> show configuration routing-options | display set
Jul 13 10:24:52
set routing-options router-id 192.168.1.2
set routing-options autonomous-system 64512
 
root@DEVICE2> show configuration system | display set          
Jul 13 10:25:04
set system ports console log-out-on-disconnect
 
root@DEVICE2> show configuration protocols bgp | display set
Jul 13 10:25:15
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.1
 
root@DEVICE2>
 
BGP will come up.
https://supportportal.juniper.net/s/article/How-to-configure-update-source-interface-for-BGPin-junos-CLI

NOTE: Although a BGP session can be established when only one of the paired routing devices has local-address configured, we strongly recommend that you configure local-address on both paired routing devices for IBGP and multihop EBGP sessions. The local-address statement ensures that deterministic fixed addresses are used for the BGP session end-points.
 
R1:
 
root@DEVICE> show bgp summary    
Jul 13 10:26:43
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 1 Peers: 1 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0               
                       0          0          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.168.1.2           64512          9          9       0       0        3:09 Establ
  inet.0: 0/0/0/0
 
root@DEVICE> show bgp neighbor 192.168.1.2
Jul 13 10:26:54
Peer: 192.168.1.2+179 AS 64512 Local: 192.168.1.1+57866 AS 64512
  Group: internal-peers        Routing-Instance: master
  Forwarding routing-instance: master
  Type: Internal    State: Established    Flags: <Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Options: <LocalAddress Refresh>
  Options: <GracefulShutdownRcv>
  Local Address: 192.168.1.1 Holdtime: 90 Preference: 170
  Graceful Shutdown Receiver local-preference: 0
  Number of flaps: 0
  Peer ID: 192.168.1.2     Local ID: 192.168.1.1       Active Holdtime: 90
  Keepalive Interval: 30         Group index: 0    Peer index: 0    SNMP index: 0     
 
Scenario3 : >>>
 
[Recommended]
 
When BGP is configured with neighbor address as loopback IPs for both end and local-address is also configured on each end
 
lo0 ---R1 --(local-address)------------(local-address)---R2---lo0
 
 
root@DEVICE2> configure
Jul 13 10:27:56
Entering configuration mode
 
[edit]
root@DEVICE2# run show configuration protocols bgp | display set
Jul 13 10:28:05
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.1
 
[edit]
root@DEVICE2# set protocols bgp group internal-peers local-address 192.168.1.2
Jul 13 10:28:20
 
[edit]
root@DEVICE2# show | compare
Jul 13 10:28:25
[edit protocols bgp group internal-peers]
+    local-address 192.168.1.2;
 
[edit]
root@DEVICE2# commit
Jul 13 10:28:27
commit complete
 
[edit]
root@DEVICE2# exit
Jul 13 10:28:31
Exiting configuration mode
 
 
BGP will come up.
 
Scenario4 : >>>
 
When BGP is configured with neighbor address as loopback IPs for both end and default-address-selection is configured on one end
 
lo0 ---R1 --(default-address-selection)——————---R2—lo0
 
R1 : 
 
{master}
root@DEVICE> show version 
Jul 15 19:45:07
Hostname: DEVICE
Model: ptx10016
Junos: 22.4R2.8
JUNOS OS Kernel 64-bit  [20230321.be5f9c0_builder_stable_12_224]
JUNOS OS libs [20230321.be5f9c0_builder_stable_12_224]
 
{master}
root@DEVICE> show configuration interfaces lo0 | display set                          
Jul 15 19:45:33
set interfaces lo0 unit 0 family inet filter input FILTER-RE-FIREWALL
set interfaces lo0 unit 0 family inet address 127.0.0.1/32
set interfaces lo0 unit 0 family inet address 192.168.1.1/32
 
{master}
root@DEVICE> show configuration interfaces ae2 | display set    
Jul 15 19:45:39
set interfaces ae2 aggregated-ether-options link-speed 100g
set interfaces ae2 aggregated-ether-options lacp active
set interfaces ae2 aggregated-ether-options lacp periodic slow
set interfaces ae2 unit 0 family inet address 10.0.0.1/24
 
 
{master}
root@DEVICE> show configuration protocols bgp | display set | match internal-peers 
Jul 15 19:46:28
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.2
 
{master}
root@DEVICE> show configuration system | display set | match default-address-selection   
Jul 15 19:46:52
set system default-address-selection
 
 
{master}
root@DEVICE> show bgp summary | match est 
Jul 15 19:47:11
192.168.1.2           64512         10          9       0       0        3:13 Establ
 
 
root@DEVICE> show bgp neighbor 192.168.1.2 
Jul 15 19:47:29
Peer: 192.168.1.2+179 AS 64512 Local: 192.168.1.1+62064 AS 64512
  Group: internal-peers        Routing-Instance: master
 
R2 : 
 
root@DEVICE2> show version 
Jul 15 15:18:17
Hostname: DEVICE2
Model: ptx10001-36mr-k
Junos: 24.2R1.18-EVO
Yocto: 4.0.14
Linux Kernel: 5.15.76-yocto-standard-juniper-02085-gce2d521ddcf4
JUNOS-EVO OS 64-bit [junos-evo-install-ptx-fixed-x86-64-24.2R1.18-EVO]
 
root@DEVICE2> show configuration interfaces lo0 | display set 
Jul 15 15:18:36
set interfaces lo0 unit 0 family inet address 192.168.1.2/32
 
root@DEVICE2> show configuration interfaces ae2 | display set 
Jul 15 15:18:45
set interfaces ae2 aggregated-ether-options link-speed 100g
set interfaces ae2 aggregated-ether-options lacp active
set interfaces ae2 aggregated-ether-options lacp periodic slow
set interfaces ae2 unit 0 family inet address 10.0.0.2/24
 
root@DEVICE2> show configuration protocols bgp | display set | match internal-peers 
Jul 15 15:18:59
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.1
 
root@DEVICE2> show configuration system | display set | match default-address-selection 
Jul 15 15:19:13
 
root@DEVICE2> show bgp summary | match est 
Jul 15 15:19:20
192.168.1.1           64512         15         13       0       0        5:22 Establ
 
root@DEVICE2> show bgp neighbor 192.168.1.1 
Jul 15 15:19:29
 
Warning: License key missing; requires 'BGP' license
 
Peer: 192.168.1.1+62064 AS 64512 Local: 192.168.1.2+179 AS 64512
  Group: internal-peers        Routing-Instance: master
  Forwarding routing-instance: master  
  Type: Internal    State: Established    Flags: <Sync>
 
BGP will come up.
 
https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/statement/default-address-selection-edit-system.html
 
Scenario5 : >>>
 
BGP does not flap when the default-address-selection knob is removed from the configuration while BGP is running.
 
lo0 ---R1 -----------------R2---lo0
 
R1: 
 
{master}
root@DEVICE> show bgp summary | match est 
Jul 15 19:53:18
192.168.1.2           64512         24         22       0       0        9:20 Establ
 
root@DEVICE> show configuration system | display set | match default-addres 
Jul 15 19:53:31
set system default-address-selection
 
{master}
root@DEVICE> configure 
Jul 15 19:53:34
Entering configuration mode
 
{master}[edit]
root@DEVICE# delete system default-address-selection 
Jul 15 19:53:39
 
{master}[edit]
labroot@DEVICE# show | compare 
Jul 15 19:53:43
[edit system]
-  default-address-selection;
 
{master}[edit]
root@DEVICE# commit and-quit 
Jul 15 19:53:46
warning: Could not connect to re1 : Can't assign requested address
warning: Cannot connect to other RE, ignoring it
commit complete
Exiting configuration mode
 
{master}
root@DEVICE> 
 
{master}
root@DEVICE> show bgp summary | match est 
Jul 15 19:54:08
192.168.1.2           64512         26         24       0       0       10:10 Establ
 
{master}
root@DEVICE> show configuration system | match default-address 
Jul 15 19:54:44
 
{master}
root@DEVICE> show configuration protocols bgp | display set | match internal-peers 
Jul 15 19:54:55
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.2
 
{master}
root@DEVICE> show bgp summary | match est    
Jul 15 19:57:37
192.168.1.2           64512         33         31       0       0       13:39 Establ
 
{master}
root@DEVICE> 
 
R2 :
 
root@DEVICE2> show configuration system | display set | match default-address 
Jul 15 15:26:21
 
root@DEVICE2>          
Jul 15 15:26:25
 
root@DEVICE2> show configuration protocols bgp | display set 
Jul 15 15:26:33
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers neighbor 192.168.1.1
 
root@DEVICE2> show bgp summary | match est 
Jul 15 15:26:39
192.168.1.1           64512         31         29       0       0       12:41 Establ
 
BGP stays up. [unless it is flapped for some other reason]
 
Once BGP goes down , it will not come up unless either local-address or default-address-selection is added on one end

 
 
 
 
 

Modification History

2026-07-13 : Article Created