This feature in JunOS called Filter based forwarding.
You can find configurations examples for MX platform here. Example with dual-ISP routing on SRX platform here
Here also working example for SRX platform.
We have network, traffic from which should be routed thru non-default route, except local destination networks.
user@srx1400> show route 0/0 exact
inet.0: 450 destinations, 474 routes (450 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 69w5d 17:17:29
> to 111.111.111.111 via ge-0/0/1.0
Interface, behind which source addresses are located:
user@srx1400> show configuration interfaces ge-0/0/2.100
description "SRV";
vlan-id 100;
family inet {
filter {
input ge-0/0/1.100-in;
}
address 192.168.100.1/24;
}
Firewall filter:
user@srx1400> show configuration firewall filter ge-0/0/1.100-in
term inject-default {
from {
source-address {
192.168.100.0/24;
}
destination-address {
10.0.0.0/8 except;
172.16.0.0/12 except;
192.168.0.0/16 except;
0.0.0.0/0;
}
}
then {
routing-instance ri_fw_injdefault;
}
}
term default {
then accept;
}
Routing instance configuration:
user@srx1400> show configuration routing-instances ri_fw_injdefault
instance-type forwarding;
routing-options {
static {
route 0.0.0.0/0 next-hop 222.222.222.222;
}
}
Set up RIB-Groups:
user@srx1400> show configuration routing-options
interface-routes {
rib-group inet fbf-group;
}
static {
...
}
rib-groups {
fbf-group {
import-rib [ inet.0 ri_fw_injdefault.inet.0 ];
}
}
After all set, lets check routing table for ri_fw_injdefault instance:
user@srx1400> show route 0/0 exact table ri_fw_injdefault.inet.0
ri_fw_injdefault.inet.0: 81 destinations, 81 routes (81 active, 0 holddown,
0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 38w1d 00:19:55
> to 222.222.222.222 via ge-0/0/3.0
policy-options
' section: juniper.net/documentation/en_US/junos/topics/reference/…