BGP uses TCP port 179.
Difference between eBGP and iBGP:
- eBGP have AD of 20 and iBGP have AD of 200.
- In eBGP nexthop get changed whereas in case of iBGP nexthop doesn’t changes.
- Route receieved from one eBGP peer is advertised to another peer (either iBGP or eBGP) where as route recevied by one iBGP is not forwared to another iBGP peer.
- By default TTL for eBGP peer is set to 1. In case if the eBGP peer are not directly connected we have to change this value.
- Idle: BGP starts from this state. BGP will initiate TCP three way handshake with BGP peer.
- Connect: In this state BGP is waiting for TCP three way handshake to complete. If three way handshake failes then BGP will move to active state. If three way handshake is complete then state will be changed to opensent.
- Active:BGP will try to initiate another TCP handshake. If three way handshake is successful then we will move to open sent state. If ConnectRetryTimer_Expires then BGP will fallback to connect state if something else goes wrong then BGP will go to Idle state.
- Open Sent: In this state BPG wait for open message from peer and once it receives open message it will check the parameters and if there are no error in the open message then it will send keepalive message and changes its state to open confirm. If there are errors in open sent message then a notification message is send and state is changed to idle.
- Open Confirm: In this state BGP waits for keepalive message from peer. If the keepalive message is received then the BGP state changes to established. If a notification message is received then state is changed to idle.
- Established:In the Established state, the BGP FSM can exchange UPDATE, NOTIFICATION, and KEEPALIVE messages with its peer.
- AS path
- Local Preference
BGP path selection:
- Highest weight: CISCO proprietary and is locally significant.
- Highest Local preference: Local preference is set while advertising the routes and the default value is 100. Local preference is significant only within an AS. Local preferecne is never advertised to an eBGP peer. Local preference is always advertised to iBGP peer. Local preference specifies how traffic exit out of you AS for specific destinstion.
- Origin: Locally originated route are preffered over redistributed routes.
- Shortest AS path: Route having shortest AS path are preffered.
- Lowest Origin code: IGP<EGP<redistributed.
- Lowest MED: MED is advertised to direclty connected eBGP peers and is used to influence how eBGP peer reach a prefix. MED is optional attribute and it is represented by metric in the routing table. MED specifices how traffic come to your AS for specific destination.
- Path: eBGP are preffered over iBGP.
- Router ID: Lowest router ID is preffered.
BGP attribute category:
BGP have following four category of attrbibutes:
- Well-known mandatory: Should be understood by every BGP implementation and should be passed in all BGP update message.
- Well-known discretionary: Should be understood by every BGP implementation and May or may not be present in all BGP update message.
- Optional transitive: May or may not be understood by BGP implementation. These attribute should be passed to BGP peer. If a peer doesn’t understand a transitive attribute then it must mark it as partial.
- Optional non-transitive. May or may not be understood by BGP implementation. These attribute should be not passed to BGP peer.
How to check weight of a BGP route?
show ip bgp