公有AS号:0-64511
私有AS号:64512-65535
电信的AS号:4134 网通的AS号:9929
查看AS号的网址:www.cidr-report.org
BGP把AS当做一个路由器,IGP就是hop-by-hop
EGP就是AS-BY-AS
BGP的使用环境:
1、在AS之间传输数据包
2、在AS之间有多个路径
3、在AS之间实现路由策略
为什么不能用IGP协议呢?
1、不同的AS管理不同
2、IGP不能支持过多的路由条目,而BGP可以
3、基于策略的路由选择支持
4、扩展应用,支持V6等其他被路由协议
可以telnet这个地址route-server.ip.att.net 用户名:rviews 密码也是
BGP的特点:
1、基于TCP协议端口179的应用层协议,可靠更新
2、只支持增量触发更新,因为路由条目太大,不可以周期更新
3、用keepalive保持邻居关系,60秒发送一次,Holdtime是180秒
用open报文建立邻接,用keepalive维护邻接关系
4、很多属性
5、用于超大型网络
三张表:邻居表,BGP表,路由表
BGP默认不做负载均衡
IBGP 200 EBGP 20,放路由表的路由条目,主要比较其AD
BGP报文类型:
1、open
包括holdtime和router-id
2、keepalive
3、update
4、notification
peers就是对等体就是邻居 BGP speaker就是运行BGP的路由器
EBGP就是AS之间建立的关系,IBGP就是AS内建立的关系
BGP建邻居不一定要直连的,只需路由可达就好。
因为IBGP邻居之间的路由器没有AS之外的网络,在数据层面就会产生路由黑洞
解决这个路由黑洞的方法:
1、物理线路的full mesh
2、BGP邻居的full mesh,不用MPLS的实际用法
3、将BGP重分发到IGP路由中,只适合实验室环境
4、MPLS
EBGP的水平分割:通过的AS号来记录这个路径,如果发送者发现自己的AS号也在里面,切断这段链路
A1--->A2---->A3--这段链路是不能通,不然就环路了-->A1
不接受含有苯AS号的BGP路由
IBGP的水平分割:
从IBGP学到路由不会通告给其IBGP邻居
怎么有条件地打破水平分割:RR和联邦
router bgp AS号
bgp router-id 启用LOOP口IP地址
IGP中的network的作用:
1、建立邻居
2、通告路由
BGP中建立邻居命令:neighbor ip_add remote-as 对端AS号
通告路由命令:network 通告其路由表中有的路由
R2#show ip bgp summary
BGP router identifier 2.2.2.2, local AS number 1
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
24.1.1.4 4 4 5 5 1 0 0 00:01:31 0
可以看到邻居 ,只要pfxrcd有数字代表邻居up了。
show ip bgp neighbors 查看详细信息,一般不用的哦!
R2#show ip bgp neighbors
BGP neighbor is 24.1.1.4, remote AS 4, external link
BGP version 4, remote router ID 4.4.4.4
BGP state = Established, up for 00:03:15
Last read 00:00:15, last write 00:00:15, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Message statistics:
InQ depth is 0
OutQ depth is 0
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 0 0
Keepalives: 6 6
Route Refresh: 0 0
Total: 7 7
Default minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
BGP table version 1, neighbor version 1/0
Output queue size: 0
Index 1, Offset 0, Mask 0x2
1 update-group member
Sent Rcvd
Prefix activity: ---- ----
Prefixes Current: 0 0
Prefixes Total: 0 0
Implicit Withdraw: 0 0
Explicit Withdraw: 0 0
Used as bestpath: n/a 0
Used as multipath: n/a 0
Outbound Inbound
Local Policy Denied Prefixes: -------- -------
Total: 0 0
Number of NLRIs in the update sent: max 0, min 0
Connections established 1; dropped 0
Last reset never
Connection state is ESTAB, I/O status: 1, unread input bytes: 0
Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 1
Local host: 24.1.1.2, Local port: 179
Foreign host: 24.1.1.4, Foreign port: 28127
Connection tableid (VRF): 0
Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes)
Event Timers (current time is 0x29B4B8):
Timer Starts Wakeups Next
Retrans 7 0 0x0
TimeWait 0 0 0x0
AckHold 6 0 0x0
SendWnd 0 0 0x0
KeepAlive 0 0 0x0
GiveUp 0 0 0x0
PmtuAger 0 0 0x0
DeadWait 0 0 0x0
Linger 0 0 0x0
ProcessQ 0 0 0x0
iss: 1667355922 snduna: 1667356101 sndnxt: 1667356101 sndwnd: 16206
irs: 662322478 rcvnxt: 662322657 rcvwnd: 16206 delrcvwnd: 178
SRTT: 182 ms, RTTO: 1073 ms, RTV: 891 ms, KRTT: 0 ms
minRTT: 28 ms, maxRTT: 300 ms, ACK hold: 200 ms
Status Flags: passive open, gen tcbs
Option Flags: nagle
IP Precedence value : 6
Datagrams (max data segment is 1460 bytes):
Rcvd: 14 (out of order: 0), with data: 7, total data bytes: 178
Sent: 7 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 6, total data bytes: 178
Packets received in fast path: 0, fast processed: 0, slow path: 0
fast lock acquisition failures: 0, slow path: 0
R2#show tcp brief
TCB Local Address Foreign Address (state)
637D2DF0 24.1.1.2.179 24.1.1.4.28127 ESTAB
IBGP用环回口建邻居,可以防止物理接口down掉,影响邻居的建立
update source更新源,就是发送更新的接口
如果对端neighbor IP地址和它的的更新源地址相同的话,该邻居关系将up
neighbor 5.5.5.5 ebgp-multihop 数字(要大于2),配合静态路由使用哦!
这是用来增大形成BGP邻居的路由跳数的
IGP中network的是接口,而BGP中network的是路由
R2#show ip bg
BGP table version is 2, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 4.4.4.0/24 24.1.1.4 0 0 4 i
*代表可以使用的,>是最优路由
R3#show ip bgp
BGP table version is 1, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* i4.4.4.0/24 24.1.1.4 0 100 0 4 i
没有标识>的路由
1、不放进路由表
2、不会给其他BGP邻居
BGP路由优化的条件:
1、同步 关闭同步 no synchronization
2、下一跳next-hop(静态/next-hop-self)
同步的概念:针对IBGP的规则
从一个IBGP邻居学到的路由不使用也不通告给其他邻居
直到IGP路由学到同样的路由
next-hop-self 将自己的路由器ID变成next-hop
i就是从IBGP邻居学到的路由
peer group:
作用:减少buffer,减少命令行
举例:
router bgp 1
neighbor TEST peer-group
neighbor TEST remote-as 1
neighbor TEST update-source lo0
neighbor TEST next-hop-self
定义完peer-group TEST
现在开始调用:
neighbor 1.1.1.1 peer-group TEST
neighbor 2.2.2.2 peer-group TEST
转载于:https://blog.51cto.com/867645/1354940