目录
BGP反射器
实验拓扑
实验需求
R1为客户机 R2为路由反射器 R3为非客户机
实验步骤
1.配置IP地址及环回口地址
2.配置BGP并建立邻居
R1
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 172.18.1.1 24
[Huawei]int l0
[Huawei-LoopBack0]1.1.1.1 32
[Huawei]bgp 100
[Huawei-bgp]peer 172.18.1.2 as-number 100
[Huawei-bgp]network 1.1.1.1 32 //宣告网段
R2
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 172.18.1.1 24
[Huawei-GigabitEthernet0/0/0]ip address 172.18.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 172.16.1.1 24
[Huawei]bgp 100
[Huawei-bgp]peer 172.18.1.1 as-number 100
[Huawei-bgp]peer 172.16.1.2 as-number 100
R3
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 172.16.1.2 24
[Huawei-GigabitEthernet0/0/0]bgp 100
[Huawei-bgp]peer 172.16.1.1 as-number 100
在R2上查看BGP邻居表
Huawei]dis bgp peer
BGP local router ID : 172.18.1.2
Local AS number : 100
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
172.16.1.2 4 100 29 32 0 00:26:44 Established 1
172.18.1.1 4 100 31 31 0 00:27:37 Established 2
在R2上做反射器
[Huawei-bgp]peer 172.18.1.1 reflect-client
在R3上查看1.1.1.1 路由表,进行观察
[R3-bgp]dis bgp routing-table
BGP Local router ID is 172.16.1.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
i 1.1.1.1/32 172.18.1.1 0 100 0 i
在R3上查看1.1.1.1 路由详细信息
[R3]dis bgp routing-table 1.1.1.1 32
BGP local router ID : 172.16.1.2
Local AS number : 100
Paths: 1 available, 0 best, 0 select
BGP routing table entry information of 1.1.1.1/32:
From: 172.16.1.1 (172.18.1.2)
Route Duration: 00h04m16s
Relay IP Nexthop: 0.0.0.0
Relay IP Out-Interface:
Original nexthop: 172.18.1.1
Qos information : 0x0
AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, internal, pre 255
Originator: 172.18.1.1
Cluster list: 172.18.1.2
Not advertised to any peer yet
Originator:始发者的IP地址
Cluster list : 经过了一个RR
BGP联盟实验
实验拓扑
实验需求
- 所有设备运行BGP协议,AS100划分两个子AS ,R5为AS 200
- R4可以学到R1宣告的路由信息
- AS 100 利用 OSPF 协议解决内部网络互通
- R3 和 R5 利用直连接口建立 EBGP 邻居
实验步骤
配置IP地址及环回口地址
运行BGP协议配置如下
AR1
[AR1]BGP 65001
[AR1-bgp]peer 172.18.1.2 as-number 65001
[AR1-bgp]network 1.1.1.1 32 //宣告网段
AR2
[AR2]bgp 65001
[AR2-bgp]confederation id 100
[AR2-bgp]confederation peer-as 65002
[AR2-bgp]confederation peer-as 65001
[AR2-bgp]peer 172.18.1.1 as-number 65001
[AR2-bgp]peer 172.16.1.2 as-number 65002
AR3
[AR3]bgp 65002
[AR3-bgp]confederation id 100
[AR3-bgp]peer 172.17.1.1 as-number 65002
AR4
[AR4]bgp 65002
[AR4-bgp]peer 172.17.1.2 as-number 65002
在AR2上查看BGP邻居表
[AR2]dis bgp peer
BGP local router ID : 172.18.1.2
Local AS number : 65001
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
172.16.1.2 4 65002 61 63 0 00:59:32 Established 0
172.18.1.1 4 65001 69 67 0 01:05:20 Established 1
在AR3上查看BGP邻居表
[AR3]dis bgp peer
BGP local router ID : 172.16.1.2
Local AS number : 65002
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
172.16.1.1 4 65001 61 60 0 00:58:35 Established 1
172.17.1.1 4 65002 24 26 0 00:22:49 Established 0
AS 100 内部使用OSPF 实现互通
在R4上查看路由表
破除了IBGP水平分割
[Huawei]dis bgp routing-table
BGP Local router ID is 172.17.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 172.18.1.1 0 100 0 (65001)i
在R3和R5上建立EBGP邻居关系
[AR3]bgp 65002
[AR3-bgp]peer 20.20.1.1 as-number 200
创建环回口,在R5上把网段宣告进BGP
R5-bgp]int l0
[R5-LoopBack0]ip address 2.2.2.2 32
[R5]bgp 200
[R5-bgp]peer 20.20.1.2 as-number 100
[R5-bgp]network 2.2.2.2 32
在R3上查看邻居
[AR3]dis bgp peer
BGP local router ID : 172.16.1.2
Local AS number : 65002
Total number of peers : 3 Peers in established state : 3
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
20.20.1.1 4 200 43 52 0 00:40:21 Established 1
172.16.1.1 4 65001 43 44 0 00:40:19 Established 1
172.17.1.1 4 65002 39 44 0 00:37:42 Established 0
在R4上查看BGP路由表
发现学习到的R5 2.2.2.2 路由 不是可用最优的,因为下一跳不可达。
[Huawei]dis bg routing-table
BGP Local router ID is 172.17.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 172.18.1.1 0 100 0 (65001)i
i 2.2.2.2/32 20.20.1.1 0 100 0 200i
在R5上查看BGP 路由表
[R5]dis bgp routing-table
BGP Local router ID is 20.20.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 20.20.1.2 0 100i
*> 2.2.2.2/32 0.0.0.0 0 0 i
总结:
联盟将一个AS划分为若干个子AS。每个子AS内部建立IBGP全连接关系,子AS之间建立联盟EBGP连接关系,但联盟外部AS仍认为联盟是一个AS。