Junos OS

 View Only
last person joined: 21 hours ago 

Ask questions and share experiences about Junos OS.
  • 1.  Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-08-2024 19:56

    Hi all,

    I am fairly new to Juniper; I was brought up in the Cisco world so for the last few weeks have been doing a crash course learning the fundamentals of Junos.

    One thing I am still really struggling with is the equivalent of the following Cisco commands:

    router bgp 64000
    address-family ipv4 vrf CUST-A
    redistribute ospf 2

    In Cisco terms, this would allow you to go into BGP configuration, then configure a portion of it just for the routing instance names 'CUST-A' in the case, and redistribute any OSPF routes under that VRF.

    I'm trying to configure the equivalent of this setup: https://www.youtube.com/watch?v=9WUjfUVBbIA which is an MPLS BGP/OSPF topology to support multiple potential customers which may have overlapping private address ranges.

    Please forgive me if I'm missing something basic, my brain feels like it is melting from how much I'm taking in at the moment!

    I have already done quite a bit of digging and have concluded there doesn't appear to be an equivalent 'redistribute' command in BGP. I'm wondering if the only way is configuring policy statements, but I still can't seem to figure out a way to apply these to the main BGP instance.to allow the VRF to learn the OSPF routes. 

    Would appreciate any assistance. Please also let me know if I've not been clear enough with what I'm asking.



    ------------------------------
    Tom Russell
    ------------------------------


  • 2.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-09-2024 02:34

    Hi Tom,

    If you want to distribute ospf in to  a vrf you need polices.
    Here is one way to do it:

    set routing-instances VRF-A vrf-import VRF-A_IMPORT
    set routing-instances VRF-A vrf-export VRF-A_EXPORT
    set policy-options policy-statement VRF-A_IMPORT term 1 from protocol bgp
    set policy-options policy-statement VRF-A_IMPORT term 1 from community VRF-A-TARGET
    set policy-options policy-statement VRF-A_IMPORT term 1 then accept
     
    set policy-options policy-statement VRF-A_EXPORT term 1 from protocol ospf
    set policy-options policy-statement VRF-A_EXPORT term 1 then community add VRF-A-TARGET
    set policy-options policy-statement VRF-A_EXPORT term 1 then accept
     
    set policy-options community VRF-A-TARGET members target:64500:100  



    ------------------------------
    Kalle Andersson
    ------------------------------



  • 3.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-10-2024 05:50

    Hi Kalle,

    Thanks for this. I'm trying to do this in a lab but feel like I'm still missing something. Would appreciate if you could guide me where I'm going wrong.

    I've tried to simplify it so instead of trying to redistribute OSPF, I'm just trying to get each router to learn each pther's VRF-specific loopback address by trying to export the 'direct' connection.

    Here is the relevant configuration I have done:

    Router A:

    set interfaces xe-0/0/0 unit 0 family inet address 10.0.12.2/24
    set interfaces lo0 unit 0 family inet address 192.168.0.2/32
    set interfaces lo0 unit 1 family inet address 2.2.2.2/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 1:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set protocols bgp group peers type internal
    set protocols bgp group peers local-address 192.168.0.2
    set protocols bgp group peers import vrf-a-in
    set protocols bgp group peers export vrf-a-out
    set protocols bgp group peers neighbor 192.168.0.1
    set protocols bgp local-as 64000
    set protocols ospf area 0.0.0.0 interface all
    set protocols ospf area 0.0.0.0 interface em0.0 disable
    set protocols ospf area 0.0.0.0 interface lo0.0 passive

    Router B:

    set interfaces ge-0/0/0 unit 0 family inet address 10.0.12.1/24
    set interfaces lo0 unit 0 family inet address 192.168.0.1/32
    set interfaces lo0 unit 1 family inet address 1.1.1.1/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 1:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set routing-options static route 0.0.0.0/0 next-hop 100.123.0.1
    set protocols ospf area 0.0.0.0 interface all
    set protocols ospf area 0.0.0.0 interface fxp0.0 disable
    set protocols ospf area 0.0.0.0 interface lo0.0 passive
    set protocols bgp group peers type internal
    set protocols bgp group peers local-address 192.168.0.1
    set protocols bgp group peers import vrf-a-in
    set protocols bgp group peers export vrf-a-out
    set protocols bgp group peers neighbor 192.168.0.2
    set protocols bgp local-as 64000

    I'm wanting router B's VRF table to show a route to 1.1.1.1. I'm just missing the bit I need to get it to send across BGP. Would appreciate pointers. Have tried setting the 'export' and 'import' commands there but it doesn't seem to have helped.

    I feel like once I've cracked this point, everything else should fall into place.



    ------------------------------
    Tom RussellTom Russell
    ------------------------------



  • 4.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-10-2024 05:50

    Note: reposting as my original reply seemed to get eaten by the forum, never to be seen again. Apologies if there ends up being a duplicate at some point as a result

    Hi Kalle,

    Thanks for this. I've tried what you suggested in an online lab but seem to be missing something.

    I tried simplifying what I was trying to do, by just trying to get the VRF tables of routers A and B to learn each other's VRF-specific loopback addresses. Below is the relevant config so far:

    Router A:

    set interfaces ge-0/0/0 unit 0 family inet address 10.0.12.1/24
    set interfaces lo0 unit 0 family inet address 192.168.0.1/32
    set interfaces lo0 unit 1 family inet address 1.1.1.1/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 1:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set routing-options static route 0.0.0.0/0 next-hop 100.123.0.1
    set protocols ospf area 0.0.0.0 interface all
    set protocols ospf area 0.0.0.0 interface fxp0.0 disable
    set protocols ospf area 0.0.0.0 interface lo0.0 passive
    set protocols bgp group peers type internal
    set protocols bgp group peers local-address 192.168.0.1
    set protocols bgp group peers import vrf-a-in
    set protocols bgp group peers export vrf-a-out
    set protocols bgp group peers neighbor 192.168.0.2
    set protocols bgp local-as 64000

    Router B:

    set interfaces xe-0/0/0 unit 0 family inet address 10.0.12.2/24
    set interfaces lo0 unit 0 family inet address 192.168.0.2/32
    set interfaces lo0 unit 1 family inet address 2.2.2.2/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 1:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set protocols bgp group peers type internal
    set protocols bgp group peers local-address 192.168.0.2
    set protocols bgp group peers import vrf-a-in
    set protocols bgp group peers export vrf-a-out
    set protocols bgp group peers neighbor 192.168.0.1
    set protocols bgp local-as 64000
    set protocols ospf area 0.0.0.0 interface all
    set protocols ospf area 0.0.0.0 interface em0.0 disable
    set protocols ospf area 0.0.0.0 interface lo0.0 passive

    What I'm trying to do is get 2.2.2.2 to show up in router A's VRF table, and 1.1.1.1 in router B's respective table. I feel like I'm missing something with the BGP config.

    To reference the equivalent topology I'm trying to ultimately recreate here again: Configuring an MPLS Network from Scratch

    Ignore the MPLS part of that video; I feel it's just the BGP that's causing all my pain.



    ------------------------------
    Tom
    ------------------------------



  • 5.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-10-2024 06:06

    Hi Tom,

    To only redistribute lo0, the config should look as following, I assume that the MPLS part is working.
    You had same RD on both routers, it's not correct.
    Every router need an unique RD, if same the routes will not be install in routing table.

     
    router A:
    set interfaces lo0 unit 1 family inet address 2.2.2.2/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 192.168.0.2:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set routing-instances vrf-a vrf-table-label
    router B:
     
    set interfaces lo0 unit 1 family inet address 1.1.1.1/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 192.168.0.1:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set routing-instances vrf-a vrf-table-label



    ------------------------------
    Kalle Andersson
    ------------------------------



  • 6.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-10-2024 07:09

    Ahh okay, doing it with Cisco you can use the same rd on both routers without issue so that's probably where I was going wrong. Will test with another lab later on and let you know how it goes.

    Many thanks



    ------------------------------
    Tom Russell
    ------------------------------



  • 7.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-10-2024 07:11

    Hi
    Maybe I have wrong about RD.
    Don't forget this command:

    set routing-instances vrf-a vrf-table-label



    ------------------------------
    Kalle Andersson
    ------------------------------



  • 8.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-10-2024 12:16

    I'm getting closer; after adding the 'vrf-table-label' and making each route distinguisher unique, I'm now seeing the routes showing up in the routing tables of each. However, they are showing as hidden"

    bgp.l3vpn.0: 1 destinations, 1 routes (0 active, 0 holddown, 1 hidden)
    + = Active Route, - = Last Active, * = Both

    1.1.1.1:1:1.1.1.1/32                
                        [BGP/170] 00:13:35, localpref 100, from 192.168.0.1
                          AS path: I, validation-state: unverified
                           Unusable

    What else could I be missing...

    For reference, here is the config from router A (router B is effectively the same so will only include A)

    set interfaces ge-0/0/0 unit 0 family inet address 10.0.12.1/24
    set interfaces lo0 unit 0 family inet address 192.168.0.1/32
    set interfaces lo0 unit 1 family inet address 1.1.1.1/32
    set policy-options policy-statement vrf-a-in term 1 from protocol bgp
    set policy-options policy-statement vrf-a-in term 1 from community vrf-a-target
    set policy-options policy-statement vrf-a-in term 1 then accept
    set policy-options policy-statement vrf-a-out term 1 from protocol direct
    set policy-options policy-statement vrf-a-out term 1 then community add vrf-a-target
    set policy-options policy-statement vrf-a-out term 1 then accept
    set policy-options community vrf-a-target members target:1:1
    set routing-instances vrf-a instance-type vrf
    set routing-instances vrf-a interface lo0.1
    set routing-instances vrf-a route-distinguisher 1.1.1.1:1
    set routing-instances vrf-a vrf-import vrf-a-in
    set routing-instances vrf-a vrf-export vrf-a-out
    set routing-instances vrf-a vrf-target import target:1:1
    set routing-instances vrf-a vrf-target export target:1:1
    set routing-instances vrf-a vrf-table-label
    set protocols ospf area 0.0.0.0 interface all
    set protocols ospf area 0.0.0.0 interface fxp0.0 disable
    set protocols ospf area 0.0.0.0 interface lo0.0 passive
    set protocols bgp family inet-vpn unicast
    set protocols bgp group peers type internal
    set protocols bgp group peers local-address 192.168.0.1
    set protocols bgp group peers import vrf-a-in
    set protocols bgp group peers export vrf-a-out
    set protocols bgp group peers neighbor 192.168.0.2
    set protocols bgp local-as 64000
    set protocols mpls interface all

    Router B's route distinguisher is now 2.2.2.2:1. I could be missing something really simple... Do the route targets on each router need to be unique too? I don't feel like that's what it is though.



    ------------------------------
    Tom Russell
    ------------------------------



  • 9.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands
    Best Answer

    Posted 04-11-2024 01:04

    Hi Tom,
    To get a hint what is missing is always good to do "show route 1.1.1.1 extensive hidden"

    root@router2# run show route 1.1.1.1 extensive hidden 
     
    vrf-a.inet.0: 2 destinations, 2 routes (1 active, 0 holddown, 1 hidden)
    1.1.1.1/32 (1 entry, 0 announced)
             BGP    Preference: 170/-101
                    Route Distinguisher: 192.168.0.1:1
                    Next hop type: Unusable, Next hop index: 0
                    Address: 0x77c55f4
                    Next-hop reference count: 2
                    Kernel Table Id: 0
                    Source: 192.168.0.1
                    State: <Secondary Hidden Int Ext Changed ProtectionCand>
                    Peer AS: 64000
                    Age: 1:22 
                    Validation State: unverified 
                    Task: BGP_64000_64000.192.168.0.1
                    AS path: I 
                    Communities: target:1:1
                    Import Accepted
                    VPN Label: 16
                    Localpref: 100
                    Router ID: 192.168.0.1
                    Primary Routing Table: bgp.l3vpn.0
                    Thread: junos-main 
                    Indirect next hops: 1   
                            Protocol next hop: 192.168.0.1 ResolvState: PnhUnresolv
                            Label operation: Push 16
                            Label TTL action: prop-ttl
                            Load balance label: Label 16: None; 
                            Indirect next hop: 0x0 - INH Session ID: 0
     
    [edit]
    root@router2# 

    In this case next-hop is unusable, the reason for this is that two thing are missing:
    A mpls control protocol and allow mpls traffic to use ge-0/0/0
    set protocols ldp interface ge-0/0/0 
    set interfaces ge-0/0/0 unit 0 family mpls 
    Remove also:

    delete protocols bgp group peers import vrf-a-in
    delete protocols bgp group peers export vrf-a-out

    After the commit of new config:

    root@router2# show route 1.1.1.1                     
     
    vrf-a.inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
    + = Active Route, - = Last Active, * = Both
     
    1.1.1.1/32         *[BGP/170] 00:00:13, localpref 100, from 192.168.0.1
                          AS path: I, validation-state: unverified
                        >  to 10.0.12.1 via ge-0/0/0.0, Push 16

    root@router2# ping 1.1.1.1 source 2.2.2.2 routing-instance vrf-a 
    PING 1.1.1.1 (1.1.1.1): 56 data bytes
    64 bytes from 1.1.1.1: icmp_seq=0 ttl=64 time=2.724 ms
    64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=2.555 ms





    ------------------------------
    Kalle Andersson
    ------------------------------



  • 10.  RE: Equivalent Junos commands to Cisco BGP VRF redistribute commands

    Posted 04-13-2024 12:39
    Edited by Tom Russell 04-13-2024 12:42

    Edit: thought I had it, but not quite. Will post config code once confirmed working.