BGP Operations on Junos
Table of Contents
load merge terminal#
The purpose is to copy set commands from one device and paste them on another one to reduce manual configuration time.
I created a BGP group named dcoverlay-IBGP on device A. I tried to copy/merge it on device B. Deice B threw an error:
root@spine2# load merge terminal
[Type ^D at a new line to end input]
set protocols bgp group dcoverlay-IBGP type internal
terminal:1:(3) syntax error: set
[edit]
'set protocols bgp group dcoverlay-IBGP type internal'
syntax error
^C[abort]
I verified that the command was syntaxically correct by entering it manually:
[edit]
root@spine2# set protocols bgp group dcoverlay-IBGP type internal
[edit]
root@spine2#
[edit]
root@spine2# commit check
[edit protocols]
'bgp'
warning: requires 'BGP' license
configuration check succeeds
[edit]
root@spine2#
I thought that the hyphen character in variable names might not always be supported in copy/merge operations. I therefore renamed the BGP group in device A to avoid the hyphen completely:
root@spine1# rename group dcoverlay-IBGP to group dcoverlayIBGP
[edit protocols bgp]
root@spine1# show | compare
[edit protocols bgp]
group DCinfraUnderlayEBGPgrp { ... }
+ group dcoverlayIBGP {
+ type internal;
+ local-address 192.168.100.1;
+ cluster 10.1.1.1;
+ local-as 64665;
+ neighbor 192.168.100.2 {
+ peer-as 64665;
+ }
+ neighbor 192.168.100.11 {
+ peer-as 64665;
+ }
+ neighbor 192.168.100.12 {
+ peer-as 64665;
+ }
+ neighbor 192.168.100.13 {
+ peer-as 64665;
+ }
+ }
- group dcoverlay-IBGP {
- type internal;
- local-address 192.168.100.1;
- cluster 10.1.1.1;
- local-as 64665;
- neighbor 192.168.100.2 {
- peer-as 64665;
- }
- neighbor 192.168.100.11 {
- peer-as 64665;
- }
- neighbor 192.168.100.12 {
- peer-as 64665;
- }
- neighbor 192.168.100.13 {
- peer-as 64665;
- }
- }
[edit protocols bgp]
root@spine1# commit check
[edit protocols]
'bgp'
warning: requires 'BGP' license
configuration check succeeds
[edit protocols bgp]
root@spine1#
I reinitated the load merge terminal but still got an error:
root@spine2# load merge terminal
[Type ^D at a new line to end input]
set protocols bgp group dcoverlayIBGP type internal
set protocols bgp group dcoverlayIBGP local-address 192.168.100.1
set protocols bgp group dcoverlayIBGP cluster 10.1.1.1
set protocols bgp group dcoverlayIBGP local-as 64665
set protocols bgp group dcoverlayIBGP neighbor 192.168.100.2 peer-as 64665
set protocols bgp group dcoverlayIBGP neighbor 192.168.100.11 peer-as 64665
set protocols bgp group dcoverlayIBGP neighbor 192.168.100.12 peer-as 64665
set protocols bgp group dcoverlayIBGP neighbor 192.168.100.13 peer-as 6terminal:1:(3) syntax error: set
[edit]
'set protocols bgp group dcoverlayIBGP type internal'
syntax error
^C[abort]
So I thought maybe my logic was completely wrong. I decided to copy config blocks this time, not the set commands. It worked:
group dcoverlayIBGP {
type internal;
local-address 192.168.100.1;
cluster 10.1.1.1;
local-as 64665;
neighbor 192.168.100.2 {
peer-as 64665;
}
neighbor 192.168.100.11 {
peer-as 64665;
}
neighbor 192.168.100.12 {
peer-as 64665;
}
neighbor 192.168.100.13 {
peer-as 64665;
}
}
root@spine2# edit protocols bgp
[edit protocols bgp]
root@spine2# load merge terminal relative
[Type ^D at a new line to end input]
group dcoverlayIBGP {
type internal;
local-address 192.168.100.1;
cluster 10.1.1.1;
local-as 64665;
neighbor 192.168.100.2 {
peer-as 64665;
}
neighbor 192.168.100.11 {
peer-as 64665;
}
neighbor 192.168.100.12 {
peer-as 64665;
}
neighbor 192.168.100.13 {
peer-as 64665;
}
}
load complete
[edit protocols bgp]
root@spine2# commit check
[edit protocols]
'bgp'
warning: requires 'BGP' license
configuration check succeeds
[edit protocols bgp]
root@spine2#
AS_PATH PREPEND#
BGP ASN lab#
R1-AS17 <—> R2-AS22
R1-AS17 <—> R4-AS22
WAN Subnets:
R1:.1 <- 10.10.10.0/30 -> R2: .2
R1:.9 <- 10.10.10.8/30 -> R4: .10
LAN Subnets:
R1: .69 <- 172.17.99.0 -> LAN1
Purpose:
When R1 advertises the network 172.17.99.0 in BGP, R2 and R4 receive the route with the default AS_PATH attribute value, which is the ASN of R1. I want to make the 172.17.99.0 route received by R2 and R4 a bit ‘unattractive’, by making R1 send it with a longer AS_PATH attribute value. Since the AS_PATH attribute is a BGP non-transitive attribute, this modification will only impact the AS that are immediate neighbors of R1’s AS.
Sample Configuration#
root@R1# show policy-options policy-statement PREPEND-EXPORT
term 1 {
from {
protocol direct;
route-filter 1.1.1.1/32 exact;
}
then {
as-path-prepend "17 17 17";
accept;
}
}
term 2 {
from {
protocol direct;
route-filter 172.17.99.0/24 exact;
}
then {
as-path-prepend "17 17 17";
accept;
}
}
[edit]
root@R1#
[edit]
root@R1# show protocols bgp
group extGrp-79 {
type external;
export DirectroutesAccept;
peer-as 79;
neighbor 10.10.7.2;
}
group extGrp-22 {
type external;
import ModifyBGPattr;
export [ PREPEND-EXPORT LAN172.17.99 ];
peer-as 22;
neighbor 10.10.10.2;
neighbor 10.10.10.10;
}
[edit]
root@R1#
Verification#
root@R4> show route 172.17.99
inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
172.17.99.0/24 *[BGP/170] 00:00:00, localpref 100
AS path: 17 17 17 17 I, validation-state: unverified
> to 10.10.10.9 via ge-0/0/1.0
root@R4>
iBGP EVPN as overlay for a DC architecture#
#TBC