4.8 优选从更近的BGP邻居学习的路由

图片[1]-4.8 优选从更近的BGP邻居学习的路由-大赛人网
图4-8  优选从更近的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
[R1-ospf-1-area-0.0.0.0]network 13.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
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255

3.R3配置OSPF

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.255.255.255

4.R1配置IBGP

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

5.R2配置IBGP

[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

6.R1配置EBGP

[R1]bgp 12
[R1-bgp]peer 3.3.3.3 as-number 300
[R1-bgp]peer 3.3.3.3 connect-interface LoopBack 0                    
[R1-bgp]peer 3.3.3.3 ebgp-max-hop

7.R2配置EBGP

[R2]bgp 12
[R2-bgp]peer 3.3.3.3 as-number 300
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0  
[R2-bgp]peer 3.3.3.3 ebgp-max-hop

8.R3配置EBGP

[R3]bgp 300
[R3-bgp]peer 1.1.1.1 as-number 12
[R3-bgp]peer 1.1.1.1 connect-interface LoopBack 0                  
[R3-bgp]peer 1.1.1.1 ebgp-max-hop
[R3-bgp]peer 2.2.2.2 as-number 12
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 2.2.2.2 ebgp-max-hop

9.R3查看BGP邻居

[R3]display bgp peer 
  1.1.1.1         4          12        3        3     0 00:01:05 Established       0
  2.2.2.2         4          12        2        2     0 00:00:28 Established       0

10.R2创建,宣告进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

11.R3查看BGP路由

[R3]display bgp routing-table 
 *>   1.1.2.1/32         1.1.1.1                               0      12i
 *                       2.2.2.2         0                     0      12i

12.R3查看OSPF路由,去往R1、R2COST都为1

[R3]display ospf routing
 Destination        Cost  Type       NextHop         AdvRouter       Area
 3.3.3.3/32         0     Stub       3.3.3.3         3.3.3.3         0.0.0.0
 13.0.0.0/8         1     Transit    13.1.1.3        3.3.3.3         0.0.0.0
 23.0.0.0/8         1     Transit    23.1.1.3        3.3.3.3         0.0.0.0
 1.1.1.1/32         1     Stub       13.1.1.1        1.1.1.1         0.0.0.0
 2.2.2.2/32         1     Stub       23.1.1.2        2.2.2.2         0.0.0.0
 12.0.0.0/8         2     Transit    13.1.1.1        1.1.1.1         0.0.0.0
 12.0.0.0/8         2     Transit    23.1.1.2        1.1.1.1         0.0.0.0

13.修改R1的LoopBack 0的OSPF的COST值

[R1]interface LoopBack 0
[R1-LoopBack0]ospf cost 9

14.查看R3的OSPF路由

[R3]display ospf routing
3.3.3.3/32         0     Stub       3.3.3.3         3.3.3.3         0.0.0.0
 13.0.0.0/8         1     Transit    13.1.1.3        3.3.3.3         0.0.0.0
 23.0.0.0/8         1     Transit    23.1.1.3        3.3.3.3         0.0.0.0
 1.1.1.1/32         10    Stub       13.1.1.1        1.1.1.1         0.0.0.0
 2.2.2.2/32         1     Stub       23.1.1.2        2.2.2.2         0.0.0.0
 12.0.0.0/8         2     Transit    13.1.1.1        1.1.1.1         0.0.0.0
 12.0.0.0/8         2     Transit    23.1.1.2        1.1.1.1         0.0.0.0

15.查看R3的BGP路由

R3从R2选择去往1.1.2.1/32路由,选择IGP度量值更优先的(R2的COST为1,R1的COST为10)。
[R3]display bgp routing-table 
 *>   1.1.2.1/32         2.2.2.2         0                     0      12i
 *                       1.1.1.1                               0      12i

[R3]display bgp routing-table 1.1.2.1
 BGP local router ID : 3.3.3.3
 Local AS number : 300
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 1.1.2.1/32:
 From: 2.2.2.2 (2.2.2.2)
 Route Duration: 00h07m08s  
 Relay IP Nexthop: 23.1.1.2
 Relay IP Out-Interface: GigabitEthernet0/0/1
 Original nexthop: 2.2.2.2
 Qos information : 0x0
 AS-path 12, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255, IGP cost 1
 Advertised to such 2 peers:
    1.1.1.1
    2.2.2.2
 BGP routing table entry information of 1.1.2.1/32:
 From: 1.1.1.1 (1.1.1.1)
 Route Duration: 00h07m08s  
 Relay IP Nexthop: 13.1.1.1
 Relay IP Out-Interface: GigabitEthernet0/0/2
 Original nexthop: 1.1.1.1
 Qos information : 0x0
 AS-path 12, origin igp, pref-val 0, valid, external, pre 255, IGP cost 10, not preferred for IGP cost
 Not advertised to any peer yet
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称

    请登录后查看评论内容