1.能够承载大批量的路由信息,能够支撑大规模网络
2.不能自己发现邻居
3.不能自己发现路由信息
基于tcp,端口号179
1.运行bgp的路由器称为bgp发言者
2.两个建立bgp会话的路由器互为对等体
3.bgp路由器只发送增量的bgp路由更新,或进行触发更新(不会周期性更新)
4.能够承载大批量的路由前缀,用于大规模网络
建立邻居关系 ,先建立tcp连接,成功后向对等体发送open报文
用于发送bgp路由信息,连接建立后,发送路由或路由发生变化时,发送update通告对端
报告错误,中止对等体关系,bgp在运行中发现错误时,发送此报文通告对方
维持bgp对等体关系,定时发送此报文以保持bgp对等体关系,默认60s,死亡时间是180s
改变路由策略后请求对等体重新发送路由信息,当理由策略发生变化后,触发请求对等体重新通告路由
尝试建立tcp连接,开始准备tcp连接
发tcp包,正在进行tcp连接,失败进入active,反复尝试连接,成功进入opensent
发tcp包,tcp连接没成功,反复尝试连接
发open包,tcp连接成功,开始发open包,携带参数协商对等体的建立
发Keepalive包,协商成功,自己发送Keepalive包,等待对方的Keepalive包
发update包,收到对方的Keepalive,对等体建立成功
一种是ibgp,在同一个as区域里面的bgp路由
一种是ebgp,跨越不同as区域的bgp路由
路由器不能将自己从ibgp对等体学到的路由再传递给其他的ibgp对等体
记录bgp对等体的表,查看命令dis bgp peer
记录bgp路由的表,查看命令dis bgp routing
①bgp只把最优路由传给对等体
②路由器从ebgp对等体获得的路由传递给所有的bgp对等体
③路由器从ibgp对等体获得的路由不会传递给它的bgp对等体
④路由器从ibgp对等体获得的路由是否通告给ebgp对等体要视igp和bgp同步情况决定
首先配置所以路由器的IP地址,在如图所说的区域创建ospf协议和rip协议
<R1>
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 12.0.0.0 0.0.0.255
network 15.0.0.0 0.0.0.255
<R2>
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 12.0.0.0 0.0.0.255
#
rip 1
version 2
network 23.0.0.0
<R3>
#
rip 1
version 2
network 23.0.0.0
network 3.0.0.0
#
<R5>
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 15.0.0.0 0.0.0.255
能看到邻居已经建立
<R1>
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<R1>dis ospf pee
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 12.0.0.1(GigabitEthernet0/0/0)'s neighbors
Router ID: 2.2.2.2 Address: 12.0.0.2
State: Full Mode:Nbr is Master Priority: 1
DR: 12.0.0.2 BDR: 12.0.0.1 MTU: 0
Dead timer due in 31 sec
Retrans timer interval: 5
Neighbor is up for 00:13:17
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 15.0.0.1(GigabitEthernet0/0/1)'s neighbors
Router ID: 5.5.5.5 Address: 15.0.0.2
State: Full Mode:Nbr is Master Priority: 1
DR: 15.0.0.2 BDR: 15.0.0.1 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:13:18
Authentication Sequence: [ 0 ]
<R1>
然后R1,R2,R5互相建立ibgp邻居,R2,R3互相建立ebgp邻居
<R5>
#
bgp 100
router-id 5.5.5.5
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 2.2.2.2 as-number 100
#
ipv4-family unicast
undo synchronization
network 202.0.0.0
network 202.0.1.0
peer 1.1.1.1 enable
peer 2.2.2.2 enable
<R1>
#
bgp 100
router-id 1.1.1.1
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
peer 5.5.5.5 as-number 100
peer 5.5.5.5 connect-interface LoopBack0
#
<R2>
#
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 5.5.5.5 as-number 100
peer 5.5.5.5 connect-interface LoopBack0
peer 23.0.0.2 as-number 200
#
<R3>
#
bgp 200
router-id 3.3.3.3
peer 23.0.0.1 as-number 100
能看到邻居已经建立
<R2>dis bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 100
Total number of peers : 3 Peers in established state : 3
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
1.1.1.1 4 100 16 22 0 00:14:11 Established
0
5.5.5.5 4 100 18 22 0 00:14:11 Established
2
23.0.0.2 4 200 17 24 0 00:14:41 Established
1
<R2>
然后将202.0.0.1和202.0.1.1的路由写进bgp路由表,
[R5-bgp]dis th
[V200R003C00]
#
bgp 100
router-id 5.5.5.5
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 2.2.2.2 as-number 100
#
ipv4-family unicast
undo synchronization
network 202.0.0.0
network 202.0.1.0
peer 1.1.1.1 enable
peer 2.2.2.2 enable
#
return
将ospf注入bgp协议中并将R2与R3相连的网段直连写进bgp路由表,然后修改R5到R3的bgp下一跳接口
import-route ospf 1
peer 1.1.1.1 enable
peer 1.1.1.1 next-hop-local
peer 5.5.5.5 enable
peer 23.0.0.2 enable
此时R3可以ping通202.0.0.1和202.0.1.1的主机
<R3>ping -a 3.3.3.3 202.0.0.1
PING 202.0.0.1: 56 data bytes, press CTRL_C to break
Reply from 202.0.0.1: bytes=56 Sequence=1 ttl=253 time=60 ms
Reply from 202.0.0.1: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 202.0.0.1: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 202.0.0.1: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 202.0.0.1: bytes=56 Sequence=5 ttl=253 time=30 ms
--- 202.0.0.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/38/60 ms
<R3>ping -a 3.3.3.3 202.0.1.1
PING 202.0.1.1: 56 data bytes, press CTRL_C to break
Reply from 202.0.1.1: bytes=56 Sequence=1 ttl=253 time=40 ms
Reply from 202.0.1.1: bytes=56 Sequence=2 ttl=253 time=30 ms
Reply from 202.0.1.1: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 202.0.1.1: bytes=56 Sequence=4 ttl=253 time=40 ms
Reply from 202.0.1.1: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 202.0.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms
<R3>
并且路由条目是ebgp
<R3>dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 EBGP 255 1 D 23.0.0.1 GigabitEthernet
0/0/0
2.2.2.2/32 EBGP 255 0 D 23.0.0.1 GigabitEthernet
0/0/0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
5.5.5.5/32 EBGP 255 2 D 23.0.0.1 GigabitEthernet
0/0/0
12.0.0.0/30 EBGP 255 0 D 23.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 EBGP 255 2 D 23.0.0.1 GigabitEthernet
0/0/0
23.0.0.0/30 Direct 0 0 D 23.0.0.2 GigabitEthernet
0/0/0
23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
202.0.0.0/24 EBGP 255 0 D 23.0.0.1 GigabitEthernet
0/0/0
202.0.1.0/24 EBGP 255 0 D 23.0.0.1 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<R3>
在R2上看202.0.0.1和202.0.1.1的主机路由条目是ibgp
<R2>dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 17 Routes : 17
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 1 D 12.0.0.1 GigabitEthernet
0/0/0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.3/32 RIP 100 1 D 23.0.0.2 GigabitEthernet
0/0/1
5.5.5.5/32 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.0/30 Direct 0 0 D 12.0.0.2 GigabitEthernet
0/0/0
12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
23.0.0.0/30 Direct 0 0 D 23.0.0.1 GigabitEthernet
0/0/1
23.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
202.0.0.0/24 IBGP 255 0 RD 5.5.5.5 GigabitEthernet
0/0/0
202.0.1.0/24 IBGP 255 0 RD 5.5.5.5 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<R2>
总结:bgp协议的邻居和路由条目都必须手动进行操作,自己本身不能发现邻居和路由