1
、
AS--
自治系统
由同
1
个管理组织一组路由器,有相同策略
0-65535
公有
AS
:
1-64511
私有
AS
:
64512-65535=
1024
route-views.routeviews.org
2
、为什么使用
BGP
1
)
承载大量路由
---37W
(
增长中
....2011
年
04
月
07
日
)
2
)
路由策略
实际使用:
MAN
多个出口
MPLS×××
3
、什么时候不使用
BGP
1
)设备资源不足:
2G
2
)不是很懂
BGP
3
)单出口
4
、
BGP
特点:
1
)
BGP
是属于
EGP
、无类、
DV
路由协议
不同
AS
之间使用
---->EGP
2
)
BGP
是一个路径
vector
路由协议
AS-BY-AS
而不是
hop-by-hop
3
)
可靠更新
:
工作在
TCP=179
端口上
4
)
BGP
采用增量、触发更新
5
)周期性
keepalive
检验
tcp
连接
6
)有丰富属性
-->
控制路由选择
5
、
BGP
三张表
1
)邻居表
sh ip bgp summary
sh ip bgp neighbor
2
)
BGP
数据库
列出
BGP
所有的路由条目(包含最佳和次佳)
sh ip bgp
*>
3
)
路由表
把
BGP
表中最佳的路径放到转发表中
sh ip route bgp
6
、
BGP
数据包结构
1
)
open
+
keepalive
=hello
routerid holdtime
2)keepalive
只有头部大小
=19byte
60sec holdtime=180sec
3)update:
最佳路由
=
网络号
+mask+
属性
*>
4)notification
发现有错误
,
报警
,
撤除
TCP
连接
7
、
BGP
邻居
1
)
IBGP
(
1
)同
1
个
AS
形成的邻居
(
2
)条件:只要可达
(
3
)过程:建邻居
--->
建立
TCP
连接
---->
发包
---->
查找
IGP
路由
(
4
)
IBGP
通常使用
loopback
建立邻居
2
)
EBGP
(
1
)不同
AS
形成的邻居
(
2
)条件:直连
(
3
)通常是使用物理接口建立邻居
8
、
BGP
路由传递
1
)控制层面
AS-BY-AS
2
)
数据层面
hop-by-hop
黑洞
:(1)
重发布
BGP---->IGP
扩展性问题
(2)full-mesh IBGP
邻居
--->
邻居关系多
(3)RR/
联邦
(4)MPLS
9
、
BGP
基本配置
1
)
R4(config-if)#router bgp 4
R4(config-router)#nei 24.1.1.2 remote-as 123
R2(config-router)#router bgp 123
R2(config-router)#nei 24.1.1.4 remote-as 4
R2(config-router)#nei 3.3.3.3 remote-as 123
R3(config-router)#router bgp 123
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#nei 2.2.2.2 remote-as 123
R3(config-router)#nei 35.1.1.5 remote-as 5
R5(config-router)#bgp router-id 35.1.1.3
R5(config-router)#nei 35.1.1.3 remote-as 123
2
)
更新源
R3(config-router)#nei 2.2.2.2 update-source lo0
R2(config-router)#nei 3.3.3.3 update-source lo0
R3(config-router)#do sh ip bgp sum
BGP router identifier 3.3.3.3, local AS number 123
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down
State/PfxRcd
2.2.2.2 4 123 4 4 1 0 0 00:00:11 0
35.1.1.5 4 5 9 9 1 0 0 00:05:46 0
3
)
发布网络
R4(config-router)#network 4.4.4.0 mask 255.255.255.0
被发布的网络必须跟路由表
严格匹配
R5(config-router)#net 5.5.5.0 mask 255.255.255.0
R2(config-router)#do sh ip bgp
* valid, > best,
Network Next Hop Metric LocPrf Weight Path
*> 4.4.4.0/24 24.1.1.4 0 0 4 i
* i5.5.5.0/24 35.1.1.5 0 100 0 5 i
*>
表示可以发布给其它
R
、可以放进路由表
4
)
next-hop-self
R3(config-router)#neighbor 2.2.2.2 next-hop-self
R2(config-router)#nei 3.3.3.3 next-hop-self
5
)解决数据黑洞
---
full mesh
ibgp
R1(config-router)#router bgp 123
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#nei 2.2.2.2 remote-as 123
R1(config-router)#nei 2.2.2.2 update-source lo0
R1(config-router)#nei 3.3.3.3 remote-as 123
R1(config-router)#nei 3.3.3.3 update-source lo0
R2(config-router)#nei 1.1.1.1 remote-as 123
R2(config-router)#nei 1.1.1.1 update-source lo0
R2(config-router)#nei 1.1.1.1 next-hop-s
R3(config-router)#nei 1.1.1.1 remote-as 123
R3(config-router)#nei 1.1.1.1 update-source lo 0
R3(config-router)#nei 1.1.1.1 next-hop-s
sh ip bgp summ
----
查看邻居
sh ip bgp
查看
BGP
数据库
sh ip route bgp
查看
BGP
路由
clear ip bgp *
硬清除
1
、
BGP
下
1
跳行为
1
)路由往
IBGP
邻居通告下
1
跳不变
2
)路由往
EBGP
邻居通告下
1
跳是当前
R
3
)
next-hop-self
4)MA
环境中的下一跳
(
重定向
)
R1(config-router)#router bgp 13
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#nei 12.1.1.2 remote-as 2
R1(config-router)#nei 3.3.3.3 remote-as 13
R1(config-router)#nei 3.3.3.3 upda lo0
R1(config-router)#nei 3.3.3.3 next-hop-self
R2(config-if)#router bgp 2
R2(config-router)#nei 12.1.1.1 remote-as 13
R2(config-router)#net 2.2.2.0 mask 255.255.255.0
R3(config-router)#router bgp 13
R3(config-router)#nei 1.1.1.1 remote-as 13
R3(config-router)#nei 1.1.1.1 up lo 0
R3(config-router)#nei 134.1.1.4 remote-as 4
R4(config-if)#router bgp 4
R4(config-router)#nei 134.1.1.3 remote-as 13
R4(config-router)#do sh ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 2.2.2.0/24 134.1.1.1 0 13 2 i
debug ip bgp update
2
、
peer-group
1
)有相同路由策略
1
组路由器
a
2
)作用:简化配置、节省资源
3
)配置
(
1
)创建
peer-group
(
2
)把
peer
放到
peer-group
中去
3
、同步
1)BGP
路由和
IGP
路由的同步
2
)同步作用:防止黑洞
在发送路由给
EBGP
邻居之前首先保证
IGP
有这条路由
12.2(8)T
默认都是关闭
3
)
router bgp 13
no synchronization
4
、
BGP
状态
1
)
idle:
查找路由表
2
)
connect
:
TCP
连接已经成功建立
3
)
open sent
:已发送
open
,等待对方的
open
4
)
open confirm:
收到对方
open
,发送
keepalive
,等待对方的
keepalive
5
)
established:
成功接收
keepalive
停在
idle:
没有邻居的路由
停在
active:
(
1
)邻居没有我的路由
(
2
)邻居配错邻居
IP
(
3
)邻居没有配置
(
4
)
AS
配置错误
debug ip bgp
5
、
BGP
认证
1
)
MD5
2
)
R1(config-router)#neighbor 12.1.1.2 password chuyue100
R2(config-router)#neighbor 12.1.1.1 password chuyue100
6
、
sh ip bgp rib-failure
r>i3.3.3.0/24 3.3.3.3 0 100 0 i
注意:此路由依然可以发送给邻居,因为是最佳
7
、
BGP
会话清除
1
)硬清
clear ip bgp *
把
BGP
会话及
TCP
连接都清除
2
)软清
TCP
连接不清除
clear ip bgp * soft
3
)
R1#sh ip bgp neighbor 12.1.1.2 advertised-routes
R2#sh ip bgp neighbor 12.1.1.1 received-routes
R2(config-router)#nei 12.1.1.1 soft-reconfiguration inbound
把从这个邻居收到路由放到一个独立内存空间
8
、汇总
1
)
自动
R2(config)#int lo 1
R2(config-if)#ip add 2.2.1.2 255.255.255.0
R2(config-if)#router bgp 2
R2(config-router)#redistribute connected
*> 2.0.0.0 12.1.1.2 0 0 2 ?
自动汇总仅针对重发布
进
BGP
的路由
no auto-summary -->
携带
metric
auto-summary --->
不携带
metric
2
)
手工
(
1
)
非专业汇总
R2(config-router)#net 2.2.1.0 mask 255.255.255.0
R2(config)#ip route 2.2.0.0 255.255.252.0 null 0
R2(config)#router bgp 2
R2(config-router)#net 2.2.0.0 mask 255.255.252.0
(
2
)专业汇总
R2(config-router)#aggregate-address 2.2.0.0 255.255.252.0
R2(config-router)#aggregate-address 2.2.0.0 255.255.252.0 summary-only //
抑制细化路由
aggregate-address 2.2.0.0 255.255.252.0
as-set
summary-only
//
汇总路由会使
之前的
AS-PATH
丢失,
as-set
可以保留
转载于:https://blog.51cto.com/nppstudy/725796