1. 名词解释
  • BGP Speakers:运行BGP的路由器
  • BGP peer=BGP Neighbors=BGP对等体/邻居

    instance:display BGP peer//查看邻居

  • 邻居关系建立在TCP连接基础上,因此邻居不一定需要直连,可以通过IGP或静态路由提供TCP连接的可达性
  • 邻居必须手动指定,而非自动建立
  • 一台BGP路由器只能运行在一个AS内
  • BGP都是单播传递
  1. BGP邻居类型
  • IBGP:内部BGP邻居,位于相同AS
  • RBGP:外部BGP邻居,位于不同AS

BGP邻居概述_ip地址

  1. BGP邻居配置命令
  • BGP 123:声明所在AS号(创建进程)
  • router-id 1.1.1.1 :配置rid,必须唯一
  • peer 12.0.0.2 as-number 123:配置邻居IP地址和所在的AS号
  • display bgp peer:显示BGP邻居状态
  1. 简单实例

BGP邻居概述_静态路由_02

1、基础配置

R1:

interface GigabitEthernet0/0/0

ip address 192.168.1.1 255.255.255.0  

interface GigabitEthernet0/0/1

ip address 192.168.2.1 255.255.255.0  

interface LoopBack0

ip address 1.1.1.1 255.255.255.255 

R2:

interface GigabitEthernet0/0/0

ip address 192.168.1.2 255.255.255.0  

interface GigabitEthernet0/0/1

ip address 10.1.1.1 255.255.255.252  

interface LoopBack0

ip address 2.2.2.2 255.255.255.255 

R3:

interface GigabitEthernet0/0/0

ip address 192.168.2.2 255.255.255.0  

interface GigabitEthernet0/0/1

ip address 10.1.1.5 255.255.255.252  

interface LoopBack0

ip address 3.3.3.3 255.255.255.255

R4:

interface GigabitEthernet0/0/0

ip address 10.1.1.2 255.255.255.252

interface LoopBack0

ip address 4.4.4.4 255.255.255.255 

R5:

interface GigabitEthernet0/0/0

ip address 10.1.1.6 255.255.255.252  

interface LoopBack0

ip address 5.5.5.5 255.255.255.255 

2、配置区域内IGP

R1:

ospf 1 router-id 1.1.1.1  

area 0.0.0.0  

 network 1.1.1.1 0.0.0.0  

 network 192.168.1.0 0.0.0.255  

 network 192.168.2.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 192.168.1.0 0.0.0.255 

R3:

ospf 1 router-id 3.3.3.3  

area 0.0.0.0  

 network 3.3.3.3 0.0.0.0  

 network 192.168.2.0 0.0.0.255 

3、建立IBGP对等体

R1:

bgp 300

peer 2.2.2.2 as-number 300  

peer 2.2.2.2 connect-interface LoopBack0

peer 3.3.3.3 as-number 300  

peer 3.3.3.3 connect-interface LoopBack0

ipv4-family unicast

 undo synchronization

 peer 2.2.2.2 enable

 peer 3.3.3.3 enable

R2:

bgp 300

peer 1.1.1.1 as-number 300  

peer 1.1.1.1 connect-interface LoopBack0

peer 3.3.3.3 as-number 300  

peer 3.3.3.3 connect-interface LoopBack0

ipv4-family unicast

 undo synchronization

 peer 1.1.1.1 enable

 peer 3.3.3.3 enable

R3:

bgp 300

peer 1.1.1.1 as-number 300  

peer 1.1.1.1 connect-interface LoopBack0

peer 2.2.2.2 as-number 300  

peer 2.2.2.2 connect-interface LoopBack0

ipv4-family unicast

 undo synchronization

 peer 1.1.1.1 enable

 peer 2.2.2.2 enable

4、配置EBGP对等体

R2:

#

ip route-static 4.4.4.4 255.255.255.255 10.1.1.2

#

#

bgp 300

peer 1.1.1.1 as-number 300  

peer 1.1.1.1 connect-interface LoopBack0

peer 3.3.3.3 as-number 300  

peer 3.3.3.3 connect-interface LoopBack0

peer 4.4.4.4 as-number 100  

peer 4.4.4.4 ebgp-max-hop 5  

peer 4.4.4.4 connect-interface LoopBack0

#

ipv4-family unicast

 undo synchronization

 peer 1.1.1.1 enable

 peer 3.3.3.3 enable

 peer 4.4.4.4 enable

#

R4:

#

bgp 100

peer 2.2.2.2 as-number 300  

peer 2.2.2.2 ebgp-max-hop 5  

peer 2.2.2.2 connect-interface LoopBack0

#

ipv4-family unicast

 undo synchronization

 peer 2.2.2.2 enable

#

ip route-static 2.2.2.2 255.255.255.255 10.1.1.1

#

R3:

#

bgp 300

peer 1.1.1.1 as-number 300  

peer 1.1.1.1 connect-interface LoopBack0

peer 2.2.2.2 as-number 300  

peer 2.2.2.2 connect-interface LoopBack0

peer 5.5.5.5 as-number 200  

peer 5.5.5.5 ebgp-max-hop 5  

peer 5.5.5.5 connect-interface LoopBack0

#

ipv4-family unicast

 undo synchronization

 peer 1.1.1.1 enable

 peer 2.2.2.2 enable

 peer 5.5.5.5 enable

#

ospf 1 router-id 3.3.3.3  

area 0.0.0.0  

 network 3.3.3.3 0.0.0.0  

 network 192.168.2.0 0.0.0.255  

#

ip route-static 5.5.5.5 255.255.255.255 10.1.1.6

#

R5:

#

bgp 200

peer 3.3.3.3 as-number 300  

peer 3.3.3.3 ebgp-max-hop 5  

peer 3.3.3.3 connect-interface LoopBack0

#

ipv4-family unicast

 undo synchronization

 peer 3.3.3.3 enable

#

ip route-static 3.3.3.3 255.255.255.255 10.1.1.5

#