This article explores the configuration of a routing policy to Advertise Static Routes Except for the Default Route on a Juniper SRX or any device running Junos OS.
The configuration accomplishes the goal of redistributing all static routes but excluding the default route (0.0.0.0/0).
set policy-options policy-statement REDIST_STATIC term 1 from protocol static
set policy-options policy-statement REDIST_STATIC term 1 from route-filter 0.0.0.0/0 longer accept
set policy-options policy-statement REDIST_STATIC term 2 then reject
set protocols ospf export REDIST_STATIC
This configuration uses a route filter to match the default route (0.0.0.0/0) and specifies that longer prefixes should be accepted, meaning routes that are more specific than the default route (i.e., subnets that are not 0.0.0.0/0).
Essentially, this line ensures that the default route is excluded from being redistributed while allowing other static routes with longer prefixes to be advertised.