6

I am trying to create a policy-statement to prepend the local AS number 5 times (assuming it is AS1234) before advertising local routes up to a new upstream transit provider (no inbound traffic is desired via this upstream). MED and communities are not available here (and out of the scope of this question). The policy I originally wrote looked like this;

  policy-statement PS-AS-Prepend-x5 {
     from {
         route-filter 0.0.0.0/0 orlonger;
     }
     to protocol bgp;
      then {
          as-path-prepend "1234 1234 1234 1234 1234";
          accept;
      }
  }

  protocols {
      bgp {
        group new-upstream {
        type external;
        export [ PS-AS-Prepend-x5 ];
      }
  }

The upstream has a looking glass on which I can see that when performing something akin to "show ip bgp prefix/mask" they are only seeing one AS in the path to this route (and all routes advertised). I changed the policy-statement as follows;

  policy-statement PS-AS-Prepend-x5 {
     to protocol bgp;
      then {
          as-path-prepend "1234 1234 1234 1234 1234";
          accept;
      }
  }

After resetting the BGP session the same behaviour as before was still occuring, no prepends. My question is two fold;

  1. Do you need a "from" clause in a policy-statement? I used 0/0 in the original statement as only local prefixes are being advertised so rather than writing them all out I used 0/0 to match them all. I have been search on-line documentation but haven't found anything definitive. This is why removed the "from" clause to try and match all prefixes that way. I also tried to protocol bgp but this too failed.

  2. I now suspect the syntax of the policy-statment is not the problem so my second question is Can you pre-pend your own AS on advertisements in JUNOS to eBGP peers?

UPDATE

me@r1# run show route advertising-protocol bgp 11.22.33.44 detail 

inet.0: 471821 destinations, 512598 routes (471815 active, 0 holddown, 12 hidden)
* 123.0.0.0/8 (3 entries, 1 announced)
 BGP group new-upstream type Externa
     Nexthop: Self
     AS path: [1234] I
     Communities: 1234:1234

1 Answer 1

7
  1. Do you need a "from" clause in a policy-statement?

No. You don't. Without a "from" class everything will match.

  1. Can you pre-pend your own AS on advertisements in JUNOS to eBGP peers?

Yes, of course you can, that's the typical way in which AS prepending is being done.

So the real question is: why doesn't this work? One thing which I'm not sure about is the to protocol bgp statement, I've never used that in policies for prepending. The best thing to do is verify if you're actually prepending by checking what you're advertising: show route advertising-protocol bgp aaa.bbb.ccc.ddd detail, where aaa.bbb.ccc.ddd is the peer IP.

5
  • Many thanks for your answer Teun Vink, can you provide an example policy-statement that should work here, just simply removing the "to" statement, can you have policy-statements that only consist of a "then" clause so it matches everything?
    – Baldrick
    Commented Dec 2, 2013 at 16:24
  • I have added the output on the command you mentioned, I did check this to, and just like on their looking glass, no pre-pend :(
    – Baldrick
    Commented Dec 2, 2013 at 16:24
  • 2
    @jwbensley did you restart your bgp sessions or do a soft clear on them after applying the config? Commented Dec 2, 2013 at 17:38
  • 1
    @jwbensley: just remove the to protocol bgp from the last statement in your post and then clear the session.
    – Teun Vink
    Commented Dec 2, 2013 at 19:14
  • @MikePennington Good point Mike, I should have been claerer, I did full BGP reset run clear bgp neighbor 11.22.33.44
    – Baldrick
    Commented Dec 2, 2013 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.