美文网首页
juniper多路由实例OSPF与RIB-GROUP

juniper多路由实例OSPF与RIB-GROUP

作者: 严炎2016 | 来源:发表于2021-03-01 17:54 被阅读0次

juniper没有ospf多进程概念,用多virtual-router来做

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

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 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-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 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 export-to-bj term 1 from route-filter 10.0.255.0/24 prefix-length-range /32-/32

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

set policy-options policy-statement export-to-bj term 2 from route-filter 10.1.255.3/32 exact

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

set policy-options policy-statement export-to-fz term 1 from route-filter 10.0.255.0/24 prefix-length-range /32-/32

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

set policy-options policy-statement export-to-sh term 1 from route-filter 10.0.255.0/24 prefix-length-range /32-/32

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

set policy-options policy-statement export-to-sh term 2 from route-filter 10.1.255.33/32 exact

set policy-options policy-statement export-to-sh term 2 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-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 router-id 10.0.255.3

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

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 area 0.0.0.0 interface lo0.0 passive

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

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 area 0.0.0.0 interface lo0.0 passive

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

验证:

root@VMX-C> show route       

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

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

10.0.255.1/32      *[Direct/0] 03:05:48

                    > via lo0.0

10.0.255.2/32      *[OSPF/10] 00:29:06, metric 1

                    > to 192.168.12.2 via ge-0/0/0.0

10.0.255.3/32      *[OSPF/10] 00:38:38, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.0.255.4/32      *[OSPF/10] 00:29:06, metric 1

                    > to 192.168.14.4 via ge-0/0/1.0

10.1.255.3/32      *[OSPF/10] 00:23:41, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.33/32    *[OSPF/10] 00:23:41, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.5.0.0/16        *[Static/5] 02:55:59

                    > to 10.5.245.254 via em0.0

10.5.245.0/24      *[Direct/0] 02:55:59

                    > via em0.0

10.5.245.90/32    *[Local/0] 02:55:59

                      Local via em0.0

192.168.13.0/24    *[Direct/0] 02:28:17

                    > via ge-0/0/3.0

192.168.13.1/32    *[Local/0] 02:28:17

                      Local via ge-0/0/3.0

224.0.0.5/32      *[OSPF/10] 02:28:17, 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] 00:26:34

                    > via lo0.0

10.0.255.2/32      *[OSPF/10] 00:29:06, metric 1

                    > to 192.168.12.2 via ge-0/0/0.0

10.0.255.3/32      *[OSPF/10] 00:38:38, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.0.255.4/32      *[OSPF/10] 00:29:06, metric 1

                    > to 192.168.14.4 via ge-0/0/1.0

10.1.255.3/32      *[OSPF/10] 00:23:41, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.33/32    *[OSPF/10] 00:23:41, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

192.168.12.0/24    *[Direct/0] 02:28:17

                    > via ge-0/0/0.0

192.168.12.1/32    *[Local/0] 02:28:17

                      Local via ge-0/0/0.0

192.168.13.0/24    *[Direct/0] 00:26:34

                    > via ge-0/0/3.0

192.168.13.1/32    *[Local/0] 00:26:34

                      Local via ge-0/0/3.0

224.0.0.5/32      *[OSPF/10] 02:28:17, 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] 00:26:34

                    > via lo0.0

10.0.255.2/32      *[OSPF/10] 00:29:06, metric 1

                    > to 192.168.12.2 via ge-0/0/0.0

10.0.255.3/32      *[OSPF/10] 00:38:38, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.0.255.4/32      *[OSPF/10] 00:29:06, metric 1

                    > to 192.168.14.4 via ge-0/0/1.0

10.1.255.3/32      *[OSPF/10] 00:23:41, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

10.1.255.33/32    *[OSPF/10] 00:23:41, metric 1

                    > to 192.168.13.3 via ge-0/0/3.0

192.168.13.0/24    *[Direct/0] 00:26:34

                    > via ge-0/0/3.0

192.168.13.1/32    *[Local/0] 00:26:34

                      Local via ge-0/0/3.0

192.168.14.0/24    *[Direct/0] 02:28:17

                    > via ge-0/0/1.0

192.168.14.1/32    *[Local/0] 02:28:17

                      Local via ge-0/0/1.0

224.0.0.5/32      *[OSPF/10] 02:28:17, metric 1

                      MultiRecv

root@VMX-C> show route 10.0.255.2 detail 

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

10.0.255.2/32 (1 entry, 1 announced)

        *OSPF  Preference: 10

                Next hop type: Router, Next hop index: 613

                Address: 0x9694600

                Next-hop reference count: 6

                Next hop: 192.168.12.2 via ge-0/0/0.0, selected

                Session Id: 0x140

                State: <Secondary Active Int>

                Age: 30:54      Metric: 1

                Validation State: unverified

                Area: 0.0.0.0

                Task: VR-BJ-OSPF

                Announcement bits (2): 0-KRT 2-OSPF

                AS path: I

                Primary Routing Table VR-BJ.inet.0

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

10.0.255.2/32 (1 entry, 1 announced)

        *OSPF  Preference: 10

                Next hop type: Router, Next hop index: 613

                Address: 0x9694600

                Next-hop reference count: 6

                Next hop: 192.168.12.2 via ge-0/0/0.0, selected

                Session Id: 0x140

                State: <Active Int>

                Age: 30:54      Metric: 1

                Validation State: unverified

                Area: 0.0.0.0

                Task: VR-BJ-OSPF

                Announcement bits (1): 1-KRT

                AS path: I

                Secondary Tables: VR-SH.inet.0 inet.0

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

10.0.255.2/32 (1 entry, 1 announced)

        *OSPF  Preference: 10

                Next hop type: Router, Next hop index: 613

                Address: 0x9694600

                Next-hop reference count: 6

                Next hop: 192.168.12.2 via ge-0/0/0.0, selected

                Session Id: 0x140

                State: <Secondary Active Int>

                Age: 30:54      Metric: 1

                Validation State: unverified

                Area: 0.0.0.0

                Task: VR-BJ-OSPF

                Announcement bits (2): 0-VR-SH-OSPF 1-KRT

                AS path: I

                Primary Routing Table VR-BJ.inet.0

root@VMX-BJ> show route

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

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

10.0.255.1/32      *[OSPF/150] 00:30:43, metric 0, tag 0

                    > to 192.168.12.1 via ge-0/0/0.0

10.0.255.2/32      *[Direct/0] 03:16:48

                    > via lo0.0

10.0.255.3/32      *[OSPF/150] 00:36:21, metric 1, tag 0

                    > to 192.168.12.1 via ge-0/0/0.0

10.0.255.4/32      *[OSPF/150] 00:33:15, metric 1, tag 0

                    > to 192.168.12.1 via ge-0/0/0.0

10.1.255.3/32      *[OSPF/150] 00:27:50, metric 1, tag 0

                    > to 192.168.12.1 via ge-0/0/0.0

192.168.12.0/24    *[Direct/0] 03:16:48

                    > via ge-0/0/0.0

192.168.12.2/32    *[Local/0] 03:16:48

                      Local via ge-0/0/0.0

224.0.0.5/32      *[OSPF/10] 03:16:48, metric 1

                      MultiRecv

root@VMX-BJ> ping source 10.0.255.2 10.0.255.3 rapid count 4

PING 10.0.255.3 (10.0.255.3): 56 data bytes

!!!!

--- 10.0.255.3 ping statistics ---

4 packets transmitted, 4 packets received, 0% packet loss

round-trip min/avg/max/stddev = 3.503/4.258/5.065/0.655 ms

root@VMX-BJ> ping source 10.0.255.2 10.0.255.4 rapid count 4

PING 10.0.255.4 (10.0.255.4): 56 data bytes

!!!!

--- 10.0.255.4 ping statistics ---

4 packets transmitted, 4 packets received, 0% packet loss

round-trip min/avg/max/stddev = 3.687/4.315/5.487/0.715 ms

root@VMX-BJ> ping source 10.0.255.2 10.0.255.1 rapid count 4

PING 10.0.255.1 (10.0.255.1): 56 data bytes

!!!!

--- 10.0.255.1 ping statistics ---

4 packets transmitted, 4 packets received, 0% packet loss

round-trip min/avg/max/stddev = 2.158/3.096/4.955/1.132 ms

root@VMX-BJ> ping source 10.0.255.2 10.1.255.3 rapid count 4

PING 10.1.255.3 (10.1.255.3): 56 data bytes

!!!!

--- 10.1.255.3 ping statistics ---

4 packets transmitted, 4 packets received, 0% packet loss

round-trip min/avg/max/stddev = 3.580/4.753/5.936/1.071 ms

相关文章

网友评论

      本文标题:juniper多路由实例OSPF与RIB-GROUP

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