BGP基本配置

简介: 文章目录系列文章目录前言BGP实验拓扑描述实验描述实验需求BGP的选路规则完成基本配置R1的配置如下:R2的配置如下 :R3 的配置如下:R4的配置如下:R5的配置如下:总结

BGP实验拓扑描述


实验描述

1.网络拓扑及互联IP地址规划如图所示

2. R3、 R4、R5各自创建LOOPBACK接口, IP地址为x.x.x.x , x为路由器的编号

3. R3、R4、R5运行OSPF ,宣告三者互联接口及各自的LOOPBACK

4. BGP的AS规划如图所示

5. 完成基本的IP、IGP配置,建立BGP连接

实验需求

1.完成基本的BGP配置,R1与R3、R2与R5建立EBGP邻居关系;R3与R4、R4与R5建立IBGP邻居关系(使用LOOPBACK接口作为更新源)

2.验证 BGP选路规则,同时测试BGP相关策略工具。(待续)本次实验未完成

BGP的选路规则

我们先回顾一下BGP的13条选路规则,在本实验手册中,将对选路规则中的主要条目做验证,同时也熟悉一下 BGP的各种属性。

  1. Weight 越大越优先
  2. Local_Pref 越打越优先
  3. 起源于本地的路由优先(如本地network 的,或aggregate 的),即下一跳是0.0.0.0(在BGP表中,当前路由器通告的路由的下一跳为0.0.0.0)
  4. AS-Path 越短越优先
  5. Origin 属性(优先顺序:IGP>EGP>Incomplete)
  6. MED越小越优先
  7. 优选EBGP邻居发来的路由(相对于IBGP邻居),在联邦EGRP和IBGP中优选联盟EGRP路由
  8. 优选到BGP NEXT_HOP最近的路由,该路由是去往下一跳路由器IGP度量值最小的路由
  9. 如果有多条来自相同相邻AS的路由并通过Maximun-paths使多条路径可用,则将所有开销相同的路由加入Loc-RIB
  10. 如果路由都来自EBGP邻居,则优选最老的EBGP邻居传来的路由,降低滚翻的影响
  11. BGP邻居的RID越小越优先
  12. 如果多条路径发路由器ID或路由器ID相同,那么Cluster-List最短的路径
  13. 选择邻居ip地址最小的路由(BGP的neighbor配置中的那个邻居的地址,也就是邻居的更新源IP)

完成基本配置

AS345中的R3、R4、R5运行OSPF. AS内部使用IGP保证内部路由的互通,以满足内部的数据传输需求,同时也为IBGP连接提供底层路由的支持,在者作为传输AS , “Transit AS” ,运行IGP还能保证BGP路由在AS内的传递,而BGP路由的有效性(如NEXT_ HOP属性的可达性)也需要IGP做一个基本的保证。所以,第一步我们先完成这个IGP协议的配置。

R1的配置如下:

R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface serial 0/0
R1(config-if)#ip address 10.1.13.1 255.255.255.0
R1(config-if)#no sh
*Mar  1 00:42:07.159: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:42:08.159: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
R1(config-if)#interface loopback 1
*Mar  1 00:42:31.639: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
R1(config-if)#ip add 100.0.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#interface loopback 2
*Mar  1 00:42:46.891: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to up
R1(config-if)#ip add 100.0.2.1 255.255.255.0
R1(config-if)#no sh
R1#configure  terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router bgp 100
R1(config-router)#no synchronization
R1(config-router)#no auto-summary
R1(config-router)#neighbor 10.1.13.3 remote-as 345
R1(config-if)#router bgp 100
R1(config-router)#network 100.0.1.0 mask 255.255.255.0
R1(config-router)#network 100.0.2.0 mask 255.255.255.0

R2的配置如下 :

代码如下(示例)

R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#interface serial 0/0
R2(config-if)#ip address 10.1.25.2 255.255.255.0
R2(config-if)#no sh
*Mar  1 00:47:43.403: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:47:44.403: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
R2(config-if)#interface loopback1
R2(config-if)#ip address 100.0.1.1 255.255.255.0
R2(config-if)#no sh
*Mar  1 00:48:11.703: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
R2(config-if)#no sh
R2(config-if)#interface loopback2
R2(config-if)#ip address 100.0.2.1 255.255.255.0
R2(config-if)#no sh
R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router bgp 200
R2(config-router)#no synchronization
R2(config-router)#no auto-summary
R2(config-router)#neighbor 10.1.25.5 remote-as 345

R3 的配置如下:

代码如下(示例):

R3#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#interface serial 0/0
R3(config-if)#ip address 10.1.13.3 255.255.255.0
R3(config-if)#no sh
*Mar  1 00:51:58.231: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:51:59.231: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R3(config)#interface fastEthernet 1/0
R3(config-if)#ip add 10.1.34.3 255.255.255.0
R3(config-if)#no sh
*Mar  1 00:50:38.779: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:50:39.779: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
R3(config-if)#interface loopback0
*Mar  1 00:50:51.391: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#router ospf 100
R3(config-router)#network 10.1.34.0 0.0.0.255 area 0
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0
R3#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#router bgp 345
R3(config-router)#no synchronization
R3(config-router)#no auto-summary
R3(config-router)#neighbor 10.1.13.1 remote-as 100    //EBGP邻居
R3(config-router)#
*Mar  1 05:10:15.254: %BGP-3-NOTIFICATION: received from neighbor 10.1.13.1 2/2 (peer in wrong AS) 2 bytes 00C8
R3(config-router)#neighbor 4.4.4.4 remote-as 345      //IBGP邻居
*Mar  1 05:10:42.446: %BGP-3-NOTIFICATION: received from neighbor 10.1.13.1 2/2 (peer in wrong AS) 2 bytes 00C8
R3(config-router)#neighbor 4.4.4.4 update-source loopback 0     //指定更新源为loopback0
R3(config-router)#
*Mar  1 05:11:12.618: %BGP-3-NOTIFICATION: received from neighbor 10.1.13.1 2/2 (peer in wrong AS) 2 bytes 00C8
R3(config)#router bgp 345
R3(config-router)#neighbor 4.4.4.4 next-hop-self
R3(config)#router bgp 345
R3(config-router)#neighbor 5.5.5.5 remote-as 345
R3(config-router)#neighbor 5.5.5.5 update-source loopback 0
R3(config-router)#neigbor 5.5.5.5 next-hop-self


R4的配置如下:

代码如下(示例):

R4#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#interface fastEthernet 0/0
R4(config-if)#ip address 10.1.34.4 255.255.255.0
R4(config-if)#no sh
*Mar  1 00:57:19.187: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:57:20.187: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config-if)#interface fastEthernet 1/0
R4(config-if)#ip address 10.1.45.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#
*Mar  1 00:58:13.095: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:58:14.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R4(config-if)#interface loopback0
*Mar  1 00:58:50.443: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#router ospf 100
R4(config-router)#network 10.1.34.0 0.0.0.255 area 0
*Mar  1 00:59:44.039: %OSPF-5-ADJCHG: Process 100, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
R4(config-router)#network 10.1.45.0 0.0.0.255 area 0
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#
R4#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#router bgp 345
R4(config-router)#no synchronization
R4(config-router)#no auto-summary
R4(config-router)#neighbor 3.3.3.3 remote-as 345
R4(config-router)#neighbor 3.3.3.3 update-source Loopback 0
R4(config-router)#neighbor 5.5.5.5 remote-as 345
R4(config-router)#neighbor 5.5.5.5 update-source loopback 0

R5的配置如下:

代码如下(示例):

R5#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R5(config)#interface serial 0/0
R5(config-if)#ip address 10.1.25.5 255.255.255.0
R5(config-if)#no sh
*Mar  1 01:04:40.299: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 01:04:41.299: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
R5(config)#interface fastEthernet 1/0
R5(config-if)#ip address 10.1.45.5 255.255.255.0
R5(config-if)#no sh
R5(config-if)#
*Mar  1 01:05:26.927: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 01:05:27.927: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R5(config-if)#interface loopback 0
*Mar  1 01:05:44.075: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R5(config-if)#ip address 5.5.5.5 255.255.255.0
R5(config-if)#no sh
R5(config-if)#router ospf 100
R5(config-router)#network 10.1.25.0 0.0.0.255 area 0
R5(config-router)#network 10.1.45.0 0.0.0.255 area 0
*Mar  1 01:06:51.191: %OSPF-5-ADJCHG: Process 100, Nbr 4.4.4.4 on FastEthernet1/0 from LOADING to FULL, Loading Done
R5(config-router)#network 5.5.5.5 0.0.0.0 area 0
R5#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R5(config)#router bgp 345
R5(config-router)#no synchronization
R5(config-router)#no auto-summar
R5(config-router)#neighbor 4.4.4.4 remote-as 345
*Mar  1 05:21:58.146: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up
R5(config-router)#neighbor 4.4.4.4 update-source loopback 0
R5(config-router)#neighbor 10.1.25.2 remote-as 200
R5(config-if)#router bgp 345
R5(config-router)#neighbor 3.3.3.3 remote-as 345
*Mar  1 06:19:14.106: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 Up
R5(config-router)#neighbor 3.3.3.3 update-source loopback0
R5(config-router)#neighbor 3.3.3.3 next-hop-self
目录
相关文章
|
2天前
|
安全 网络性能优化 数据安全/隐私保护
Cisco lOS 路由器基本配置与优化指南
【4月更文挑战第22天】
24 0
|
10月前
|
网络协议
BGP的基础配置
BGP的基础配置
71 0
|
网络协议 网络架构
OSPF路由协议基础(OSPF基本配置)
OSPF路由协议基础(OSPF基本配置)
542 0
OSPF路由协议基础(OSPF基本配置)
|
网络协议 网络架构 数据安全/隐私保护
|
网络协议 网络架构
|
网络协议 网络架构
|
网络协议 网络架构
|
数据库 网络虚拟化 网络架构