Routing

 View Only
last person joined: 11 hours ago 

Ask questions and share experiences about ACX Series, CTP Series, MX Series, PTX Series, SSR Series, JRR Series, and all things routing, including portfolios and protocols.
  • 1.  Filtering OSPF routes into BGP

    Posted 08-09-2022 19:20
    I'm coming from a Cisco background and this is my first foray into Juniper.  I have OSPF and BGP running on my juniper router and want to filter specific routes from OSPF into BGP.  I have been beating my head against the wall to try to figure out how to filter the routes correctly.  I can redistribute the OSPF routes with no issues, but any time I tried to apply some type of other filter to block certain routes, it seems to break it.  Any help would be much appreciated.

    ------------------------------
    Malcolm Wood
    ------------------------------


  • 2.  RE: Filtering OSPF routes into BGP

    Posted 08-10-2022 01:44
    Edited by Sheetanshu 08-10-2022 10:32
    Hi Malcolm,

    Can you please share your OSPF, BGP and policy configurations?

    Regards
    Sheetanshu

    ------------------------------
    Sheetanshu Shekhar
    ------------------------------



  • 3.  RE: Filtering OSPF routes into BGP

    Posted 08-10-2022 06:20
    routing-options {
             autonomous-system 100;
    }
    protocols {
             bgp {
                       group external-peers {
                       type external;
                       export bgp-export;
                       peer-as 200;
                       neighbor 85.54.10.2;
                      }
             }
             ospf {
                      area 0.0.0.0 {
                                 interface em1.0;
                       }
              }
    }
    policy-options {
             prefix-list bgp-out {
                     192.168.11.1/24;
                     192.168.13.1/24;
             }
             policy-statement bgp-export {
                      term term1 {
                               from {
                                        prefix-list bgp-out;
                               }
                               then accept;
                       }
                      term reject-all {
                                 then reject;
                      }
    }

    ------------------------------
    Malcolm Wood
    ------------------------------



  • 4.  RE: Filtering OSPF routes into BGP

    Posted 08-10-2022 09:00
    Add the to the term selection of protocol ospf is that is where the routes are found.  By default the policy is only looking at bgp routes.

     policy-statement bgp-export {
                      term term1 {
                               from {
                                        prefix-list bgp-out;
                                        protocol ospf;
                               }
                               then accept;
                       }
                      term reject-all {
                                 then reject;
                      }​


    ------------------------------
    Steve Puluka BSEET - Juniper Ambassador
    IP Architect - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP - Retired)
    http://puluka.com/home
    ------------------------------



  • 5.  RE: Filtering OSPF routes into BGP

    Posted 08-10-2022 10:50
    Thanks.

    Could you commit the configuration with 11.1/24 & 13.1/24 as prefix-list members? 11.1/24 and 13.1/24 are host-IPs in the subnet-range, so the following error should have been seen

    jcluser@vMX_NV# replace pattern 11.0/24 with 11.1/24
    error: host portion is not zero (192.168.11.0/24)
    [edit policy-options prefix-list bgp-out]
    '192.168.11.0/24'
    could not rename to '192.168.11.1/24'

    Also, when using prefix-lists, the prefix should exist precisely in the same way in the routing-table, and 11.1/24 will not appear as such in the routing-table.

    The configuration otherwise seems to work fine for me, although we should add "from protocol ospf" in the term1 of the export-policy to be more specific.

    bgp {
        group external-peer {
            type external;
            export bgp-export;
            peer-as 200;
            neighbor 23.23.23.3;
        }
    }
    
    
    prefix-list bgp-out {
        192.168.11.0/24;
        192.168.13.0/24;
    }
    policy-statement bgp-export {
        term term1 {
            from {
                prefix-list bgp-out;
            }
            then accept;
        }
        term reject-all {
            then reject;
        }
    }
    
    =====================================================================================
    
    jcluser@vMX_NV# run show route advertising-protocol bgp 23.23.23.3 
    
    inet.0: 12 destinations, 13 routes (12 active, 0 holddown, 0 hidden)
      Prefix  Nexthop       MED     Lclpref    AS path
    * 192.168.11.0/24         Self                 1                  I
    * 192.168.13.0/24         Self                 1                  I
    
    
    jcluser@vMX_NV# run show route 192.168.11.0       
    
    inet.0: 12 destinations, 13 routes (12 active, 0 holddown, 0 hidden)
    + = Active Route, - = Last Active, * = Both
    
    192.168.11.0/24    *[OSPF/10] 01:00:36, metric 1
                        >  to 12.12.12.1 via ge-0/0/0.0
    
    [edit]
    jcluser@vMX_NV# run show route 192.168.13.0    
    
    inet.0: 12 destinations, 13 routes (12 active, 0 holddown, 0 hidden)
    + = Active Route, - = Last Active, * = Both
    
    192.168.13.0/24    *[OSPF/10] 01:00:41, metric 1
                        >  to 12.12.12.1 via ge-0/0/0.0​


    ------------------------------
    Sheetanshu Shekhar
    ------------------------------



  • 6.  RE: Filtering OSPF routes into BGP

    Posted 08-11-2022 01:15
    So I found the issue.  When I was using loopback addresses as fake networks just to push through the Juniper OSPF, they were advertising as a /32 vs /24.  So my policy statement was incorrect on what it was trying to push therefore failing.  I really do appreciate the help!

    ------------------------------
    Malcolm Wood
    ------------------------------



  • 7.  RE: Filtering OSPF routes into BGP

    Posted 08-11-2022 01:43
    Yes, if you have 11.1/24 configured on the loopback, it will generate two routes --- 11.1/32 (Local route) and 11.0/24 (Direct Route). There will be two OSPF routes on the OSPF neighbour, 11.0/24 and 11.1/32. The prefix-list must match the prefixes exactly how they appear in the routing-table.

    ------------------------------
    Sheetanshu Shekhar
    ------------------------------