美文网首页
多实例OSPF与RIB-GROUP及策略tag的应用

多实例OSPF与RIB-GROUP及策略tag的应用

作者: 严炎2016 | 来源:发表于2021-03-02 11:36 被阅读0次

要求:

VMX-BJ导出lo0.0时带上tag100

VMX-SH导出lo0.0时带上tag100

VMX-FZ导出lo0.0和static时带上tag10

BJ和FZ互通(static除外),SH和FZ互通,BJ和SH不能通

root@VMX-C# run show configuration | display set

set version 14.1R4.8

set system host-name VMX-C

set system root-authentication encrypted-password "$1$lCnnqo0I$1IVFD6XTges7QIevBbpq4/"

set system services ssh root-login allow

set system services ssh protocol-version v2

set system syslog user * any emergency

set system syslog file messages any notice

set system syslog file messages authorization info

set system syslog file interactive-commands interactive-commands any

set interfaces ge-0/0/0 unit 0 family inet address 192.168.12.1/24

set interfaces ge-0/0/1 unit 0 family inet address 192.168.14.1/24

set interfaces ge-0/0/3 unit 0 family inet address 192.168.13.1/24

set interfaces em0 unit 0 family inet address 10.5.245.90/24

set interfaces fxp0 unit 0 family inet

set interfaces lo0 unit 0 family inet address 10.0.255.1/32

set routing-options interface-routes rib-group inet DIRECT-ROUTES

set routing-options static route 10.5.0.0/16 next-hop 10.5.245.254

set routing-options rib-groups rib-group-BJ import-rib VR-BJ.inet.0

set routing-options rib-groups rib-group-BJ import-rib VR-SH.inet.0

set routing-options rib-groups rib-group-BJ import-rib inet.0

set routing-options rib-groups rib-group-BJ import-policy Policy-rib-group-BJ

set routing-options rib-groups rib-group-SH import-rib VR-SH.inet.0

set routing-options rib-groups rib-group-SH import-rib VR-BJ.inet.0

set routing-options rib-groups rib-group-SH import-rib inet.0

set routing-options rib-groups rib-group-SH import-policy Policy-rib-group-SH

set routing-options rib-groups GLOBAL-TO-VR import-rib inet.0

set routing-options rib-groups GLOBAL-TO-VR import-rib VR-BJ.inet.0

set routing-options rib-groups GLOBAL-TO-VR import-rib VR-SH.inet.0

set routing-options rib-groups DIRECT-ROUTES import-rib inet.0

set routing-options rib-groups DIRECT-ROUTES import-rib VR-BJ.inet.0

set routing-options rib-groups DIRECT-ROUTES import-rib VR-SH.inet.0

set routing-options router-id 10.0.255.1

set protocols ospf rib-group GLOBAL-TO-VR

set protocols ospf export export-to-fz

set protocols ospf area 0.0.0.0 interface lo0.0 passive

set protocols ospf area 0.0.0.0 interface ge-0/0/3.0

set policy-options policy-statement Policy-rib-group-BJ term TO-SH from tag 100

set policy-options policy-statement Policy-rib-group-BJ term TO-SH to rib VR-SH.inet.0

set policy-options policy-statement Policy-rib-group-BJ term TO-SH then reject

set policy-options policy-statement Policy-rib-group-SH term TO-BJ from tag 200

set policy-options policy-statement Policy-rib-group-SH term TO-BJ to rib VR-BJ.inet.0

set policy-options policy-statement Policy-rib-group-SH term TO-BJ then reject

set policy-options policy-statement export-to-bj term 1 from tag 10

set policy-options policy-statement export-to-bj term 1 from route-filter 192.168.100.0/24 exact

set policy-options policy-statement export-to-bj term 1 then reject

set policy-options policy-statement export-to-bj term 2 from tag 10

set policy-options policy-statement export-to-bj term 2 then accept

set policy-options policy-statement export-to-fz term 1 from tag 100

set policy-options policy-statement export-to-fz term 1 from tag 200

set policy-options policy-statement export-to-fz term 1 then accept

set policy-options policy-statement export-to-sh term 1 from tag 10

set policy-options policy-statement export-to-sh term 1 then accept

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 1 from protocol ospf

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 1 from neighbor 192.168.12.2

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 1 then tag 100

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 1 then accept

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 2 from protocol ospf

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 2 from neighbor 192.168.14.4

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 2 then tag 200

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 2 then accept

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 3 from protocol ospf

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 3 from neighbor 192.168.13.3

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 3 then tag 10

set policy-options policy-statement from-BJ-SH-into-GLOBAL term 3 then accept

set routing-instances VR-BJ instance-type virtual-router

set routing-instances VR-BJ interface ge-0/0/0.0

set routing-instances VR-BJ interface lo0.1

set routing-instances VR-BJ protocols ospf rib-group rib-group-BJ

set routing-instances VR-BJ protocols ospf export export-to-bj

set routing-instances VR-BJ protocols ospf area 0.0.0.0 interface ge-0/0/0.0

set routing-instances VR-SH instance-type virtual-router

set routing-instances VR-SH interface ge-0/0/1.0

set routing-instances VR-SH interface lo0.2

set routing-instances VR-SH protocols ospf rib-group rib-group-SH

set routing-instances VR-SH protocols ospf export export-to-sh

set routing-instances VR-SH protocols ospf area 0.0.0.0 interface ge-0/0/1.0

root@VMX-BJ> show configuration | display set

set version 14.1R4.8

set system host-name VMX-BJ

set system root-authentication encrypted-password "$1$VBtVt0XR$DXQQLBEexXU3dNxlJ4yCi/"

set system syslog user * any emergency

set system syslog file messages any notice

set system syslog file messages authorization info

set system syslog file interactive-commands interactive-commands any

set interfaces ge-0/0/0 unit 0 family inet address 192.168.12.2/24

set interfaces lo0 unit 0 family inet address 10.0.255.2/32

set routing-options router-id 10.0.255.2

set protocols ospf export export-lo0

set protocols ospf area 0.0.0.0 interface ge-0/0/0.0

set policy-options policy-statement export-lo0 term 1 from interface lo0.0

set policy-options policy-statement export-lo0 term 1 then tag 100

set policy-options policy-statement export-lo0 term 1 then accept

root@VMX-SH> show configuration | display set

set version 14.1R4.8

set system host-name VMX-SH

set system root-authentication encrypted-password "$1$dLRazD.b$LuzLKcziAIRgCl8WRwp/4."

set system syslog user * any emergency

set system syslog file messages any notice

set system syslog file messages authorization info

set system syslog file interactive-commands interactive-commands any

set interfaces ge-0/0/0 unit 0 family inet

set interfaces ge-0/0/1 unit 0 family inet address 192.168.14.4/24

set interfaces lo0 unit 0 family inet address 10.0.255.4/32

set routing-options router-id 10.0.255.4

set protocols ospf export export-lo0

set protocols ospf area 0.0.0.0 interface ge-0/0/1.0

set policy-options policy-statement export-lo0 term 1 from interface lo0.0

set policy-options policy-statement export-lo0 term 1 then tag 200

set policy-options policy-statement export-lo0 term 1 then accept

root@VMX-FZ> show configuration | display set

set version 14.1R4.8

set system host-name VMX-FZ

set system root-authentication encrypted-password "$1$3/HuirE2$GDr9k4moj1SmEtJ.kyc9j1"

set system syslog user * any emergency

set system syslog file messages any notice

set system syslog file messages authorization info

set system syslog file interactive-commands interactive-commands any

set interfaces ge-0/0/0 unit 0 family inet

set interfaces ge-0/0/3 unit 0 family inet address 192.168.13.3/24

set interfaces lo0 unit 0 family inet address 10.0.255.3/32

set interfaces lo0 unit 0 family inet address 10.1.255.3/32

set interfaces lo0 unit 0 family inet address 10.1.255.33/32

set routing-options static route 192.168.100.0/24 discard

set routing-options router-id 10.0.255.3

set protocols ospf export export-static

set protocols ospf export export-lo0

set protocols ospf area 0.0.0.0 interface ge-0/0/3.0

set policy-options policy-statement export-lo0 term 1 from interface lo0.0

set policy-options policy-statement export-lo0 term 1 then tag 10

set policy-options policy-statement export-lo0 term 1 then accept

set policy-options policy-statement export-static term 1 from protocol static

set policy-options policy-statement export-static term 1 then tag 10

set policy-options policy-statement export-static term 1 then accept

验证

root@VMX-BJ> show route

inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

10.0.255.2/32      *[Direct/0] 01:14:45

                    > via lo0.0

10.0.255.3/32      *[OSPF/150] 00:26:27, metric 0, tag 10

                    > to 192.168.12.1 via ge-0/0/0.0

10.1.255.3/32      *[OSPF/150] 00:26:27, metric 0, tag 10

                    > to 192.168.12.1 via ge-0/0/0.0

10.1.255.33/32    *[OSPF/150] 00:26:27, metric 0, tag 10

                    > to 192.168.12.1 via ge-0/0/0.0

192.168.12.0/24    *[Direct/0] 01:13:19

                    > via ge-0/0/0.0

192.168.12.2/32    *[Local/0] 01:13:20

                      Local via ge-0/0/0.0

224.0.0.5/32      *[OSPF/10] 01:14:49, metric 1

                      MultiRecv

root@VMX-SH> show route

inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

10.0.255.3/32      *[OSPF/150] 00:26:52, metric 0, tag 10

                    > to 192.168.14.1 via ge-0/0/1.0

10.0.255.4/32      *[Direct/0] 01:15:11

                    > via lo0.0

10.1.255.3/32      *[OSPF/150] 00:26:52, metric 0, tag 10

                    > to 192.168.14.1 via ge-0/0/1.0

10.1.255.33/32    *[OSPF/150] 00:26:52, metric 0, tag 10

                    > to 192.168.14.1 via ge-0/0/1.0

192.168.14.0/24    *[Direct/0] 01:13:46

                    > via ge-0/0/1.0

192.168.14.4/32    *[Local/0] 01:13:48

                      Local via ge-0/0/1.0

192.168.100.0/24  *[OSPF/150] 00:29:56, metric 0, tag 10

                    > to 192.168.14.1 via ge-0/0/1.0

224.0.0.5/32      *[OSPF/10] 01:15:15, metric 1

                      MultiRecv

root@VMX-FZ> show route

inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

10.0.255.1/32      *[OSPF/10] 01:13:21, metric 1

                    > to 192.168.13.1 via ge-0/0/3.0

10.0.255.2/32      *[OSPF/150] 00:14:02, metric 0, tag 100

                    > to 192.168.13.1 via ge-0/0/3.0

10.0.255.3/32      *[Direct/0] 01:15:39

                    > via lo0.0

10.0.255.4/32      *[OSPF/150] 00:10:00, metric 0, tag 200

                    > to 192.168.13.1 via ge-0/0/3.0

10.1.255.3/32      *[Direct/0] 01:15:39

                    > via lo0.0

10.1.255.33/32    *[Direct/0] 01:15:39

                    > via lo0.0

192.168.13.0/24    *[Direct/0] 01:14:12

                    > via ge-0/0/3.0

192.168.13.3/32    *[Local/0] 01:14:13

                      Local via ge-0/0/3.0

192.168.100.0/24  *[Static/5] 00:30:21

                      Discard

224.0.0.5/32      *[OSPF/10] 01:15:39, metric 1

                      MultiRecv

root@VMX-C# run show route       

inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

10.0.255.1/32      *[Direct/0] 01:16:01

                    > via lo0.0

10.0.255.2/32      *[OSPF/150] 00:14:25, metric 0, tag 100

                    > to 192.168.12.2 via ge-0/0/0.0

10.0.255.3/32      *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.0.255.4/32      *[OSPF/150] 00:10:24, metric 0, tag 200

                    > to 192.168.14.4 via ge-0/0/1.0

10.1.255.3/32      *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.33/32    *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.5.0.0/16        *[Static/5] 01:16:01

                    > to 10.5.245.254 via em0.0

10.5.245.0/24      *[Direct/0] 01:16:01

                    > via em0.0

10.5.245.90/32    *[Local/0] 01:16:01

                      Local via em0.0

192.168.13.0/24    *[Direct/0] 01:14:35

                    > via ge-0/0/3.0

192.168.13.1/32    *[Local/0] 01:14:37

                      Local via ge-0/0/3.0

192.168.100.0/24  *[OSPF/150] 00:30:43, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

224.0.0.5/32      *[OSPF/10] 01:16:02, metric 1

                      MultiRecv

VR-BJ.inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

10.0.255.1/32      *[Direct/0] 01:16:01

                    > via lo0.0       

10.0.255.2/32      *[OSPF/150] 00:14:25, metric 0, tag 100

                    > to 192.168.12.2 via ge-0/0/0.0

10.0.255.3/32      *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.3/32      *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.33/32    *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

192.168.12.0/24    *[Direct/0] 01:14:35

                    > via ge-0/0/0.0

192.168.12.1/32    *[Local/0] 01:14:37

                      Local via ge-0/0/0.0

192.168.13.0/24    *[Direct/0] 01:14:35

                    > via ge-0/0/3.0

192.168.13.1/32    *[Local/0] 01:14:35

                      Local via ge-0/0/3.0

192.168.100.0/24  *[OSPF/150] 00:30:43, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

224.0.0.5/32      *[OSPF/10] 01:16:02, metric 1

                      MultiRecv

VR-SH.inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

10.0.255.1/32      *[Direct/0] 01:16:01

                    > via lo0.0

10.0.255.3/32      *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.0.255.4/32      *[OSPF/150] 00:10:24, metric 0, tag 200

                    > to 192.168.14.4 via ge-0/0/1.0

10.1.255.3/32      *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.33/32    *[OSPF/150] 00:27:39, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

192.168.13.0/24    *[Direct/0] 01:14:35

                    > via ge-0/0/3.0

192.168.13.1/32    *[Local/0] 01:14:35

                      Local via ge-0/0/3.0

192.168.14.0/24    *[Direct/0] 01:14:35

                    > via ge-0/0/1.0

192.168.14.1/32    *[Local/0] 01:14:37

                      Local via ge-0/0/1.0

192.168.100.0/24  *[OSPF/150] 00:30:43, metric 0, tag 10

                    > to 192.168.13.3 via ge-0/0/3.0

224.0.0.5/32      *[OSPF/10] 01:16:02, metric 1

                      MultiRecv

相关文章

网友评论

      本文标题:多实例OSPF与RIB-GROUP及策略tag的应用

      本文链接:https://www.haomeiwen.com/subject/remtqltx.html