Juniper Junos – How to Use ‘Set Route’ Command

juniper-junosrouterroutingscreenos

tell me please how to translate the following Screenos to Junos…
Do I understand correctly that the path to route 80.70.128.142/32 is via vrouter "UntrustGi-vr" ?

Screenos command:

set vrouter "trust-vr"
set route 80.70.128.142/32 vrouter "UntrustGi-vr" preference 20 metric 1

my Junos attempt:

Maybe such interpretation in Junos???

set routing-instances trust-vr instance-type virtual-router

set routing-instances trust-vr routing options static route 80.70.128.142/32 next-table UntrustGi-vr.inet.0 preference 20 metric 1

Best Answer

In screenos the command

set vrouter "trust-vr"

is moving you into editing the trust-vr router section. trust-vr is normally the default routing instance. The next command

set route 80.70.128.142/32 vrouter "UntrustGi-vr" preference 20 metric 1

adds an entry into the trust-vr routing table saying route all traffic to 80.70.128.142/32 to another virtual routing instance called "UntrustGi-vr" with a preference of 20 and metric 1

Now depending on if you have changed the trust-vr routing instance to be the non default would depend on how you would add it in Junos.

If it is the default routing instance then you just need to do

set routing-options static route 80.70.128.142/32 next-table UntrustGi-vr.net.0 preference 20
set routing-options static route 80.70.128.143/32 metric 1

which adds the static route into the default routing table inet.0. The config should look like this

routing-options {
    static {
        route 80.70.128.142/32 {
            next-table UntrustGi-vr.inet.0;
            metric 1;
            preference 20;
        }
    }
}

If you looked at the routing table you would see this

inet.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

80.70.128.142/32   *[Static/20] 00:08:54, metric 1
                      to table UntrustGi-vr.inet.0

If it isn't the default routing instance and you had created a routing instance called trust-vr then you would do

set routing-instance trust-vr routing-options static route 80.70.128.142/32 next-table UntrustGi-vr.net.0 preference 20
set routing-instance trust-vr routing-options static route 80.70.128.142/32 metric 1

The config should look similar to this

routing-instances {
    trust-vr {
        routing-options {
            static {
                route 80.70.128.142/32 {
                    next-table UntrustGi-vr.inet.0;
                    metric 1;
                    preference 20;
                }
            }
        }
    }
}

and the routing table should show this

trust-vr.inet.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

80.70.128.142/32   *[Static/20] 00:03:15, metric 1
                      to table UntrustGi-vr.inet.0