Neighbours with the lowest BGP router identifier will establish the connection to the remote peer via TCP port 179, the source port will be random. We can modify this behaviour with a few simple commands.

For example we want R1 to be a passive peer. That means that R2 and R3 will actively look to establish the session.



So from R1 if we leave everything as default then we can work out that R1 it the lowest router identifier, courtesy of a loop-back interface which is So it will look to actively establish the connection with any configured peers.

R1#sh ip bgp summary
BGP router identifier, local AS number 500

We can verify this with the following command.

R1#sh ip bgp neighbors | i host
Local host:, Local port: 57717
Foreign host:, Foreign port: 179
Local host:, Local port: 63542
Foreign host:, Foreign port: 179

Lets modify this behaviour, use the commands.

router bgp 500
 neighbor transport connection-mode passive
 neighbor transport connection-mode passive

Then clear the BGP session with clear ip bgp *

Now use the same command as before.

R1#sh ip bgp neighbors | i host
Local host:, Local port: 179
Foreign host:, Foreign port: 34121
Local host:, Local port: 179
Foreign host:, Foreign port: 32711

This shows us that foreign host has established the bgp connection sourcing from random port to port 179 on our local router.

RFC4271 which is the holy grail for BGP-4 states that.

When a BGP speaker is configured as active,
it may end up on either the active or passive side of the connection
that eventually gets established.  Once the TCP connection is
completed, it doesn’t matter which end was active and which was passive.
The only difference is in which side of the TCP connection has port number 179.

There exists a period in which the identity of the peer on the other
end of an incoming connection is known, but the BGP identifier is not
known.  During this time, both an incoming and outgoing connection
may exist for the same configured peering.  This is referred to as a
connection collision.