BGP全互聯
一.實驗拓撲圖
二.實驗步驟
三、實驗過程
[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發佈就是一種方法.