Hi hidagar,
what you'd want to do is something similar to this:
ros code
/routing filter
add action=accept chain=isp-out-main comment="your advertised network through main seesion" prefix=1.2.3.0/24
add action=discard chain=isp-out-main comment="discard the rest"
add action=accept chain=isp-out-back comment="your advertised network through backup" prefix=1.2.3.0/24 set-bgp-prepend=3
add action=discard chain=isp-out-back comment="discard the rest"
add action=accept chain=isp-in-main set-bgp-local-pref=500 comment="accept all BGP routes from the main ISP session"
add action=accept chain=isp-in-back set-bgp-local-pref=100 comment="accept all BGP routes from the backup ISP session"
line 2,3: you accept your IP space to be advertised to the ISP through the main BGP session and discard everything else. Of course it depends on you what and how you want to advertise, this is just an example.
line 5,6: the same as 2,3 but you prepend your ASN 3 times. This way the
incoming packets will take the route through your ISP's main session while this path will be just a backup in case the main one fails. Now there are different mechanisms you could use to influence the route selection for incoming packets, this is one way of doing it. A solution where you have total control over the route selection would be if you advertise smaller portions of you IP space through your main session and the entire block through the backup session. This way, the most specific route (i.e. the ones advertised as smaller networks) will win.
line 8: all the routes coming through your main session will have a local pref of 500.
line 9: all the routes coming through the backup session will have a local pref of 100. This way, all the
outgoing packets (leaving your ASN) will use the routes from the main session (the higher the local preference, the higher the preference in selecting that route)
The final step would be to add the routing filters to your sessions, as follow:
- for the main session set the in-filter=isp-in-main, out-filter=isp-out-main
- for the backup session set the in-filter=isp-in-back, out-filter=isp-out-back
Hope this helps!
[EDIT] lines 8,9: set-bgp-local-pref instead of bgp-local-pref