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


要求:

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

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 224,289评论 6 522
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 95,968评论 3 402
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 171,336评论 0 366
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 60,718评论 1 300
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 69,734评论 6 399
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 53,240评论 1 314
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 41,631评论 3 428
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 40,599评论 0 279
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 47,139评论 1 324
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 39,166评论 3 345
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 41,286评论 1 354
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 36,917评论 5 350
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 42,604评论 3 336
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 33,075评论 0 25
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 34,205评论 1 275
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 49,814评论 3 381
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 46,351评论 2 365

推荐阅读更多精彩内容