Side Effects of Omitting the "from" Statement from an Export Policy
In export policies, omitting the
fromstatement in a term might lead to unexpected results. By default, if you omit thefromstatement, all routes are considered to match. For example, static and direct routes are not exported by BGP by default. However, if you create a term with an emptyfromstatement, these routes inadvertently could be exported because they matched thefromstatement. For example, the following routing policy is designed to reject a few route ranges and then export routes learned by BGP (which is the default export behavior):[edit]routing-options {autonomous-system 56;}protocols {bgp {group 4 {export statics-policy;type external;peer-as 47;neighbor192.168.1.1;}}}policy-options {policy-statement statics-policy {term term1 {from {route-filter 192.168.0.0/16 orlonger;route-filter172.16.1.1/3orlonger;}then reject; # reject the prefixes in the route list}term term2 {then {accept; # accept all other routes, including static and direct routes}}}}However, this routing policy results in BGP advertising static and direct routes to its peers because:
term1rejects the destination prefixes enumerated in the route list.term2, because it has nofromstatement, matches all other routes, including static and direct routes, and accepts all these routes (with theacceptstatement).To modify the routing policy shown above so that an IGP does not export unwanted routes, you can specify the following additional terms:
[edit]routing-options {autonomous-system 56;}protocols {isis {export statics-policy;}}policy-options {policy-statement statics-policy {term term1 {from {route-filter 192.168.0.0/16 orlonger;route-filter172.16.1.1/3 orlonger;}then reject; # reject the prefixes in the route list}term term2 { # reject direct routesfrom protocol direct;then reject;}term term3 { # reject static routesfrom protocol static;then reject;}term term4 { # reject local routesfrom protocol local;then reject;}term term5 { # reject aggregate routesfrom protocol aggregate;then reject;}term term6 {then accept; # accept all other routes}}}