# BGP ( iBGP or eBGP; How to decide? )

**URL:** <https://forum.networklessons.com/t/bgp-ibgp-or-ebgp-how-to-decide/2237>\
**Category:** BGP\
**Created:** [October 2, 2017, 2:26am UTC](https://forum.networklessons.com/t/bgp-ibgp-or-ebgp-how-to-decide/2237 "2017-10-02T02:26:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebeccast999](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/r/dec6dc/32.png) [@rebeccast999](https://forum.networklessons.com/u/rebeccast999)\
**Post date:** [October 2, 2017, 2:26am UTC](https://forum.networklessons.com/t/bgp-ibgp-or-ebgp-how-to-decide/2237/1 "2017-10-02T02:26:20Z")

</div>

My question is as below:

How does the BGP decides whether to use eBGP or iBGP?  
Can you list the parameters that it uses to make the above decision.

@andrew  
@ReneMolenaar  
@lagapidis

Thanks in advance.

Best Regards.

---

<div class="post-metadata">

**Author:** ![andrew](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/andrew/32/645_2.png) [@andrew](https://forum.networklessons.com/u/andrew)\
**Post date:** [October 2, 2017, 2:56pm UTC](https://forum.networklessons.com/t/bgp-ibgp-or-ebgp-how-to-decide/2237/2 "2017-10-02T14:56:58Z")

</div>

Hi Rebecca  
This all depends on whether the two BGP speakers are in the same ASN (autonomous system number). If they are, iBGP is used. If they are not, eBGP is used.

---

<div class="post-metadata">

**Author:** ![adriantaranu11](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@adriantaranu11](https://forum.networklessons.com/u/adriantaranu11)\
**Post date:** [October 6, 2017, 10:38am UTC](https://forum.networklessons.com/t/bgp-ibgp-or-ebgp-how-to-decide/2237/3 "2017-10-06T10:38:46Z")

</div>

Hi Rebecca,  
I’ll add a config to illustrate what Andrew already told above. Explanations are given after “//” :

* * *

```
Router R1 
---
router bgp 100 // R1 is in AS100
  neighbor 10.10.10.1 remote-as 100 //remote peer is declared in AS100 -> R1 will have an iBGP session with this peer
  neighbor 20.20.20.2 remote-as 200 //remote peer is declared in AS200 -> R1 will have an eBGP session with this peer
[...]
!

```
