//1.配置路由策略如下: root@ex4200# top root@ex4200# edit policy-options {master:0}[edit policy-options] root@ex4200# show policy-statement default-static { term accept-default-static { from { protocol static; route-filter 172.16.1.0/24 exact; route-filter 192.168.0.0/16 orlonger; } then accept; } } policy-statement my-reject-static { term reject-default-static { from { route-filter 172.16.1.0/24 exact; route-filter 192.168.0.0/16 orlonger; } then reject; } } //2.在new_instance路由器上配置静态路由,查看到如下: {master:0}[edit routing-instances new_instance routing-options] root@ex4200# set static route 172.16.1.0/24 next-hop 101.7.158.1 root@ex4200# set static route 192.168.2.0/24 next-hop 101.7.156.2 {master:0}[edit routing-instances new_instance routing-options] root@ex4200# show static { route 172.16.1.0/24 next-hop 101.7.158.1; route 192.168.2.0/24 next-hop 101.7.156.2; } //3.进入ospf协议设置导出策略,仅仅把该路由器new_instance的静态路由172.16.1.0/24转换成ospf路由, //以便其他路由器学习到该条路由,这样就不用重复在其他路由器上配置该静态路由 {master:0}[edit routing-instances new_instance protocols ospf] root@ex4200# show area 0.0.0.0 { interface ge-0/0/16.0; interface ge-0/0/18.0; interface ge-0/0/22.0; } {master:0}[edit routing-instances new_instance protocols ospf] root@ex4200# set export default-static {master:0}[edit routing-instances new_instance protocols ospf] root@ex4200# exit {master:0}[edit routing-instances new_instance] root@ex4200# show instance-type virtual-router; interface ge-0/0/16.0; interface ge-0/0/18.0; interface ge-0/0/22.0; routing-options { static { route 172.16.1.0/24 next-hop 101.7.158.1; route 192.168.2.0/24 next-hop 101.7.156.2; } } protocols { ospf { export default-static; area 0.0.0.0 { interface ge-0/0/16.0; interface ge-0/0/18.0; interface ge-0/0/22.0; } } } //4.其他实例接受external ospf,但是new_instance4 路由实例拒绝接受 external ospf路由 root@ex4200# edit routing-instances new_instance4 protocols ospf {master:0}[edit routing-instances new_instance4 protocols ospf] root@ex4200# set import my-reject-static {master:0}[edit routing-instances new_instance4] root@ex4200# show instance-type virtual-router; interface ge-0/0/19.0; interface ge-0/0/21.0; interface ge-0/0/23.0; protocols { ospf { import my-reject-static; area 0.0.0.1 { interface ge-0/0/19.0; interface ge-0/0/21.0; interface ge-0/0/23.0; } } } //5.查看其他路由器上从new_instance路由器实例学习到的ospf动态路由, //注意external OSPF路由,其权值为 OSPF/150 root@ex4200# run show route protocol ospf inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden) new_instance.inet.0: 13 destinations, 14 routes (13 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 101.7.151.0/24 *[OSPF/10] 01:20:56, metric 2 > to 101.7.156.2 via ge-0/0/18.0 101.7.152.0/24 *[OSPF/10] 01:21:06, metric 2 > to 101.7.156.2 via ge-0/0/18.0 101.7.153.0/24 *[OSPF/10] 01:21:01, metric 3 > to 101.7.156.2 via ge-0/0/18.0 101.7.157.0/24 *[OSPF/10] 01:21:06, metric 2 > to 101.7.156.2 via ge-0/0/18.0 to 101.7.158.1 via ge-0/0/22.0 192.168.2.0/24 [OSPF/10] 01:21:01, metric 3 > to 101.7.156.2 via ge-0/0/18.0 192.168.50.0/24 *[OSPF/150] 00:54:22, metric 0, tag 0 > to 101.7.156.2 via ge-0/0/18.0 224.0.0.5/32 *[OSPF/10] 01:22:22, metric 1 MultiRecv new_instance1.inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 101.7.151.0/24 *[OSPF/10] 01:20:56, metric 2 > to 101.7.157.1 via ge-0/0/14.0 101.7.152.0/24 *[OSPF/10] 01:20:56, metric 2 > to 101.7.157.1 via ge-0/0/14.0 101.7.153.0/24 *[OSPF/10] 01:20:56, metric 3 > to 101.7.157.1 via ge-0/0/14.0 101.7.156.0/24 *[OSPF/10] 01:20:56, metric 2 > to 101.7.158.2 via ge-0/0/10.0 to 101.7.157.1 via ge-0/0/14.0 172.16.1.0/24 *[OSPF/150] 01:21:06, metric 0, tag 0 > to 101.7.158.2 via ge-0/0/10.0 192.168.2.0/24 *[OSPF/10] 01:20:56, metric 3 > to 101.7.157.1 via ge-0/0/14.0 192.168.50.0/24 *[OSPF/150] 00:54:22, metric 0, tag 0 > to 101.7.157.1 via ge-0/0/14.0 224.0.0.5/32 *[OSPF/10] 01:22:22, metric 1 MultiRecv new_instance2.inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 101.7.153.0/24 *[OSPF/10] 01:21:00, metric 2 > to 101.7.151.2 via ge-0/0/1.0 to 101.7.152.2 via ge-0/0/3.0 101.7.158.0/24 *[OSPF/10] 01:20:55, metric 2 to 101.7.156.1 via ge-0/0/4.0 > to 101.7.157.2 via ge-0/0/6.0 172.16.1.0/24 *[OSPF/150] 01:21:06, metric 0, tag 0 > to 101.7.156.1 via ge-0/0/4.0 192.168.2.0/24 *[OSPF/10] 01:21:06, metric 2 > to 101.7.152.2 via ge-0/0/3.0 224.0.0.5/32 *[OSPF/10] 01:22:22, metric 1 MultiRecv new_instance3.inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 101.7.152.0/24 *[OSPF/10] 01:21:01, metric 2 > to 101.7.151.1 via ge-0/0/5.0 to 101.7.153.1 via ge-0/0/9.0 101.7.156.0/24 *[OSPF/10] 01:21:01, metric 2 > to 101.7.151.1 via ge-0/0/5.0 101.7.157.0/24 *[OSPF/10] 01:20:51, metric 2 > to 101.7.151.1 via ge-0/0/5.0 101.7.158.0/24 *[OSPF/10] 01:21:01, metric 3 > to 101.7.151.1 via ge-0/0/5.0 172.16.1.0/24 *[OSPF/150] 01:21:01, metric 0, tag 0 > to 101.7.151.1 via ge-0/0/5.0 192.168.2.0/24 *[OSPF/10] 01:21:01, metric 2 > to 101.7.153.1 via ge-0/0/9.0 192.168.50.0/24 *[OSPF/150] 00:54:22, metric 0, tag 0 > to 101.7.151.1 via ge-0/0/5.0 224.0.0.5/32 *[OSPF/10] 01:22:22, metric 1 MultiRecv new_instance4.inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 101.7.151.0/24 *[OSPF/10] 01:21:06, metric 2 to 101.7.152.1 via ge-0/0/19.0 > to 101.7.153.2 via ge-0/0/21.0 101.7.156.0/24 *[OSPF/10] 01:21:01, metric 2 > to 101.7.152.1 via ge-0/0/19.0 101.7.157.0/24 *[OSPF/10] 01:20:51, metric 2 > to 101.7.152.1 via ge-0/0/19.0 101.7.158.0/24 *[OSPF/10] 01:21:01, metric 3 > to 101.7.152.1 via ge-0/0/19.0 224.0.0.5/32 *[OSPF/10] 01:22:22, metric 1 MultiRecv