• No related posts.

      • No related posts.

        • No related posts.

          • No related posts.

              No related posts.

            Redistribute route Juniper

            Lets say you have set some dynamic routing (RIP,OSPF,BGP,IS-IS..) and you want to redistribute routes into them.

            redistribute connected

            set policy-options policy-statement Connected
                term connected {
                    from protocol direct;
                    then accept;
            }
            

            redistribute static

            set policy-options policy-statement Static
                term static {
                    from protocol static;
                    then accept;
            }
            

            redistribute local

            set policy-options policy-statement Local
                term local {
                    from protocol local;
                    then accept;
            }
            

            reject anything else

            term else {
                then reject
            }
            

            And all the policy will look like:

            
            policy-statement distribute-routes
                term connected {
                    from protocol direct;
                    then accept;
                }
                term static {
                    from protocol static;
                    then accept;
                }
                term local {
                    from protocol local;
                    then accept;
                }
                term else {
                    then reject
                }
            

            It looks easy I guess..but what if you want to redistribute ospf routes?

            redistribute ospf routes

            If you are using OSPF for IGP and BGP as a EGP and you want to export ospf routes to BGP peers then you have to create a policy for that.
            Smth like :

            policy-statement ospf-routes {
                term 1 {
                    from {
                        protocol ospf;
                        area 0.0.0.0;
                    }
                    then accept;
                }
                term 2 {
                    then reject;
                }
            }
            

            send default route to bgp peer

            Lets assume you want to send to send to a BGP peer 0.0.0.0/0 (default route).

            First you need to have a route for 0.0.0.0/0 before you can export it to a peer. I guess this is the difference between the Juniper and Cisco configs, Cisco provides you a shortcut with the ‘default-originate’ keyword which does it all in one step. If you don’t have a route for 0.0.0.0/0 defined somewhere that is at least part of the problem.

            First we generate the default route (if you dont have one yet) :

            routing-options {
                generate {
                    route 0.0.0.0/0 discard;
                }
            }
            

            then we create a policy for 0/0 :

            policy-options {
                policy-statement default-originate {
                    from {
                        route-filter 0.0.0.0/0 exact;
                    }
                    then accept;
                }
            }
            

            A simple BGP neighbour will have smth like:

            neighbor aaa.bbb.ccc.ddd {
                export default-originate;
            }
            

            Related posts:

            1. OSPF Juniper
            2. Juniper RIP howto
            3. Adding a default route
            4. Juniper MPLS howto
            5. SSH and Telnet filters
            This entry was posted in Juniper and tagged , , , , .

            Leave a Reply