BGP · Topic 1 of 5
BGP Operation and NLRI Families
JN0-650 study page on BGP operation on Junos: TCP session, message types, states, IBGP and EBGP rules, route reflection and the inet and inet6 families.
- 5 min
- BGP is a path vector protocol over TCP port 179.
- Message types: OPEN, UPDATE, KEEPALIVE, NOTIFICATION, and ROUTE-REFRESH.
- States: Idle, Connect, Active, OpenSent, OpenConfirm, Established.
What it is
BGP is a path vector protocol. It carries prefixes together with attributes such as the AS path, and routers choose paths by policy and attributes, not by a simple metric. It runs over TCP port 179, so a session needs working IP reachability between the two peers.
EBGP runs between different autonomous systems. IBGP runs inside one AS and carries external routes across it. Multiprotocol BGP lets one session carry routes for several address families, each one an NLRI family.
How it works
Messages and states
| Message | Purpose |
|---|---|
| OPEN | Starts the session; carries AS number, hold time, router ID and capabilities |
| UPDATE | Advertises new routes with attributes and withdraws old ones |
| KEEPALIVE | Keeps the session up; also confirms the OPEN |
| NOTIFICATION | Reports an error and closes the session |
| ROUTE-REFRESH | Asks a peer to resend its routes without resetting the session |
The states are Idle, Connect, Active, OpenSent, OpenConfirm and Established. Only Established exchanges routes. The hold time is negotiated to the lower of the two values and keepalives go at one third of it. The Junos default hold time is 90 seconds, so keepalives go every 30.
Active does not mean the session works. In BGP, Active means the router is still trying to open the TCP connection and has not succeeded.
IBGP versus EBGP rules
| Rule | EBGP | IBGP |
|---|---|---|
| Peers in | Different ASs | The same AS |
| Typical peering address | Directly connected interface | Loopback, over the IGP |
| AS path | Local AS prepended when advertising | Not changed |
| Next hop | Changed to the sender | Not changed by default |
| Local preference | Not sent | Sent |
| Re-advertising | To everyone | A route learned from IBGP is not sent to another IBGP peer |
The last rule exists because IBGP has no AS path loop detection inside an AS. It means you need a full mesh of IBGP sessions, or route reflectors or confederations to avoid one. Both are covered later in this chapter.
Basic configuration
set routing-options autonomous-system 65001
set protocols bgp group EXT type external
set protocols bgp group EXT peer-as 65002
set protocols bgp group EXT neighbor 192.0.2.2
set protocols bgp group INT type internal
set protocols bgp group INT local-address 10.255.0.1
set protocols bgp group INT neighbor 10.255.0.2
The IBGP group peers loopback to loopback, so local-address makes the session source from the loopback and the IGP must provide the route to the peer. An EBGP session accepts packets with a TTL of 1 by default, so it expects a directly connected peer.
NLRI families
Network layer reachability information (NLRI) is the prefix being advertised. Multiprotocol extensions (the MP_REACH_NLRI and MP_UNREACH_NLRI attributes) let BGP carry IPv6 and other families, and the families are agreed during the OPEN through capabilities.
| Family statement | Carries | Routing table |
|---|---|---|
family inet unicast | IPv4 unicast | inet.0 |
family inet6 unicast | IPv6 unicast | inet6.0 |
family inet multicast | IPv4 routes for multicast RPF | inet.2 |
family evpn signaling | EVPN routes | bgp.evpn.0 |
set protocols bgp group EXT family inet unicast
set protocols bgp group EXT family inet6 unicast
If you configure no family statement, a Junos session carries IPv4 unicast only. Once you configure any family, only the families you list are negotiated, so list every family you want. Both peers must negotiate a family for it to work.
IPv6 prefixes can ride over an IPv4 session, and IPv4 prefixes over an IPv6 session. In that case the next hop must be usable for the other protocol. Junos uses an IPv4-mapped IPv6 next hop for IPv6 routes advertised over an IPv4 session, so the router that receives them needs a way to forward toward that mapped address.
A session that is Established but receives no IPv6 prefixes almost always lacks family inet6 unicast on one side. show bgp neighbor lists the NLRI that was negotiated.
Route reflectors and confederations in one line
A route reflector (RR) is an IBGP router allowed to reflect routes between its clients and non-clients. A confederation splits one AS into sub-ASs that run EBGP between them while the outside world sees one AS. Both remove the IBGP full mesh; details are on the options page.
Common mistakes
Expecting IBGP to re-advertise IBGP routes. It does not; use a route reflector or a full mesh.
Using interface addresses for IBGP. The session then dies when that link does. Use loopbacks.
Forgetting peer-as on an external group. The session cannot validate the neighbor.
Reading Active as good. It means the TCP connection is failing.
Configuring family inet6 on one side only. The session comes up but the family is not negotiated.
What to remember for the exam
- BGP is a path vector protocol over TCP port 179.
- Message types: OPEN, UPDATE, KEEPALIVE, NOTIFICATION, and ROUTE-REFRESH.
- States: Idle, Connect, Active, OpenSent, OpenConfirm, Established.
- Junos defaults: hold time 90 seconds, keepalive one third of it.
- IBGP does not re-advertise IBGP routes; EBGP changes the next hop, IBGP does not.
- Without a
familystatement a session carries IPv4 unicast only; configured families must match on both peers. - Families are negotiated in the OPEN message through multiprotocol capabilities.
Check yourself
Why does IBGP need a full mesh, route reflectors or confederations?
A route learned from one IBGP peer is not advertised to another IBGP peer, so every router would otherwise miss routes.
A session is Established but no IPv6 routes arrive. What is the first thing to check?
Whether
family inet6 unicastis configured and negotiated on both peers.What does the BGP state Active tell you?
The router is trying to establish the TCP connection and has not succeeded yet.
Topic 1 of 5 in BGP
Test yourself on BGP
The full Juniper JNCIP-ENT JN0-650 question bank has 858 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.