欢迎光临散文网 会员登陆 & 注册

配置BGP的基本功能示例

2022-11-11 12:01 作者:限量版范儿  | 我要投稿

配置BGP的基本功能后可以组建BGP网络。

组网需求

某个地区拥有多个AS,AS之间有相互访问的需求,因此需要AS之间相互交换本AS内部的路由。由于AS内路由器数量众多,导致路由数量较大,路由变化频繁,如何高效率的在AS之间传递大量路由,并且不占用大量带宽成为一个难题。为解决上述问题,可以使用BGP协议。

如图1所示,DeviceA处于AS65008,DeviceB、DeviceC和DeviceD处于AS65009,并且这几个路由器的路由数量都比较大,路由表变化频繁。在这几个路由器上部署BGP协议之后,路由器之间可以相互传递路由,并且当任何一个路由器有路由更新时,只需发送路由更新信息给邻居路由器,而无须发送整个路由表,大大节约了网络带宽。

 

 

 

设备名称接口IP地址DeviceALoopback01.1.1.1/32GE0/0/1172.16.0.1/16GE0/0/2192.168.0.1/24DeviceBLoopback02.2.2.2/32GE0/0/110.1.1.1/24GE0/0/2192.168.0.2/24GE0/0/310.1.3.1/24DeviceCLoopback03.3.3.3/32GE0/0/210.1.2.1/24GE0/0/310.1.3.2/24DeviceDLoopback04.4.4.4/32GE0/1/010.1.1.2/24GE0/2/010.1.2.2/24

在配置过程中,需注意以下事项

1、建立对等体时,当所指定的对等体的IP地址为Loopback接口地址或子接口的IP地址时,需要在对等体两端同时配置命令peer connect-interface,以保证两端连接的正确性。

2、EBGP对等体之间不是直连的物理链路时,则必须使用peer ebgp-max-hop命令允许它们之间经过多跳建立TCP连接。

采用如下思路配置BGP的基本功能

1、在DeviceB、DeviceC、DeviceD之间配置IBGP连接

2、在DeviceA和DeviceB之间配置EBGP连接

3、在DeviceA上通过network命令发布路由,查看DeviceA、DeviceB、DeviceC的路由表信息。

4、在DeviceB上配置BGP引入直连路由,查看DeviceA、DeviceC的路由表信息。

操作步骤

1、配置接口地址,参照如上表格

2、配置OSPF

配置DeviceB

 

[DeviceB] ospf 1 [DeviceB-ospf-1] area 0 [DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [DeviceB-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255 [DeviceB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0 [DeviceB-ospf-1-area-0.0.0.0] commit [DeviceB-ospf-1-area-0.0.0.0] quit [DeviceB-ospf-1] quit

 

配置DeviceC

[DeviceC] ospf 1 [DeviceC-ospf-1] area 0 [DeviceC-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255 [DeviceC-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255 [DeviceC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0 [DeviceC-ospf-1-area-0.0.0.0] commit [DeviceC-ospf-1-area-0.0.0.0] quit [DeviceC-ospf-1] quit 

配置DeviceD

[DeviceD] ospf 1 [DeviceD-ospf-1] area 0 [DeviceD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [DeviceD-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255 [DeviceD-ospf-1-area-0.0.0.0] network 4.4.4.4 0.0.0.0 [DeviceD-ospf-1-area-0.0.0.0] commit [DeviceD-ospf-1-area-0.0.0.0] quit [DeviceD-ospf-1] quit

3、配置IBGP链接

 配置DeviceB

[~DeviceB] bgp 65009 [*DeviceB-bgp] router-id 2.2.2.2 [*DeviceB-bgp] peer 3.3.3.3 as-number 65009 [*DeviceB-bgp] peer 4.4.4.4 as-number 65009 [*DeviceB-bgp] peer 3.3.3.3 connect-interface LoopBack0 [*DeviceB-bgp] peer 4.4.4.4 connect-interface LoopBack0 [*DeviceB-bgp] commit [~DeviceB-bgp] quit

 配置DeviceC

[DeviceC] bgp 65009 [DeviceC-bgp] router-id 3.3.3.3 [DeviceC-bgp] peer 2.2.2.2 as-number 65009 [DeviceC-bgp] peer 4.4.4.4 as-number 65009 [DeviceC-bgp] peer 2.2.2.2 connect-interface LoopBack0 [DeviceC-bgp] peer 4.4.4.4 connect-interface LoopBack0 [DeviceC-bgp] commit [DeviceC-bgp] quit

 配置DeviceD

[DeviceD] bgp 65009 [DeviceD-bgp] router-id 4.4.4.4 [DeviceD-bgp] peer 2.2.2.2 as-number 65009 [DeviceD-bgp] peer 3.3.3.3 as-number 65009 [DeviceD-bgp] peer 2.2.2.2 connect-interface LoopBack0 [DeviceD-bgp] peer 3.3.3.3 connect-interface LoopBack0 [DeviceD-bgp] commit [DeviceD-bgp] quit

 4、配置EBGP

配置DeviceA

[DeviceA] bgp 65008 [DeviceA-bgp] router-id 1.1.1.1 [DeviceA-bgp] peer 192.168.0.2 as-number 65009 [DeviceA-bgp] commit [DeviceA-bgp] quit 

配置DeviceB

[DeviceB] bgp 65009 [DeviceB-bgp] peer 192.168.0.1 as-number 65008 [DeviceB-bgp] commit [DeviceB-bgp] quit

查看BGP的对等体状态  

 

5、配置DeviceA发布路由172.16.0.0/16

配置DeviceA发布路由

[DeviceA] bgp 65008 [DeviceA-bgp] ipv4-family unicast [DeviceA-bgp-af-ipv4] network 172.16.0.0 255.255.0.0 [DeviceA-bgp-af-ipv4] network 192.168.0.0 255.255.255.0 [DeviceA-bgp-af-ipv4] commit [DeviceA-bgp-af-ipv4] quit [DeviceA-bgp] quit

链接:https://www.dianjilingqu.com/608597.html

配置BGP的基本功能示例的评论 (共 条)

分享到微博请遵守国家法律