需求
如图所示,R1发布192.168.10.0/24路由,由于IBGP水平分割问题,导致R3就学不到192.168.10.0/24路由,造成路由丢失,现需使用路由反射实现R3学习到192.168.10.0这条路由
组网图
实验思路
1、基本链路通信
2、BGP建立邻居关系
3、通过IGP与BGP同步实现IBGP与IBGP之间的学习(此处我用的IGP是OSPF)
R1
<Huawei>un ter mon
Info: Current terminal monitor is off.
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]un in en
Info: Information center is disabled.
[Huawei]
[Huawei]sysname R1
[R1]
[R1]int loo0
[R1-LoopBack0]
[R1-LoopBack0]ip ad 1.1.1.1 32
[R1-LoopBack0]
[R1-LoopBack0]int loo1
[R1-LoopBack1]
[R1-LoopBack1]ip ad 192.168.10.1 24
[R1-LoopBack1]
[R1-LoopBack1]int g0/0/0
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]ip ad 172.16.0.1 30
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]q
R2
<Huawei>un ter mon
Info: Current terminal monitor is off.
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]un in en
Info: Information center is disabled.
[Huawei]
[Huawei]sysname R2
[R2]
[R2]int loo0
[R2-LoopBack0]
[R2-LoopBack0]ip ad 2.2.2.2 32
[R2-LoopBack0]
[R2-LoopBack0]int g0/0/0
[R2-GigabitEthernet0/0/0]
[R2-GigabitEthernet0/0/0]ip ad 172.16.0.2 30
[R2-GigabitEthernet0/0/0]
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]
[R2-GigabitEthernet0/0/1]ip ad 172.16.0.9 30
[R2-GigabitEthernet0/0/1]
[R2-GigabitEthernet0/0/1]q
R3
<Huawei>un ter mon
Info: Current terminal monitor is off.
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]un in en
Info: Information center is disabled.
[Huawei]
[Huawei]sysname R3
[R3]
[R3]int loo0
[R3-LoopBack0]
[R3-LoopBack0]ip ad 3.3.3.3 32
[R3-LoopBack0]
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]ip ad 172.16.0.10 30
[R3-GigabitEthernet0/0/0]
[R3-GigabitEthernet0/0/0]q
配完接口地址记得测试一下
建立OSPF邻居关系(注:先建立OSPF邻居是为了是三个路由器的loopback地址能相互通信,方便后面建立BGP邻居关系,如果先建立BGP邻居关系则需要单独写静态路由使三个路由器的loopback地址相互通信)
R1
[R1]ospf 1
[R1-ospf-1]
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]
[R1-ospf-1-area-0.0.0.0]net 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]
[R1-ospf-1-area-0.0.0.0]net 172.16.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]
R2
[R2]
[R2]ospf 1
[R2-ospf-1]
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]
[R2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]
[R2-ospf-1-area-0.0.0.0]net 172.16.0.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]
[R2-ospf-1-area-0.0.0.0]net 172.16.0.9 0.0.0.0
[R2-ospf-1-area-0.0.0.0]
R3
[R3]ospf 1
[R3-ospf-1]
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]
[R3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]
[R3-ospf-1-area-0.0.0.0]net 172.16.0.10 0.0.0.0
[R3-ospf-1-area-0.0.0.0]
查看OSPF邻居关系
OSPF邻居关系建立成功
建立BGP邻居 关系
R1
[R1]bgp 100
[R1-bgp]
[R1-bgp]router-id 1.1.1.1
[R1-bgp]
[R1-bgp]peer 2.2.2.2 as-number 100
[R1-bgp]
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack0
[R1-bgp]
R2
[R2]bgp 100
[R2-bgp]
[R2-bgp]router-id 2.2.2.2
[R2-bgp]
[R2-bgp]peer 1.1.1.1 as-number 100
[R2-bgp]
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack0
[R2-bgp]
[R2-bgp]peer 3.3.3.3 as-number 100
[R2-bgp]
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack0
[R2-bgp]
R3
[R3]bgp 100
[R3-bgp]
[R3-bgp]router-id 3.3.3.3
[R3-bgp]
[R3-bgp]peer 2.2.2.2 as-number 100
[R3-bgp]
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack0
[R3-bgp]
查看BGP邻居关系
建立成功
在R1上宣告192.168.10.0路由
[R1-bgp]net 192.168.10.0 255.255.255.0
查看BGP路由表
R3没有学习到这条路由
接下来我们采用路由反让R3学习到R1宣告的192.168.10.0这条路由
路由反射存在客户端、非客户端、RR三种身份
此组网以R1为客户端,R2为RR,只需在R2上设置路由反射即可
[R2-bgp]peer 1.1.1.1 reflect-client
查看效果
没问题,最优可达且可以访问
总配置内容
R1
un ter mon
sys
un in en
sysname R1
int loo0
ip ad 1.1.1.1 32
int loo1
ip ad 192.168.10.1 24
int g0/0/0
ip ad 172.16.0.1 30
q
ospf 1
area 0
net 1.1.1.1 0.0.0.0
net 172.16.0.1 0.0.0.0
bgp 100
router-id 1.1.1.1
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
net 192.168.10.0 255.255.255.0
R2
un ter mon
sys
un in en
sysname R2
int loo0
ip ad 2.2.2.2 32
int g0/0/0
ip ad 172.16.0.2 30
int g0/0/1
ip ad 172.16.0.9 30
q
ospf 1
area 0
net 2.2.2.2 0.0.0.0
net 172.16.0.2 0.0.0.0
net 172.16.0.9 0.0.0.0
q
q
bgp 100
router-id 2.2.2.2
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
peer 1.1.1.1 reflect-client
R3
un ter mon
sys
un in en
sysname R3
int loo0
ip ad 3.3.3.3 32
int g0/0/0
ip ad 172.16.0.10 30
q
ospf 1
area 0
net 3.3.3.3 0.0.0.0
net 172.16.0.10 0.0.0.0
q
q
bgp 100
router-id 3.3.3.3
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
q