一.实验拓扑图
二.实验步骤
三、实验过程
[R1]bgp 65001
[R1-bgp]peer 10.0.1.6 as-num 65002
[R1-bgp]peer 4.4.4.4 as-num 65002
[R1-bgp]peer 4.4.4.4 connect-int lo0
[R1-bgp]peer 4.4.4.4 next-hop-lo
[R4]bgp 65001
[R4-bgp]peer 10.0.1.10 as-num 65002
[R4-bgp]peer 1.1.1.1 as-num 65001
[R4-bgp]peer 1.1.1.1 connect-int lo0
[R4-bgp]peer 1.1.1.1 next-hop-lo
[R2]bgp 65002
[R2-bgp]peer 10.0.1.5 as-num 65001
[R2-bgp]group rr internal
[R2-bgp]peer rr next-hop-lo
[R2-bgp]peer rr connect-int lo0
[R2-bgp]peer 3.3.3.3 group rr
[R2-bgp]peer 5.5.5.5 group rr
[R2-bgp]peer 6.6.6.6 group rr
[R3]bgp 65002
[R3-bgp]peer 10.0.1.9 as-num 65001
[R3-bgp]group nn internal
[R3-bgp]peer nn next-hop-lo
[R3-bgp]peer nn connect-int lo0
[R3-bgp]peer 2.2.2.2 group nn
[R3-bgp]peer 5.5.5.5 group nn
[R3-bgp]peer 6.6.6.6 group nn
[R5]bgp 65002
[R5-bgp]group mm internal
[R5-bgp]peer mm next
[R5-bgp]peer mm next-hop-local
[R5-bgp]peer mm con
[R5-bgp]peer mm connect-interface lo0
[R5-bgp]peer 2.2.2.2 group mm
[R5-bgp]peer 3.3.3.3 group mm
[R5-bgp]peer 6.6.6.6 group mm
[R6]bgp 65002
[R6-bgp]group ii internal
[R6-bgp]peer ii ne
[R6-bgp]peer ii next-hop-local
[R6-bgp]peer ii con
[R6-bgp]peer ii connect-interface lo0
[R6-bgp]peer 2.2.2.2 group ii
[R6-bgp]peer 5.5.5.5 group ii
[R6-bgp]peer 3.3.3.3 group ii
[R6-bgp]
[R2-bgp]net 10.10.5.1 32
[R2-bgp]net 10.10.6.1 32
[R2-bgp]
[R3-bgp]net 10.10.5.1 32
[R3-bgp]net 10.10.6.1 32
[R3-bgp]
[R1-bgp]net 10.30.1.1 32
[R4-bgp]net 10.40.4.1 32
三.调试以及结果分析
在所有配置完成之后:
查看R1的BGP路由表:
[H3C]dis bgp routing-table
Total Number of Routes: 5
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 0 0 i
*> 2.2.2.2/32 10.0.1.6 0 0 10i
*> 4.4.4.4/32 10.0.1.6 0 10 40i
*> 10.30.1.1/32 0.0.0.0 0 0 i
*> 10.40.4.1/32 10.0.1.6 0 10 40i
[H3C]dis ip rou
[H3C]dis ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.2/32 BGP 255 0 10.0.1.6 Eth0/1/0
4.4.4.4/32 BGP 255 0 10.0.1.6 Eth0/1/0
10.0.1.4/30 Direct 0 0 10.0.1.5 Eth0/1/0
10.0.1.5/32 Direct 0 0 127.0.0.1 InLoop0
10.30.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.40.4.1/32 BGP 255 0 10.0.1.6 Eth0/1/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
这里因为R1没有和R3建立邻居,所以R3发布的业务网段,不能够被R1学习到,因为R3发布的业务网段通过IGP进入到R2的IP路由表,而R1想要学习R3的业务网段路由,只能通过BGP路由进行学习,所以没有3.3.3.3这条路由
同样在R4中
[H3C]dis bgp routing-table
Total Number of Routes: 5
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 10.0.1.10 0 10 30i
*> 3.3.3.3/32 10.0.1.10 0 0 10i
*> 4.4.4.4/32 0.0.0.0 0 0 i
*> 10.30.1.1/32 10.0.1.10 0 10 30i
*> 10.40.4.1/32 0.0.0.0 0 0 i
[H3C]dis ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 BGP 255 0 10.0.1.10 Eth0/1/1
3.3.3.3/32 BGP 255 0 10.0.1.10 Eth0/1/1
4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0
10.0.1.8/30 Direct 0 0 10.0.1.9 Eth0/1/1
10.0.1.9/32 Direct 0 0 127.0.0.1 InLoop0
10.30.1.1/32 BGP 255 0 10.0.1.10 Eth0/1/1
10.40.4.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在R4的BGP路由表中也没有2.2.2.2这条路由,解决这些问题的方法是,在R1和R4之间建立EBGP,R1和R4之间就能够交换BGP路由信息.
[H3C]dis bgp routing-table
Total Number of Routes: 8
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 10.0.1.5 0 0 30i
*> 2.2.2.2/32 0.0.0.0 0 0 i
i 3.3.3.3/32 3.3.3.3 0 100 0 i
*>i 4.4.4.4/32 3.3.3.3 0 100 0 40i
i 5.5.5.5/32 5.5.5.5 0 100 0 i
* i 10.10.5.1/32 5.5.5.5 0 100 0 i
*> 10.30.1.1/32 10.0.1.5 0 0 30i
*>i 10.40.4.1/32 3.3.3.3 0 100 0 40i
[H3C]dis ip routing-table
Routing Tables: Public
Destinations : 18 Routes : 18
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 BGP 255 0 10.0.1.5 Eth0/1/0
2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0
3.3.3.3/32 OSPF 10 30 10.0.1.18 Eth0/1/2
4.4.4.4/32 BGP 255 0 3.3.3.3 Eth0/1/2
5.5.5.5/32 OSPF 10 10 10.0.1.18 Eth0/1/2
6.6.6.6/32 OSPF 10 20 10.0.1.18 Eth0/1/2
10.0.1.4/30 Direct 0 0 10.0.1.6 Eth0/1/0
10.0.1.6/32 Direct 0 0 127.0.0.1 InLoop0
10.0.1.16/30 Direct 0 0 10.0.1.17 Eth0/1/2
10.0.1.17/32 Direct 0 0 127.0.0.1 InLoop0
10.0.1.20/30 OSPF 10 30 10.0.1.18 Eth0/1/2
10.0.1.24/30 OSPF 10 20 10.0.1.18 Eth0/1/2
10.10.5.1/32 OSPF 10 10 10.0.1.18 Eth0/1/2
10.10.6.1/32 OSPF 10 20 10.0.1.18 Eth0/1/2
10.30.1.1/32 BGP 255 0 10.0.1.5 Eth0/1/0
10.40.4.1/32 BGP 255 0 3.3.3.3 Eth0/1/2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在R2的调试信息中,R3的业务网段在BGP路由表中,但是不能进入到IP转发表中.原因是IGP的优先级高于BGP优先级,虽然R3也通过BGP也发布了业务网段,但是仍然进入不了IP 转发表.
同理在R3调试信息中:
[H3C]dis bgp routing-table
Total Number of Routes: 8
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 2.2.2.2 0 100 0 30i
i 2.2.2.2/32 2.2.2.2 0 100 0 i
*> 3.3.3.3/32 0.0.0.0 0 0 i
*> 4.4.4.4/32 10.0.1.9 0 0 40i
i 6.6.6.6/32 6.6.6.6 0 100 0 i
* i 10.10.6.1/32 6.6.6.6 0 100 0 i
*>i 10.30.1.1/32 2.2.2.2 0 100 0 30i
*> 10.40.4.1/32 10.0.1.9 0 0 40i
[H3C]dis ip routing-table
Routing Tables: Public
Destinations : 18 Routes : 18
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 BGP 255 0 2.2.2.2 Eth0/1/1
2.2.2.2/32 OSPF 10 30 10.0.1.22 Eth0/1/1
3.3.3.3/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.4/32 BGP 255 0 10.0.1.9 Eth0/1/3
5.5.5.5/32 OSPF 10 20 10.0.1.22 Eth0/1/1
6.6.6.6/32 OSPF 10 10 10.0.1.22 Eth0/1/1
10.0.1.8/30 Direct 0 0 10.0.1.10 Eth0/1/3
10.0.1.10/32 Direct 0 0 127.0.0.1 InLoop0
10.0.1.16/30 OSPF 10 30 10.0.1.22 Eth0/1/1
10.0.1.20/30 Direct 0 0 10.0.1.21 Eth0/1/1
10.0.1.21/32 Direct 0 0 127.0.0.1 InLoop0
10.0.1.24/30 OSPF 10 20 10.0.1.22 Eth0/1/1
10.10.5.1/32 OSPF 10 20 10.0.1.22 Eth0/1/1
10.10.6.1/32 OSPF 10 10 10.0.1.22 Eth0/1/1
10.30.1.1/32 BGP 255 0 2.2.2.2 Eth0/1/1
10.40.4.1/32 BGP 255 0 10.0.1.9 Eth0/1/3
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
同样,在R3的BGP路由表中也有2.2.2.2这条路由,但是并不是最优,进入不了IP转发表,因为IP转发表中2.2.2.2这条路由是来源于OSPF.
下面再引出一个问题,在R1上不能发现R5发布的业务网段,这是为什么?
因为在我的配置中,R2发布BGP网段的时候,没有直接把R5的业务网段当做自己的直连发布出去给R1,所以R1上没有R5上的业务网段是正常的.那么为了实现业务的连通,可以通过多种方法来实现,在R2上用BGP发布就是一种方法.