Ad Home

BGP Juniper

Share:

 ###ASBR
set routing-options router-id 5.5.5.5
set routing-options autonomous-system 2345
set protocols bgp export ADVERTISE_ROUTES
set protocols bgp group eBGP type external
set protocols bgp group eBGP neighbor 192.168.56.6 peer-as 6
set protocols bgp group iBGP type internal
set protocols bgp group iBGP local-address 5.5.5.5
set protocols bgp group iBGP export ADVERTISE_ROUTES
set protocols bgp group iBGP export NHS
set protocols bgp group iBGP neighbor 7.7.7.7
set policy-options policy-statement ADVERTISE_ROUTES term 1 from protocol direct
set policy-options policy-statement ADVERTISE_ROUTES term 1 from route-filter 5.5.5.5/32 exact
set policy-options policy-statement ADVERTISE_ROUTES term 1 then accept
set policy-options policy-statement NHS term 1 from protocol bgp
set policy-options policy-statement NHS term 1 from route-type external
set policy-options policy-statement NHS term 1 then next-hop self


### eBGP
set routing-options router-id 1.1.1.1
set routing-options autonomous-system 1
set protocols bgp group eBGP type external
set protocols bgp group eBGP export ADVERTISE_ROUTES
set protocols bgp group eBGP peer-as 2345
set protocols bgp group eBGP neighbor 192.168.12.2
set protocols bgp group eBGP neighbor 192.168.13.3
set protocols lldp interface all
set policy-options policy-statement ADVERTISE_ROUTES term 1 from protocol direct
set policy-options policy-statement ADVERTISE_ROUTES term 1 from route-filter 1.1.1.1/32 exact
set policy-options policy-statement ADVERTISE_ROUTES term 1 then accept

### iBGP - Junos
1. mismo AS
2. no directamente conectado - ttl 255
3. NextHop not Change
4. AS no prepend
5. Split horizon - ruta aprendida por iBGP no se envia a iBGP

show route protocol bgp  - from 2.2.2.2 eso indica que es iBGP


vMXvCP-2:
cli
configure
set routing-options router-id 2.2.2.2
set routing-options autonomous-system 2345
set protocols bgp export ADVERTISE_ROUTES
set protocols bgp group eBGP type external
set protocols bgp group eBGP neighbor 192.168.12.1 peer-as 1
set protocols bgp group iBGP type internal
set protocols bgp group iBGP peer-as 2345
set protocols bgp group iBGP local-address 2.2.2.2
set protocols bgp group iBGP neighbor 3.3.3.3
set protocols bgp group iBGP neighbor 4.4.4.4
set protocols bgp group iBGP neighbor 5.5.5.5
#Publicar loopback
set policy-options policy-statement ADVERTISE_ROUTES term 1 from protocol direct
set policy-options policy-statement ADVERTISE_ROUTES term 1 from route-filter 2.2.2.2/32 exact
set policy-options policy-statement ADVERTISE_ROUTES term 1 then accept
#NextHop
set policy-options policy-statement NHS term 1 from protocol bgp
set policy-options policy-statement NHS term 1 from route-type external
set policy-options policy-statement NHS term 1 then next-hop self
set protocols bgp group iBGP export NHS
set protocols bgp group iBGP export ADVERTISE_ROUTES
set protocols bgp advertise-inactive
commit


###RR

Reglas  
    1. routes learned form eBGP -> can forward to anyone
    2. routes learned form iBGP -> can forward eBGP or Client
    3. if receive from you client -> RR -> you can forward to anyone

 
vMXvCP-RR:
set routing-options router-id 7.7.7.7
set routing-options autonomous-system 2345
set protocols bgp group iBGP local-address 7.7.7.7
set protocols bgp group iBGP cluster 7.7.7.7
set protocols bgp group iBGP peer-as 2345
set protocols bgp group iBGP neighbor 2.2.2.2
set protocols bgp group iBGP neighbor 3.3.3.3
set protocols bgp group iBGP neighbor 4.4.4.4
set protocols bgp group iBGP neighbor 5.5.5.5
set protocols bgp advertise-inactive

 

### BGP's path selection Juniper:

  1. Prefer the highest local-preference value. (100)

  2. Prefer the shortest AS-path length.

  3. Prefer the lowest origin value. (i)

  4. Prefer the lowest MED value. (0)

  5. Prefer routes learned from an EBGP peer over an IBGP peer.

  6. Prefer best exit from AS.

  7. For EBGP-received routes, prefer the current active route.

  8. Prefer routes from the peer with the lowest Router ID.

  9. Prefer paths with the shortest cluster length.

  10. Prefer routes from the peer with the lowest peer IP address. Steps 2, 6 and 12 are the RPD criteria.

 

### Origin code
#Juniper
I - iBGP - Default - significa que es aprendida por BGP (no por un iBGP como ospf)
? - Incomplete

#Cisco
Network - I
Redistribute - ?

 

### Local Preference

vMXvCP-6:
cli
configure
set protocols bgp group eBGP neighbor 192.168.56.5 import LP_FROM_R5
set policy-options policy-statement LP_FROM_R5 term 1 from protocol bgp
set policy-options policy-statement LP_FROM_R5 term 1 from route-filter 1.1.1.1/32 exact
set policy-options policy-statement LP_FROM_R5 term 1 from route-filter 2.2.2.2/32 exact
set policy-options policy-statement LP_FROM_R5 term 1 then local-preference 99
set protocols bgp group eBGP neighbor 192.168.46.4 import LP_FROM_R4
set policy-options policy-statement LP_FROM_R4 term 1 from protocol bgp
set policy-options policy-statement LP_FROM_R4 term 1 from route-filter 3.3.3.3/32 exact
set policy-options policy-statement LP_FROM_R4 term 1 then local-preference 99
commit


## AS-PATH
vMXvCP-6:
cli
configure
set protocols bgp group eBGP neighbor 192.168.56.5 import AS-PATH
set policy-options policy-statement AS-PATH term 1 from protocol bgp
set policy-options policy-statement AS-PATH term 1 from route-filter 1.1.1.1/32 exact
set policy-options policy-statement AS-PATH term 1 from route-filter 2.2.2.2/32 exact
set policy-options policy-statement AS-PATH term 1 then as-path-prepend "2345 2345 2345"
commit
vMXvCP-4:
cli
configure
set protocols bgp group eBGP neighbor 192.168.46.6 export AS-PATH
set protocols bgp group eBGP neighbor 192.168.46.6 export ADVERTISE_ROUTES
set policy-options policy-statement AS-PATH term 1 from protocol bgp
set policy-options policy-statement AS-PATH term 1 from route-filter 3.3.3.3/32 exact
set policy-options policy-statement AS-PATH term 1 then as-path-expand "2345 2345 2345"
commit

R5->R6
R5 como out - se ve el as-path en el neighbor R6
R6 como in - no se ve el as-path  

 

### AGGREGATE o SUMARIZACION
.1.2.3 -> .0/30

#lo que rechazo
set policy-options policy-statement REJECT_ROUTES term 1 from protocol bgp
set policy-options policy-statement REJECT_ROUTES term 1 from route-filter 1.1.1.1/32 exact
set policy-options policy-statement REJECT_ROUTES term 1 from route-filter 1.1.1.2/32 exact
set policy-options policy-statement REJECT_ROUTES term 1 from route-filter 1.1.1.3/32 exact
set policy-options policy-statement REJECT_ROUTES term 1 then reject
set protocols bgp group eBGP export ADVERTISE_ROUTES
set protocols bgp group eBGP export REJECT_ROUTES
#lo que sumarizo
set policy-options policy-statement SPECIFIC_ROUTES term 1 from protocol bgp
set policy-options policy-statement SPECIFIC_ROUTES term 1 from route-filter 1.1.1.1/32 exact
set policy-options policy-statement SPECIFIC_ROUTES term 1 from route-filter 1.1.1.2/32 exact
set policy-options policy-statement SPECIFIC_ROUTES term 1 from route-filter 1.1.1.3/32 exact
set policy-options policy-statement SPECIFIC_ROUTES term 1 then accept
set routing-options aggregate route 1.1.1.0/30 policy SPECIFIC_ROUTES
#Acepto la Sumarizacion en el export
set policy-options policy-statement AGGREGATE_ROUTE term 1 from protocol aggregate
set policy-options policy-statement AGGREGATE_ROUTE term 1 from route-filter 1.1.1.0/30 exact
set policy-options policy-statement AGGREGATE_ROUTE term 1 then accept
set protocols bgp group eBGP export AGGREGATE_ROUTE
commit 

 

## Regex Juniper
set policy-options policy-statement MATCH_ROUTES_AS_1 term 1 from protocol bgp
set policy-options policy-statement MATCH_ROUTES_AS_1 term 1 from as-path REGEX_AS_1
set policy-options policy-statement MATCH_ROUTES_AS_1 term 1 then accept
set policy-options policy-statement MATCH_ROUTES_AS_1 term 1 then local-preference 500
set policy-options as-path REGEX_AS_1 "2345 1$"
set protocols bgp group eBGP neighbor 192.168.56.5 import MATCH_ROUTES_AS_1
commit

#Understanding AS Path Regular Expressions for Use as Routing Policy Match Conditions
https://www.juniper.net/documentation/us/en/software/junos/routing-policy/topics/concept/policy-configuring-as-path-regular-expressions-to-use-as-routing-policy-match-conditions.html
 

No hay comentarios

COMENTA CON TU PERFIL DEFACEBOK

Ad Home