Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
juniper:bgp [2008/02/03 22:39] a |
juniper:bgp [2009/05/25 00:35] (current) |
||
|---|---|---|---|
| Line 57: | Line 57: | ||
| **Remember to also filter the import or your can be flooded** | **Remember to also filter the import or your can be flooded** | ||
| + | |||
| + | ===== Redistribute routes ===== | ||
| + | Lets say you have set some dynamic routing (RIP, | ||
| + | |||
| + | ==== 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. Something 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 ' | ||
| + | \\ | ||
| + | |||
| + | **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 smthing like: | ||
| + | < | ||
| + | neighbor aaa.bbb.ccc.ddd { | ||
| + | export default-originate; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||

