zoukankan      html  css  js  c++  java
  • BGP基本配置的方法

    边界网关协议(BGP)是运行于 TCP 上的一种自治系统的路由协议。 BGP 是唯一一个用来处理像因特网大小的网络的协议,也是唯一能够妥善处理好不相关路由域间的多路连接的协议。

    BGP

    as100 as200

    router a-------------------router b---------------------router c

    s0:192.1.1.1/24 e0:193.1.1.3/24

    s0:192.1.1.2/24 e0 193.1.1.2

    //// router a ////

    int lo0

    ip addr 1.1.1.1 255.255.255.0

    int s0/0

    ip addr 192.1.1.1 255.255.255.0

    clockrate 500000

    router bgp 100

    neighbor 192.1.1.2 remote-as 200 //指定邻居路由器和它所在的自治系统

    //// router b ////

    int lo0

    ip addr 2.2.2.2 255.255.255.0

    int e0/0

    ip addr 193.1.1.2 255.255.255.0

    int s0/0

    ip addr 192.1.1.2 255.255.255.0

    router bgp 200

    neighbor 192.1.1.1 remote-as 100

    neighbor 193.1.1.3 remote-as 200

    //// router c ////

    int lo0

    ip addr 3.3.3.3 255.255.255.0

    int e0/0

    ip addr 193.1.1.3 255.255.255.0

    router bgp 200

    neighbor 193.1.1.2 remote-as 200

    ////监视和测试配置////

    router a# show ip bgp neighbors

    remote-as 200

    bgp version 4,remote router id 2.2.2.2

    bgp state = established

    现在A将通过BGP向B通告路由1.0.0.0,必须满足2个条件:

    1、通过使用network命令或redistribute,BGP进程必须能知道路由。

    2、被通告路由必须在IP路由表中。

    我们将在BGP进程下使用network命令。这个命令满足了第一条,使得BGP进程知道路由。此network命令能使你更好控制从IGP重分布什么到BGP,并使用户能分别列出需经BGP通告的前缀。CISCO路由器能被配置的网络描述最大数为200。如果有超过200个网络需要通告,那就需要动态重分布。

    由于网络1.0.0.0是直接相连的网络,它存在于IP路由表中,故第二个条件满足。

    显示A上的IP路由表。注意网络1.0.0.0在IP路由表中。

    a# show ip route

    C 1.0.0. is directly connected,loopback 0

    no shynchronization

    在路由器A上,在BGP进程下增加命令network 1.0.0.0

    a# conf t

    router bgp 100

    netw 1.0.0.0

    用show ip bgp显示B上的IP BGP表,network 1.0.0.0是通过192.1.1.1得到的

    B# show ip bgp

    network next-hop metric loca pref weight path

    *>1.0.0.0 192.1.1.1 0 0 100 i

    ///// *表示有效,>表示最佳路由

    b# show ip ro

    B 1.0.0.0/8 [20/0] via 192.1.1.1, 00:12:02

    用show ip bgp显示C上的IP BGP表,注意network 1.0.0.0出现在BGP表中,它的下一跳是192.1.1.1(未变),此路由是有效的(用*号标出),它是通过iBGP会话得到的,在网络号前加字母i表示了这一状态。

    c# show ip bgp

    network next-hop metric locprf weight path

    * i1.0.0.0 192.1.1.1 0 0 100 i

    C# show ip route

    无1.0.0.0路由到网络1.0.0.0的路由不在IP路由表中有双重原因。

    1、192.1.1.1不在C的路由表。而且下一跳地址是:从该处得到此路由的EBGP邻居的IP地址。当路由通过EBGP注入到AS中,从EBGP获得的下一跳被无改变地传送到IBGP中。

    2、在缺省情况下BGP和IGP必须是同步的(因为网络1.0.0.0不是通过IGP得到的)。这意味着路由器B上的BGP知道的路由没有被重分布到IGP,这两者是不同步的。no synchronization

    为解决第一个问题:

    B# router bgp 200

    neighbor 193.1.1.3 next-hop-self

    为解决第二个问题:

    C# router bgp 200

  • 相关阅读:
    玩转MySQL之Linux下的简单操作(服务启动与关闭、启动与关闭、查看版本)
    玩转MySQL之Linux下修改默认编码
    机器学习算法及应用领域相关的中国大牛
    [转载]Python 包管理工具解惑
    Vim常用操作和快捷键技巧总结
    [转载]那些C++牛人的博客
    [转载]学习c/c++的好网站
    [转载]C++内存管理
    [转载]SQL数据库如何加快查询速度
    [转载]Python3.x和Python2.x的区别
  • 原文地址:https://www.cnblogs.com/hanson1/p/7100568.html
Copyright © 2011-2022 走看看