![图片[1]-4.12 优选最低BGP邻居地址路由-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片1-27.png)
1.R1配置OSPF
[R1]ospf 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 1.1.2.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.1.2 
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.1.2 0.0.0.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配置BGP
[R1]bgp 12
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.1.2 as-number 12
[R1-bgp]peer 2.2.1.2 connect-interface LoopBack 0
[R1-bgp]peer 2.2.2.2 as-number 12
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 1
4.R2配置BGP
[R2]bgp 12
[R2-bgp]router-id 2.2.1.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.2.1 as-number 12
[R2-bgp]peer 1.1.2.1 connect-interface LoopBack 1
5.R2宣告2.2.3.2/32到BGP
[R2-bgp]network 2.2.3.2 32
6.R1查看BGP信息,优选具有最小IP地址的路由(2.2.1.2/32)
[R1]display bgp routing-table 
 *>i  2.2.3.2/32         2.2.1.2         0          100        0      i
 * i                     2.2.2.2         0          100        0      i
[R1]display bgp routing-table 2.2.3.2
 BGP local router ID : 1.1.1.1
 Local AS number : 12
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 2.2.3.2/32:
 From: 2.2.1.2 (2.2.1.2)
 Route Duration: 00h07m46s  
 Relay IP Nexthop: 12.1.1.2
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 2.2.1.2
 Qos information : 0x0
 AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 1
 Not advertised to any peer yet
 BGP routing table entry information of 2.2.3.2/32:
 From: 2.2.2.2 (2.2.1.2)
 Route Duration: 00h02m47s  
 Relay IP Nexthop: 12.1.1.2
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 2.2.2.2
 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 peer address
 Not advertised to any peer yet
                    © 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
    













请登录后查看评论内容