I have vSRX cluster, which announce some protected addresses over IBGP. Each node has two sessions with two routers. (I use ge-0/0/1 and ge-7/0/1 for that).

I found that if fail-over happens, and node1 become primary, there are an additional latency due to the use of cluster fabric transport to send data from node0 to node1.

I want to make sessions from node1 more preferable (by reducing MED). But I want to make it automatic, based on node where redundancy group is currently primary.

How can I associate (?) MED attribute with RG placement?

  • MED is used to try to influence a different AS, not with iBGP. – Ron Maupin Apr 6 at 16:21
  • Em... Network guys said me to use MED. I don't know what they have on their equipment. May be it's ebgp. Anyway, the key question is how to change bgp attributes based on 'primary/secondary' for node and interface. – George Shuklin Apr 6 at 16:26
  • Maybe your equipment can use BFD. That can cause a failover to happen faster. – Ron Maupin Apr 6 at 16:30
  • It's not transient. If a failover happens, SRX keeps all bgps alive and continue to send traffic through fabric link forever. – George Shuklin Apr 6 at 17:16

I first want to echo Ron Maupin's comment, that MED is not the right attribute to achieve your goal in the environment you describe, with iBGP sessions. You should instead configure a higher IGP cost on the less-preferred link (if one node's uplinks are always preferred for all networks) or use local-preference.

However, if you must use MED, you can configure as follows. Note, we are matching the routes we want to have MED value 10 or 20. How you match the appropriate routes is up to you; this is just an example.

policy-options {
  policy-statement BGP-export-node0 {
    /* match routes for traffic that should arrive via node0 */
    term set_med_node0 {
      from {
        interface [ ge-0/0/0 ge-0/0/2 ge-0/0/3 ];
      /* set MED to 10 */
      then metric 10;
    /* higher med on the other routes */
    term set_med_node1 {
      from {
        interface [ ge-7/0/0 ge-7/0/2 ge-7/0/3 ];
      then metric 20;

Create an inverse policy BGP-export-node1 and reverse what you're matching.

Add these terms at the beginning of BGP export policies. You're now going to need different export policies for BGP sessions related to each node's uplinks, for example:

protocols {
  bgp {
    group node0_uplinks {
      export BGP-export-node0;
    group node1_uplinks {
      export BGP-export-node1;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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