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
In a nutshell
  • 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.

TCP 179 opensOPENCapabilities agreedKEEPALIVEEstablishedUPDATEPrefixes and attributes exchanged

How it works

Messages and states

MessagePurpose
OPENStarts the session; carries AS number, hold time, router ID and capabilities
UPDATEAdvertises new routes with attributes and withdraws old ones
KEEPALIVEKeeps the session up; also confirms the OPEN
NOTIFICATIONReports an error and closes the session
ROUTE-REFRESHAsks 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.

Watch out

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

RuleEBGPIBGP
Peers inDifferent ASsThe same AS
Typical peering addressDirectly connected interfaceLoopback, over the IGP
AS pathLocal AS prepended when advertisingNot changed
Next hopChanged to the senderNot changed by default
Local preferenceNot sentSent
Re-advertisingTo everyoneA 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 statementCarriesRouting table
family inet unicastIPv4 unicastinet.0
family inet6 unicastIPv6 unicastinet6.0
family inet multicastIPv4 routes for multicast RPFinet.2
family evpn signalingEVPN routesbgp.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.

Exam tip

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.

Groupfamily inet6 unicastOPEN capabilityPeerSame family offerednegotiatedbgp inet6 tableRoutes appear in inet6.0

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 family statement 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 unicast is 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.