BGP · Topic 3 of 4
Configuring BGP Groups, Peers and Options
Configure and verify Junos BGP groups and peers, the AS number, local address, multihop, authentication, passive, remove-private and multipath options.
- 6 min
- Configure
routing-options autonomous-systemfirst, thenprotocols bgp groupwithtype,peer-asandneighbor. - Group settings are inherited by neighbors; the neighbor level overrides the group.
local-addressis for the loopback source;multihopraises the EBGP TTL.
What it is
On Junos, BGP is configured under [edit protocols bgp]. Peers are placed in groups, and each group has a type: internal for IBGP or external for EBGP. Settings made at the group level apply to every neighbor in it, and a neighbor can override a setting for itself.
Before any session can form, the router needs its own autonomous system number under [edit routing-options]. Without it the BGP configuration commits but no session starts.
How it works
Basic EBGP configuration
user@router# set routing-options autonomous-system 65001
user@router# set protocols bgp group ISP type external
user@router# set protocols bgp group ISP peer-as 65002
user@router# set protocols bgp group ISP neighbor 192.0.2.2
user@router# commit
The same in hierarchy form:
routing-options {
autonomous-system 65001;
}
protocols {
bgp {
group ISP {
type external;
peer-as 65002;
neighbor 192.0.2.2;
}
}
}
An external group needs peer-as, either on the group or on the neighbor. An internal group does not, because the peer AS is your own.
Basic IBGP configuration
user@router# set protocols bgp group CORE type internal
user@router# set protocols bgp group CORE local-address 10.255.0.1
user@router# set protocols bgp group CORE neighbor 10.255.0.2
user@router# set protocols bgp group CORE neighbor 10.255.0.3
local-address makes the router source the session from its loopback. The neighbor must have the matching configuration pointing back to this loopback.
Group and neighbor levels
Statements can sit at three levels. The most specific level wins.
| Level | Hierarchy | Applies to |
|---|---|---|
| Global | [edit protocols bgp] | All groups and peers |
| Group | [edit protocols bgp group name] | All neighbors in the group |
| Neighbor | [edit protocols bgp group name neighbor address] | That one peer |
Put peers with the same role and policy in one group. A group of upstream providers and a group of internal peers will have different types and policies.
Common options
| Option | Effect |
|---|---|
local-address | Source address of the session, normally a loopback for IBGP |
multihop | Allows EBGP to a peer that is not directly connected by raising the TTL |
authentication-key | Uses TCP MD5 authentication; the key must match on both peers |
hold-time | Changes the hold time requested in the Open message (default 90 seconds) |
passive | The router does not start the TCP connection and only waits for the peer |
local-as | Presents a different AS number to this peer, useful during an AS migration |
remove-private | Removes private AS numbers from the AS path in advertisements |
as-override | Replaces the peer's AS in the AS path with your own, for sites sharing one AS number |
multipath | Allows several equal paths to be used for load sharing |
damping | Penalizes routes that flap |
bfd-liveness-detection | Adds fast failure detection to the session |
A few of these have exam traps. passive on both sides means neither side starts TCP, so the session never forms. A mismatched authentication-key means the TCP segments are rejected, and the session stays in Connect or Active with no useful message.
user@router# set protocols bgp group ISP authentication-key "s3cret"
user@router# set protocols bgp group ISP remove-private
user@router# set protocols bgp group ISP multipath
Monitoring peers
Start with the summary, then go to the neighbor detail.
user@router> show bgp summary
Groups: 1 Peers: 1 Down peers: 0
Table Tot Paths Act Paths Suppressed History Damp State Pending
inet.0 3 2 0 0 0 0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
192.0.2.2 65002 120 118 0 0 0:49:10 2/3/3/0
The numbers at the end are active, received, accepted and damped routes. Received minus accepted tells you how many routes an import policy rejected.
user@router> show bgp neighbor 192.0.2.2
Peer: 192.0.2.2+179 AS 65002 Local: 192.0.2.1+51234 AS 65001
Type: External State: Established
Last State: OpenConfirm Last Event: RecvKeepAlive
Last Error: None
Holdtime: 90 Preference: 170
show bgp neighbor shows the state, the last state and event, the last error from a Notification, the hold time and the options in use.
Troubleshooting a peer that will not establish
Work through the causes in order.
| Symptom | Likely cause | Check |
|---|---|---|
| Stuck in Idle | Configuration error, no AS number, or an Open error that keeps recurring | show bgp neighbor, show configuration routing-options |
| Active or Connect | No route to the peer, wrong neighbor address, a filter blocking TCP 179, or authentication mismatch | ping, show route, firewall filters |
| Flaps between Active and Established | Hold time expiry, unstable link, IGP flaps for an IBGP peer | show bgp neighbor, show log messages |
| Established but 0 routes | Missing import or export policy at one side | show route receive-protocol bgp, show route advertising-protocol bgp |
To restart a session on purpose, use clear bgp neighbor 192.0.2.2. To ask for the routes again without a reset, use clear bgp neighbor 192.0.2.2 soft-inbound.
Common mistakes
Missing autonomous-system. A group can be committed without it, but the session cannot start.
Wrong peer-as. The Open message check fails, and the session does not leave Active or Idle.
IBGP on loopbacks without local-address. The neighbor sees packets from an unexpected source address and refuses them.
A mismatched MD5 key gives no clear error on the CLI. If everything else looks right and the peer stays in Active or Connect, check authentication-key on both sides.
What to remember for the exam
- Configure
routing-options autonomous-systemfirst, thenprotocols bgp groupwithtype,peer-asandneighbor. - Group settings are inherited by neighbors; the neighbor level overrides the group.
local-addressis for the loopback source;multihopraises the EBGP TTL.passiveon one side only is valid; on both sides no session forms.remove-private,as-override,local-asandmultipathare the commonly tested options.show bgp summaryfor state and route counts;show bgp neighborfor errors and timers.clear bgp neighborresets a session;soft-inboundasks for the routes again without a reset.
Check yourself
A new BGP group commits but no session starts. Which basic setting is easy to miss?
The router's own autonomous system number under
routing-options.What does
local-addressdo for an IBGP group?It makes the router use that address, normally a loopback, as the source of the session so the neighbor accepts it.
What do the four numbers at the end of a
show bgp summaryline mean?Active, received, accepted and damped routes for that peer.
Topic 3 of 4 in BGP
Test yourself on BGP
The full Juniper JNCIS-ENT JN0-352 question bank has 846 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.