Hello,
"instance-export" is for restricting route export from particular instance/table (by default, all routes are exported), not for directing specific routes into specific destination instances/tables and/or protocols.
OTOH, "instance-import" is for directing specific routes into specific destination instances/tables.
And routing protocol export policy is for inserting specific routes into routing protocol database (i.e. OSPF LSDB) or inclusion into protocol updates (i.e. RIP or BGP).
Therefore you need 2 policies:
1/ instance-import for master instance (yes, master instance/inet.0 can also have "instance-import" statement under [edit routing-options[), and
2/ BGP export policy for BGP peering configured under [edit protocols].
Here is an example of "instance-import" policy for master instance:
[edit]
aarseniev@mx80# show policy-options policy-statement From-VR-to-GRT
term 1 {
from {
instance Internet-OSPF;
protocol ospf;
}
then accept;
}
[edit]
aarseniev@mx80# show routing-options
router-id 198.18.0.3;
autonomous-system 65018;
instance-import From-VR-to-GRT;
Here is the verification:
aarseniev@mx80# show routing-instances Internet-OSPF
instance-type virtual-router;
interface ge-1/1/8.2511;
protocols {
ospf {
area 0.0.0.5 {
interface ge-1/1/8.2511 {
interface-type p2p;
metric 10000;
}
}
}
}
[edit]
aarseniev@mx80# run show route protocol ospf table Internet-OSPF.inet.0
Internet-OSPF.inet.0: 16 destinations, 16 routes (16 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
198.18.0.3/32 *[OSPF/10] 00:11:07, metric 12000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.0.11/32 *[OSPF/10] 00:11:07, metric 11000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.0.32/32 *[OSPF/10] 00:11:07, metric 10000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.2.0/30 *[OSPF/10] 00:11:07, metric 12000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.3.0/30 *[OSPF/10] 00:11:07, metric 11000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.10.0/24 *[OSPF/10] 00:11:07, metric 12000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.11.0/30 *[OSPF/10] 00:11:07, metric 20000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.12.0/24 *[OSPF/10] 00:11:07, metric 11000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.12.0/30 *[OSPF/10] 00:11:07, metric 13000
> to 198.18.251.2 via ge-1/1/8.2511
<skipped for brevity>
[edit]
aarseniev@mx80# run show route protocol ospf
inet.0: 27 destinations, 42 routes (24 active, 0 holddown, 3 hidden)
+ = Active Route, - = Last Active, * = Both
198.18.0.3/32 [OSPF/10] 6d 21:05:07, metric 0
> via lo0.0
[OSPF/10] 00:09:23, metric 12000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.0.11/32 *[OSPF/10] 6d 21:04:13, metric 1000
> to 198.18.10.11 via ge-1/1/6.10
[OSPF/10] 00:09:23, metric 11000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.0.32/32 *[OSPF/10] 6d 21:04:13, metric 2000
> to 198.18.10.11 via ge-1/1/6.10
[OSPF/10] 00:09:23, metric 10000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.2.0/30 *[OSPF/10] 6d 21:04:41, metric 3000
> to 198.18.22.2 via ge-1/1/8.22
[OSPF/10] 00:09:23, metric 12000
> to 198.18.251.2 via ge-1/1/8.2511
198.18.3.0/30 *[OSPF/10] 6d 21:04:41, metric 4000
> to 198.18.22.2 via ge-1/1/8.22
[OSPF/10] 00:09:23, metric 11000
> to 198.18.251.2 via ge-1/1/8.2511
And BGP export policy in master instance should look like below:
[edit]
aarseniev@mx80# show policy-options policy-statement bgp-export
term 1 {
from {
protocol ospf;
route-filter 198.18.0.0/16 orlonger;
}
then accept;
}
Of course, you can enhance policy From-VR-to-GRT to i.e tag/assign community to imported OSPF routes and then match on this community in "bgp-export" policy, but I'll leave it for yourself to try.
HTH
Thanks
Alex