BGP-联邦.note

noteId: A90CA31465484DE492733D45DFEC369E · 原始路径:/ALL/网络 - C模块/1-路由协议合集、路由控制、策略路由/BGP (TCP-179)/BGP-联邦.note · 图片:9 · 附件待处理:0

 
·环境准备:
 
 
配置好基础IP地址后:
一、配置 BGP联邦:
BGP联邦用于将一个iBGP的AS划分为多个子AS
 
·关键(重要)命令介绍:
 
 
 
1、配置 BGP联邦:
 
(1)配置 R1(AS100):
eBGP的R1是常规配置(通过环回口与R2的环回口建立连接)
R1(config)#router 2.2.2.2 255.255.255.255 10.1.1.2    //配置静态,为双方环回口提供通信
R1(config)#router bgp 100
R1(config-router)#neighbor 2.2.2.2 remote-as 200
R1(config-router)#neighbor 2.2.2.2 update-source Loopback 0
R1(config-router)#neighbor 2.2.2.2 ebgp-multihop 2
# 配置命令的意思在‘BGP-基础配置’中有介绍
 
 
(2)配置 R2(AS200,联邦AS:65001):
R1(config)#router 1.1.1.1 255.255.255.255 10.1.1.1    //配置静态,为双方环回口提供通信
R1(config)#router bgp 65001
R2(config-router)#bgp confederation identifier 200    //在BGP路由器中配置当前路由器所在的BGP confederation的标识符,用于标识当前路由器所属的BGP confederation,以便进行BGP邻居关系的建立和路由信息交换(配置主AS号,上面和后面定义的65001都是BGP联邦的子AS号,用于iBGP内)
R2(config-router)#neighbor 1.1.1.1 remote-as 100    //与R1建立eBGP邻居关系
R2(config-router)#neighbor 1.1.1.1 ebgp-multihop 2    //设置TTL跳数为2(以能够正确的建立邻居关系)
R2(config-router)#neighbor 1.1.1.1 update-source Loopback 0    //通过环回口建立邻居
R2(config-router)#neighbor 11.1.1.1 remote-as 65001    //设置 R3的地址为邻居,建立iBGP邻居
R2(config-router)#neighbor 11.1.1.1 next-hop-self     //假如路由条目是由其它eBGP传入,传递给该iBGP邻居该路由条目时需要修改路由条目的下一跳为R2本身
R2(config-router)#bgp confederation peers 65002    //设置BGP对等体(在iBGP中通过BGP联邦建立逻辑上的eBGP邻居)【而65501,因为上面本身定义的就是65001,与65001是iBGP邻居,因此就不需要指定BGP对等体】
R2(config-router)#neighbor 12.1.1.1 remote-as 65002    //设置 R4的地址为邻居,建立eBGP邻居
R2(config-router)#neighbor 12.1.1.1 next-hop-self    //将传给该邻居的路由条目,下一跳改为自己本身
 
 
 
(3)配置 R3(AS200,联邦AS:65001):
R3(config)#router bgp 65001
R3(config-router)#bgp confederation identifier 200
R3(config-router)#neighbor 11.1.1.2 remote-as 65001
 
 
 
(4)配置 R4(AS200,联邦AS:65002):
R4(config)#router bgp 65002
R4(config-router)#bgp confederation identifier 200
R4(config-router)#bgp confederation peers 65001
R4(config-router)#neighbor 12.1.1.2 remote-as 65001
 
 
2、在 R1(eBGP邻居)上通告路由进BGP:
 
(1)R1上通告路由:
R1(config-router)#router bgp 100
R1(config-router)#network 100.1.1.1 mask 255.255.255.255
 
(2)在 R2 上 查看路由条目(eBGP邻居R1同步的):
do show ip bgp
·没有问题:
 
 
(3)在 R3 上 查看路由条目(iBGP邻居R2同步的):
do show ip bgp
·没有问题:
 
 
(4)在 R4 上 查看路由条目(由逻辑上的eBGP邻居R2同步的):
do show ip bgp
·没有问题:
 
 
3、在 R3(iBGP邻居)上通告路由进BGP:
 
(1)在R3上通告路由:
R3(config-router)#router bgp 65001
R3(config-router)#network 3.3.3.3 mask 255.255.255.255
 
(2)在 R2(iBGP邻居)上查看 同步的路由条目:
do show ip bgp
‘i’ 表示该路由条目是由iBGP邻居同步的
 
 
(3)在 R1(外部eBGP路由器)上 查看同步的路由条目:
do show ip bgp
 
 
(4)在 R4(逻辑eBGP邻居)上查看同步的路由条目:
do show ip bgp
 
 
二、在 AS200(iBGP)内部配置 一个IGP,使其拥有底层基础连通性:
 
1、配置 OSPF:
 
(1)R2 配置:
R2(config-router)#router ospf 1
R2(config-router)#network 12.1.1.0 0.0.0.255 area 0
R2(config-router)#network 10.1.1.0 0.0.0.255 area 0
R2(config-router)#network 11.1.1.0 0.0.0.255 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#exit