Cisco Route Map Equivalent in Juniper JUNOS – How to Configure

ciscojuniper

Here is a scenario and working route-map example for Policy base routing.
I'm new Junos i'm struggling with Firewall filters and Policy-statements in Junos.

Can you help me to convert this simple scenario from Cisco IOS to JUNOS equivalent.

What it does below it matchs a packet from any source but destination 200.100.30.248/29 and set its next hop to 192.168.1.1

Matching criteria using Access List

access-list 104 permit ip any 202.100.30.248 0.0.0.7 log-input

Route-map

route-map PBR permit 10
 match ip address 104
 set ip default next-hop 192.168.1.1

And at the End it is applied.

interface FastEthernet0/1  
 ip address 172.16.1.2 255.255.255.252  
 ip policy route-map PBR

Best Answer

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