4.3 优选从本地路由器始发的路由

从前两条选路原则不能选出最优BGP条目的情况下,优选从本地注入的BGP条目,方法有network、import-route、aggregate

图片[1]-4.3 优选从本地路由器始发的路由-大赛人网
图4-3  BGP选从本地路由器始发的路由网络拓扑

1.R1配置OSPF

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255

2.R2配置OSPF

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255

3.R1配置IBGP、EBGP

[R1]bgp 12
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 12
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 2.2.2.2 next-hop-local
[R1-bgp]peer 13.1.1.3 as-number 300

4.R2配置IBGP、EBGP

[R2]bgp 12
[R2-bgp]router-id 2.2.2.2 
[R2-bgp]peer 1.1.1.1 as-number 12
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 1.1.1.1 next-hop-local
[R2-bgp]peer 23.1.1.3 as-number 300

5.R3配置EBGP,宣告3.3.3.3/32到BGP

[R3]bgp 300
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 13.1.1.1 as-number 12
[R3-bgp]peer 23.1.1.2 as-number 12
[R3-bgp]network 3.3.3.3 32

6.R1创建LoopBack 1环回口,宣告到BGP

[R1]interface LoopBack 1
[R1-LoopBack1]ip address 1.1.2.1 32
[R1]bgp 12
[R1-bgp]network 1.1.2.1 32

7.R2创建相同LoopBack 1环回口,宣告到BGP

[R2]interface LoopBack 1
[R2-LoopBack1]ip address 1.1.2.1 32
[R2]bgp 12
[R2-bgp]network 1.1.2.1 32

8.R2查看BGP信息

[R2]display bgp routing-table 

 *>   1.1.2.1/32         0.0.0.0         0                     0      i
 * i                     1.1.1.1         0          100        0      i
 *>   3.3.3.3/32         23.1.1.3        0                     0      300i
 * i                     1.1.1.1         0          100        0      300i

[R2]display bgp routing-table 1.1.2.1

 BGP local router ID : 2.2.2.2
 Local AS number : 12
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 1.1.2.1/32:
 Network route. 
 From: 0.0.0.0 (0.0.0.0)
 Route Duration: 00h01m14s  
 Direct Out-interface: InLoopBack0
 Original nexthop: 127.0.0.1
 Qos information : 0x0
 AS-path Nil, origin igp, MED 0, pref-val 0, valid, local, best, select, pre 0
 Advertised to such 2 peers:
    1.1.1.1
    23.1.1.3
 BGP routing table entry information of 1.1.2.1/32:
 From: 1.1.1.1 (1.1.1.1)
 Route Duration: 00h02m58s  
 Relay IP Nexthop: 12.1.1.1
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 1.1.1.1
 Qos information : 0x0
 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 1, not preferred for route type
 Not advertised to any peer yet
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称

    请登录后查看评论内容