Juniper Advertise MED on EBGP session.

I tried to pull an old trick out of my playbook this morning and
failed. I'd like to advertise BGP Metrics on an EBGP session,
specifically the existing internal metrics. I know how to do this
on a Cisco, but I tried on a Juniper and it seems to be impossible.

I can set a metric in a policy, or put a default metric on the
session as a whole, or even set it to IGP. But none of those are
what I want. I want the existing metrics advertised as-is, just
like would be done over an IBGP session. After an hour of reading
documentation and trying a few things, I'm starting to think it
may be impossible on JunOS.

Anyone have a tip or trick?

Unless I'm going insane, I think you're trying to use the IGP metric as
MED?

If so, then :
https://www.juniper.net/documentation/en_US/junos12.3/topics/topic-map/bgp-med.html#jd0e3487

/Ruairi

What metric do you intend to advertise to an eBGP peer?

iBGP MED to eBGP MED ? MED being a non-transitive attribute, I guess it's not expected to work if you don't explicitly set a MED in the export policy (you might rely on setting and matching communities for that) or on the peer group.
It's not be expected to work on Cisco without explicitly setting the MED, either.

IGP metric to MED ? It seems to just work as is here, at least for RIP and OSPF (as long as you don't do anything to the MED in your export policy): RIP metric and OSPF metric are exported spontaneously as MED (when using OSPF E2 routes, beware of the static aspect of their metric).

Olivier

I also spent a significant amount of time trying to figure out a way to do this, and was using communities for a while before I found a solution. It turns out that the expression knob lets you use the existing metric as an input, and this works to export the iBGP MED, at least on my 12.3X48 SRX:

     then {
         metric {
             expression {
                 metric multiplier 1;
             }
         }
     }

Keenan

In a message written on Tue, Feb 21, 2017 at 11:10:35AM -0800, Keenan Tims wrote:

I also spent a significant amount of time trying to figure out a way to
do this, and was using communities for a while before I found a
solution. It turns out that the expression knob lets you use the
existing metric as an input, and this works to export the iBGP MED, at
least on my 12.3X48 SRX:

     then {
         metric {
             expression {
                 metric multiplier 1;
             }
         }
     }

This is exactly what I needed. It works perfectly. Many, many thanks.