![图片[1]-4.7 优选从EBGP邻居学习到的路由-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片6-24.png)
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、R2查看BGP路由
不优选的原因是not preferred for peer type,peer两种类型:IBGP、EBGP,EBGP>IBGP
<R1>display bgp routing-table
*> 3.3.3.3/32 13.1.1.3 0 0 300i
* i 2.2.2.2 0 100 0 300i
<R2>display bgp routing-table
*> 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 3.3.3.3
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 3.3.3.3/32:
From: 23.1.1.3 (3.3.3.3)
Route Duration: 00h12m10s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 23.1.1.3
Qos information : 0x0
AS-path 300, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255
Advertised to such 1 peers:
1.1.1.1
BGP routing table entry information of 3.3.3.3/32:
From: 1.1.1.1 (1.1.1.1)
Route Duration: 00h11m05s
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 300, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 1, not preferred for peer type
Not advertised to any peer yet
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容