Overview
junos import
or export
actions are best understood from a what happens to the routing instance (or routing table).
Import / Export keywords mean:
import
routes from a protocol to the routing instance. Protocol import
choices include, but are not limited to: local
, direct
, static
, isis
, ospf
, or bgp
.
export
routes from a routing instance into a routing protocol (this is similar to redistributing routes in an IOS product)
Unless otherwise specified, exporting routes into OSPF defaults to using OSPF External Type-2 routes.
What does the POLICY-STATIC
do above?
what is this policy doing?
set policy-options policy-statement POLICY-STATIC term TERM-STATIC from protocol static
set policy-options policy-statement POLICY-STATIC term TERM-STATIC then accept
set protocols ospf export POLICY-STATIC
The first two lines above match against any static route in this routing instance, and then export those routes into this ospf instance. Unless you tell junos otherwise, exporting into ospf defaults to OSPF External Type-2 routes with a metric of 0.
junos static route caveat:
Be warned that junos dynamically generates static routes for internal functions, this example is from a source nat configuration:
root@lab_srx> show configuration | display set | match snat
set security nat source pool SNAT-IPv4-POOL-01 address 192.168.1.10/32 to 192.168.1.30/32
set security nat source pool SNAT-IPv4-POOL-01 port range 10000
set security nat source pool SNAT-IPv4-POOL-01 port range to 63486
set security nat source rule-set SOURCE-NAT-RULE rule SOURCE-NAT-RULE then source-nat pool SNAT-IPv4-POOL-01
set security nat proxy-arp interface ge-0/0/5.0 address 192.168.1.10/32 to 192.168.1.30/32
root@lab_srx> show route
...
192.168.1.10/31 *[Static/1] 18:05:31
Receive
192.168.1.12/30 *[Static/1] 18:05:31
Receive
192.168.1.16/29 *[Static/1] 18:05:31
Receive
192.168.1.24/30 *[Static/1] 18:05:31
Receive
192.168.1.28/31 *[Static/1] 18:05:31
Receive
192.168.1.30/32 *[Static/1] 18:05:31
Receive
OSPF External Type-1 default-route policy-statement
:
If you want to oriignate an OPSF External Type-1 default (from a existing static default route), you can use this policy-statement
:
set policy-options policy-statement STATIC-DEFAULT term TERM-STATIC-DEFAULT from protocol static
set policy-options policy-statement STATIC-DEFAULT term TERM-STATIC-DEFAULT from route-filter 0.0.0.0/0 exact
set policy-options policy-statement STATIC-DEFAULT term TERM-STATIC-DEFAULT then external type 1
set policy-options policy-statement STATIC-DEFAULT term TERM-STATIC-DEFAULT then accept
set protocols ospf export STATIC-DEFAULT
BGP policy-statement
Example:
set policy-options policy-statement POLICY-BGP-TESTME term MY-COMMUNITY-LP from community 1000:1000
set policy-options policy-statement POLICY-BGP-TESTME term MY-COMMUNITY-LP then local-preference 200
set policy-options policy-statement POLICY-BGP-TESTME term MY-COMMUNITY-LP then accept