BGP实验

BGP特点:

  1. 无类别路径矢量 -----距离矢量的升级版---AS--BY--AS
  2. 使用单播更新来发送所有信息;基于TCP 179端口工作
  3. 增量更新--仅触发无周期
  4. 具有丰富的属性来取代IGP中度量进行选路----多个参数控制协议
  5. 可以在进项和出项对流量实施强大的策略--可控性
  6. 默认不被用于负载均衡-----通过各种选路规则仅仅产生一条最佳路径

BGP支持认证和聚合

BGP的工作过程

1、配置完成后,邻居间单播TCP三次握手,目标端口179,建立TCP的会话;之后所有的BGP协议数据包基于该会话进行传输;

会话建立后,邻居间正常收发一次open报文建立BGP的邻居关系,生成邻居表

BGP协议的open报文中将携带本地的RID—生成方式和OSPF一致;仅需要本地及本地所有邻居唯一即可;

邻居关系建立后,默认每1min,使用keeplive周期保活邻居关系(周期保活TCP会话)

2、邻居关系建立后,管理员选择性将本地路由表中通过任意来源获取的路由条目,向BGP协议中进行宣告;使用updata数据包进行邻居间路由共享;之后生成BGP;--- 装载本地发出及接收到的所有路由条目;

默认将最优路径加载于路由表中(最优-仅仅基于BGP的选路规则,不一定为最佳路径;BGP默认不支持负载均衡)

3、收敛完成,仅keeplive周期保活即可;

4、若出现错误信息,邻居间将使用Notification报文进行报错操作

5、结构突变

1)新增  --- 本地使用updata向本地所有邻居告知,前提该路由不被已经发出的聚合路由包含

2)断开  --- 本地使用updata向本地所有邻居告知,前提该路由不被已经发出的聚合路由包含

             只有到聚合条目中包含的所有明细路由均在本地失效,才告知邻居删除聚合条目

3)无法沟通 --- hold time为3min,连续3次未收到邻居的keeplive;断开邻居关系、TCP会话,删除从该邻居处学习到的所有路由;

 

 

首先配置给每台路由器配置IP地址和环回:

[r1]interface LoopBack 0

[r1-LoopBack0]ip address 1.1.1.1 24

[r1]interface g0/0/0

[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24

[r2]interface LoopBack 0

[r2-LoopBack0]ip add 2.2.2.2 24

[r2]interface g0/0/1

[r2-GigabitEthernet0/0/1]ip add 23.1.1.2 24

[r3]interface LoopBack 0

[r3-LoopBack0]ip add 3.3.3.3 24

[r3]interface g0/0/0

[r3-GigabitEthernet0/0/0]ip add 23.1.1.3 24

[r3]interface g0/0/1

[r3-GigabitEthernet0/0/1]ip add 34.1.1.3 24

[r4]interface LoopBack 0

[r4-LoopBack0]ip add 4.4.4.4 24

[r4]interface g0/0/1

[r4-GigabitEthernet0/0/1]ip add 45.1.1.4 24

[r4]interface g0/0/2

[r4-GigabitEthernet0/0/2]ip add 54.1.1.4 24

[r5]interface LoopBack 0

[r5-LoopBack0]ip add 5.5.5.5 24

[r5]interface g0/0/0

[r5-GigabitEthernet0/0/0]ip add 45.1.1.5 24

[r5]interface g0/0/1

[r5-GigabitEthernet0/0/1]ip add 54.1.1.5 24

然后建立r1和r2以及r4和r5之间的邻居关系:

[r1]ip route-static 2.2.2.0 24 12.1.1.2

[r2]ip route-static 1.1.1.0 24 12.1.1.1

[r4]ip route-static 5.5.5.0 24 45.1.1.5

[r4]ip route-static 5.5.5.0 24 54.1.1.5

[r5]ip route-static 4.4.4.0 24 45.1.1.4

[r5]ip route-static 4.4.4.0 24 54.1.1.4

然后建立BGP:

[r1]bgp 1

[r1-bgp]router-id 1.1.1.1

[r1-bgp]peer 2.2.2.2 as-number 2

[r1-bgp]peer 2.2.2.2 ebgp-max-hop 2

[r1-bgp]peer 2.2.2.2 connect-interface LoopBack 0

[r2]bgp 2

[r2-bgp]router-id 2.2.2.2

[r2-bgp]peer 1.1.1.1 as-number 1

[r2-bgp]peer 1.1.1.1 connect-interface LoopBack 0

[r2-bgp]peer 1.1.1.1 ebgp-max-hop 2

[r4]bgp 2

[r4-bgp]router-id 4.4.4.4

[r4-bgp]peer 5.5.5.5 as-number 3

[r4-bgp]peer 5.5.5.5 connect-interface LoopBack 0

[r4-bgp]peer 5.5.5.5 ebgp-max-hop 2

[r5]bgp 3

[r5-bgp]router-id 5.5.5.5

[r5-bgp]peer 4.4.4.4 as-number 2

[r5-bgp]peer 4.4.4.4 connect-interface LoopBack 0

[r5-bgp]peer 4.4.4.4 ebgp-max-hop 2

然后可以查看tcp的状态:

<r4>display tcp status

TCPCB    Tid/Soid Local Add:port        Foreign Add:port      VPNID  State

b4c94268 6  /1    0.0.0.0:23            0.0.0.0:0             23553  Listening

b4c94b44 164/1    0.0.0.0:179           5.5.5.5:0             0      Listening

b4c94c88 164/6    4.4.4.4:50521         5.5.5.5:179           0      Established

然后配置ospf:

[r2]ospf 1 router-id 2.2.2.2

[r2-ospf-1]area 0

[r2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255

[r2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255

[r3]ospf 1 router-id 3.3.3.3

[r3-ospf-1]area 0

[r3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255

[r3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255

[r3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255

[r4]ospf 1 router-id 4.4.4.4

[r4-ospf-1]area 0

[r4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255

[r4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255

然后在r2的bgp包:

[r2]bgp 2

[r2-bgp]peer 3.3.3.3 as-number 2

[r2-bgp]peer 3.3.3.3 connect-interface loo

[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0

[r2-bgp]peer 3.3.3.3 next-hop-local

然后是r3的bgp包:

[r3]bgp 2

[r3-bgp]router-id 3.3.3.3

[r3-bgp]peer 2.2.2.2 as-number 2

[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0

[r3-bgp]peer 2.2.2.2 next-hop-local

然后是r4的bgp包:

[r4]bgp 2

[r4-bgp]peer 3.3.3.3 as-number 2

[r4-bgp]peer 3.3.3.3 connect-interface LoopBack 0

[r4-bgp]pee

[r4-bgp]peer 3.3.3.3 next-hop-local

在r1中宣告bgp:

[r1]interface LoopBack 1

[r1-LoopBack1]ip add 99.1.1.1 24

然后在r2中查看:

<r2>display bgp routing-table

 BGP Local router ID is 2.2.2.2

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

 Total Number of Routes: 1

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   99.1.1.0/24        1.1.1.1         0                     0      1i

但现在r2回不到r5,

所以把r3当反射器,r2当客户端:

[r3]bgp 2

[r3-bgp]peer 2.2.2.2 reflect-client

现在我们再r4查看一下

<r4>display bgp routing-table

 BGP Local router ID is 4.4.4.4

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

 Total Number of Routes: 1

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  99.1.1.0/24        2.2.2.2         0          100        0      1i

然后在r5中查看一下

<r5>display bgp routing-table

 BGP Local router ID is 5.5.5.5

 Status codes: * - valid, > - best, d - damped,

               h - history,  i - internal, s - suppressed, S - Stale

               Origin : i - IGP, e - EGP, ? - incomplete

 Total Number of Routes: 1

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   99.1.1.0/24        4.4.4.4                               0      2 1i

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值