• BGP路由协议


     一、BGP(Border Gateway Protocol)边界网关协议

      1.BGP特点:

        可靠性:1、利用tcp建立可靠的连接 2、精确的路由选择信息(防环)

        稳定性:1、通过计时器来防止接口的flapping,在cisco的ios中,外部bgp路由为30秒。

            2、可以跟踪指定的路由,根据他的震荡的历史,对其进行路由的衰减(惩罚)。

        可扩展性:1、对等体(peer)【邻居】的数量,数百个会话;2、路由的数量,40万条以上的路由条目

        灵活性:1、丰富的路由属性;2、多种策略的广利(出、入两个方向的管理,基于路由的管理)

      2.BGP邻居

        IBGP邻居:指在相同AS内,建立BGP邻居,邻居之间可以不必直连。当传递路由给IBGP邻居时,默认下一跳不变。

          IBGP的水平分割:从IBGP邻居收到的路由,不会再传递给IBGP邻居。

        EBGP邻居:指在不同的AS之间建立邻居关系,一般是通过直连接口创建,也可以通过非直连的接口建立。当传递路由给EBGP邻居时默认下一跳改为自己。

      3.基本命令

    R2(config)#router bgp 100                                  起BGP协议,设置AS号
    R2(config-router)#bgp router-id 2.2.2.2 设置router-id号
    R2(config-router)#neighbor 1.1.12.1 remote-as 100      指定对方属于哪一个AS,所指的IP地址,必须在IGBP中可达
    R2(config-router)#neighbor 1.1.12.1 remote-as 100 backdoor 指定对方属于哪一个AS,管理距离按照200计算
    R2(config)#show ip bgp summary                             显示邻居关系,state字段显示为数字表示建立成功,数字代表从该邻居获得的路由数
    R2(config)#show tcp brief 显示端口连接信息,展示谁主动打开tcp连接的

    直连建立邻居关系
    neighbor x.x.x.x remote-as 100

    非直连建立邻居关系
    neighbor x.x.x.x remote-as 100
    neighbor x.x.x.x update-source interface 修改源端口,通过源检测

    注意:

      1.默认路由是不能主动发起TCP连接请求的,但是可以回应对端的TCP连接请求,静态路由会主动发起tcp请求。

      2.主动发起TCP连接请求的一方必须用对方Neighbor所指定的IP地址为源地址发出TCP连接请求,如果对方没有使用此地址,这个TCP请求被拒绝。(TCP连接源检测)

    R1(config-router)#neighbor 10.10.2.2 disable-connected-check    关闭直连检测
    R2(config-router)#neighbor 10.10.1.1 ebgp-multihop 200 修改TTL值,通过直连检测

    EGBP:直连建立邻居关系
    neighbor x.x.x.x remote-as 200

    直连回环口建立EBGP邻居
    neighbor x.x.x.x remote-as 200
    neighbor x.x.x.x update-source interface
    neighbor 2.2.2.2 ebgp-multihop <N>TTL TTL>1 --忽略直连检测
    neighbor 2.2.2.2 disable-connected-check //或者,关闭直连检测

    非直连建立EGBP邻居
    neighbor x.x.x.x update-source interface
    neighbor 2.2.2.2 ebgp-multihop <N>TTL

      4.NO-autosummary

        Network含义: network 后面的网段和掩码必须和路由表中的条目精确匹配才能引入。

        Redistribute:重分布明细路由进入BGP。

      5.Autosummary

        netowrk含义:network后面的网段和掩码必须和路由表中明细路由的主类路由匹配才能引入。

        Redistribute:重分布主类路由进入BGP。

      6.在BGP表中的路由优化之后的2个动作。

        1.向路由表提交这条最优的BGP路由;

        2.向BGP的peer邻居发送包含这条BGP最优路由的更新。

      7.BGP路由最优的条件

        1.入向策略允许的路由

        2.下一跳可达(本地优化)

        3.路径选择(路径优化),若有多条路径去往相同的目的网段,选择一条最优的路由

        4.同步(默认关闭)

      8.路由黑洞

        1.同步是早期,BGP为解决路由黑洞的一种方法。

        2.开启同步:针对IBGP路由,从IBGP邻居收到的路由,要求路由表中也得有此路由。

    R4(config-router)#neighbor 2.2.2.2 next-hop-self         传递路由下一跳改为自己,解决IBGPh传路由,不改变下一跳,网络不可达问题
    R2(config)#router ospf 100
    R2(config-router)#redistribute bgp 234 subnets ospf路由重分布到bgp
    R2(config-router)#redistribute connected subnets 直连路由重分布
    R3#show ip bgp neighbors 4.4.4.4 advertised-routes 查看R3向4.4.4.4这个邻居通告了哪些路由

      9.联邦:将大的AS划分成若干个小AS,小AS之间是EBGP关系。

        优点:在相对丰富的策略

        缺点:由于只能小于2个路由相连

    R3(config-router)#bgp confederation identifier 234       声明是哪个大的AS下面
    R3(config-router)#bgp confederation peers 64544 联邦里面的EBGP需要互相指peers

                 IBGP邻居,联邦的IBGP,联邦的EBGP邻居之间传递路由,下一跳不变。

      10.路由反射器

        1.从RR的一个客户端传递过来的一条路由:RR会传递给我的另外一个反射簇的客户端,非客户端,也会传递给我的另一个EBGP邻居。

        2.从RR的一个非客户端传递过来的一条路由:RR会传递给我的另外一个反射簇的客户端,也会传递给我的另一个EBGP邻居,但不会传递给我的另一个非客户端。

        3.路由反射器打破了水平分割,通过Originator,Cluster List值防环。

    R4(config-router)#neighbor 10.10.2.2 route-reflector-client   指定反射客户端

      11.第三方下一跳 

             

        1.R1与R2直连建邻居,R2和R3直连建立邻居,R133.3.3.0路由下一跳,指向R3。

        2.R1与R2直连建邻居,R2和R3Loopback建立邻居,R133.3.3.0路由下一跳,指向R3。

        3.R1与R2Loopback建邻居,R2和R3直连建立邻居,R133.3.3.0路由下一跳,指向R2。

        3.R1与R2Loopback建邻居,R2和R3Loopback建立邻居,R133.3.3.0路由下一跳,指向R2。

       结论:R1与R2直连建立邻居,R2通过递归查询,下一跳为192.168.123.3 ,与建立邻居neighbor 192.168.123.1 为同一网段,R2认为R1和R3也是通的,所以认为R1去R3不用通过自己,称下一跳优化。

         注意:RIP与EIGRP也存在第三方下一跳,只不过EIGRP是关闭的。

       BGP的第三方下一跳:收到BGP路由的下一跳(递归完成的下一跳)与Nei地址是在同一个网段,保持下一跳地址不变;不在同一个网段,则正常改变下一跳。

       特殊:如果路由的下一跳(递归完的下一跳)与nei地址相同,改变下一跳。

    二、BGP的十三条选路原则

      

      1、选路第一条:

        Weight值:越大越好;cisco私有的;本地有效;只能在in方向做;默认值0(接收到的),32768(发出路由方);修改weight的两种方法: nei x.x.x.x weight y,route-map。

    neighbor 22.1.1.1 weight 10                      针对所有22.1.1.1传给的路由都修改weight值

    R1(config)#access-list 1 permit 77.1.1.0 抓取路由
    R1(config-route-map)#match ip address 1
    R1(config-route-map)#set weight 11 设置weigth值
    R1(config)#route-map W permit 999 放行所有

      2、选路第二条:

        local-preference:优选最大;缺省值100;只能在IBGP传递,不能在EBGP传递;从EBGP学到的BGP条目,LP为100,可以通过bgp default local-preference修改;可以在in/out方向。  

    R1(config-router)#bgp default local-preference 99    修改默认的local值
    R1(config-router)#do clear ip bgp * so 清空路由

    R1(config)#route-map L
    R1(config-route-map)#match ip address 1
    R1(config-route-map)#set local-preference 101
    R1(config)#route-map L permit 999
    R1(config)#router  bgp 100
    R1(config-router)#neighbor 22.1.1.1 route-map L in

       3、选路第三条

        本地起源:从本地注入BGP条目的方法:network   / redistrbution  /agg

    R2(config)#ip route 77.1.1.0 255.255.255.0 null 0       R2上伪造一条路由
    R2(config)#router bgp 100
    R2(config-router)#network 77.1.1.0 mask 255.255.255.0
    R2(config)#router bgp 100
    R2(config-router)#neighbor 27.1.1.7 weight 32768
    R2(config-router)#do clear ip bgp * so

      4、选路第四条

        AS-path:优选最短的AS-path;EBGP邻居作用;bgp bestpath as-path ignore忽略这条选路原则(隐藏命令)

        Last-as参数:表示离这个AS最近的AS,重复的次数

    R2(config)#access-list 1 permit 22.1.1.0
    R2(config)#route-map AS-P
    R2(config-route-map)#match ip address 1
    R2(config-route-map)#set as-path prepend 2 3
    R2(config)#route-map AS-P permit 999
    R2(config)#router bgp 100
    R2(config-router)#neighbor 27.1.1.7 route-map AS-P out 出去的方向
    R2(config-router)#do clear ip bgp * so ou

    R3(config)#access-list 1 permit 22.1.1.0
    R3(config)#route-map AS-P
    R3(config-route-map)#match ip address 1
    R3(config-route-map)#set as-path prepend 4 5 6
    R3(config-route-map)#set as-path prepend last-as 2 以最后一个as重复两次
    R3(config)#route-map AS-P permit 999
    R3(config)#router bgp 200
    R3(config-router)#neighbor 17.1.1.1 route-map AS-P in
    R3(config-router)#do clear ip bgp * so in

       5、选路第五条:起源属性(起源代码)

        Origin :-i > e > ?   ;   - in / out

    R3(config)#access-list 1 permit 22.1.1.0
    R3(config)#route-map O
    R3(config-route-map)#match ip address 1
    R3(config-route-map)#set origin incomplete   设置成重分布(?)
    R3(config)#route-map O permit 999
    R3(config)#router bgp 200
    R3(config-router)#neighbor 27.1.1.2 route-map O in
    R3#clear ip bgp * so

       6、选路第六条

        MED:优选最小;唯一一个只影响相邻AS选路属性;告诉EBGP邻居怎么进入本AS;从EBGP学习到BGP条目携带的MED可以传给其他IBGP;

        从IBGP学习到的BGP路由条目的MED为0或者其他值,缺省不会传给EBGP邻居,显示为空;汇总方式生成的BGP条目,MED值为空。

        Bgp bestpath med missing-med-worst 显示MED,并且进行MED选路原则的比较,如果不显示MED,MED为空

        第一个AS号相同才会比较MED,从左边开始数

        bgp always-conpare-med打破AS相同的限制

        bgp deterministic-med是指把路由过来的MED值进行分组,同一个AS的分组,其他的AS的分一组,先比较同一个AS的MED值,再和其他的AS的MED值比较路由器那个最小的R-ID。

        bgp bestpath as-path ignore(隐含命令)

    R1(config)#router bgp 100
    R1(config-router)#network 11.1.1.0 mask 255.255.255.0                     明细路由
    R1(config-router)#aggregate-address 11.1.0.0 255.255.0.0                  汇总路由
    R1(config-router)#bgp bestpath med missing-as-worst med值为空,自动生成默认值

    R1(config)#route-map MED
    R1(config-route-map)#match ip address 1
    R1(config-route-map)#set metric 12
    R1(config)#route-map MED permit 999
    R1(config)#router bgp 100
    R1(config-router)#neighbor 17.1.1.7 route-map MED in

        7、选路第七条

        EBGP优于IBGP学过来的路由:EBGP 20 ;IBGP 200 

        EBGP > 联邦EBGP > IBGP

        8、选路第八条

        优选对BGP下一条具有最低IGP度量值的路径

                 

    R3#clear bgp ipv4 unicast 11.1.1.1                        清除单个邻居
    R3(config)#int e0/2
    R3(config-if)#ip ospf cost 1 修改cost值为1

      9、选路第九条

         BGP等价负载均衡:缺省未打开,打开就实现负载+ ;maxi-path 2

         非等价负载均衡配置    

          bgp dmzlink-bw(全局)

          nei xxx dmzlink-bw (邻居)

      10、选路第十条

        最老的EBGP邻居:最老的EBGP邻居意味着是最稳定的,或者说是路由学习到时间最老的,不是邻居最久的。 

     使能bgp bestpath compare-routerid,跳过第十条,最小的

      11、选路第十一条

        最低的IBGP/EBGP router-id

        EBGP可以通过上一个实验看到(不看10条)

        IBGP是比较Originator ID (就是第一跳路由器的router-id)

               

      有RR情况下,Originator是router-id,如果没有,括号里就是router-id。

    R1(config)#router bgp 100
    R1(config-router)#bgp router-id 1.1.1.1   手动指定router-id

      12、选路第十二条

        Cluster_list 长度短的;IBGP中用到;当一个路由从多个RR(路由反射)收到,选择最短的cluster-list。

                  

    R5(config)#router bgp 100
    R5(config-router)#neighbor IBGP peer-group   创建一个盒子
    R5(config-router)#neighbor IBGP remote-as 100         把常用的命令放进盒子里面
    R5(config-router)#neighbor IBGP update-source loopback 0 把常用的命令放进盒子
    R5(config-router)#neighbor IBGP next-hop-self
    R5(config-router)#neighbor 4.4.4.4 peer-group IBGP 调用盒子

       13、选路第十三条

        最低的邻居地址的路径;最小的建立邻居的地址,是update-soure接口;IBGP邻居。

                  

     三、BGP路由过滤

      1、拓扑图

      

       2、as-path过滤:不能基于掩码的控制

    .       任意简单的字符,包括字符
    *      零次或者多次
    +      一次或者多次
    ? 零次或一次出现
    ^      从什么开始
    $      从什么结束
    - 匹配任意东西(包含空格,开始,结束,空间,选项卡,逗号)
          
    []
    |

    ^$ 起源于本AS的
    _300$ 表示起源于300的路由
    ^100_    从邻居as100来的
    ^100$ 起源于AS100的,且从邻居as100来的
    _100_ 起源于AS100的;从邻居AS100来的;穿过AS100来的
    ^[0-9]+$ 任何起源于邻居AS的
    .* 所有
    ^([0-9]+)(_1)*$ 以任意数值标记的AS号以及重复出现的

     例子:

    Router(config)#ip as-path access-list 10 deny _12$             过滤掉起源AS2的
    Router(config)#ip as-path access-list 10 permit .*        允许所有
    Router(config-router)#neighbor 44.1.1.4 filter-list 10 in 在和R4建立邻居的时候,in方向调用

    R4(config)#ip as-path access-list 10 deny ^$ 起源本地的AS
    R4(config)#ip as-path access-list 10 permit .*          允许所有
    R4(config)#router bgp 345                      
    R4(config-router)#neighbor 44.1.1.6 filter-list 10 out 在和R6建立邻居的时候,out方向调用

      3、Prefix-list:可以基于掩码的控制

    Router(config)#ip prefix-list PW permit 11.1.1.0/x  ge y le z
    Router(config)#ip prefix-list abc deny 11.1.3.0/24
    Router(config)#ip prefix-list abc permit 0.0.0.0/0 le 32
    neighbor 46.1.1.4 prefix-list abc in

        x<y<z

        1、当没有ge,掩码范围最小值跟前缀相同

        2、当没有ge,没有指定le,le=32

        3、当没有ge和le,ge和le与前缀相同

       4、BGP路由过滤-----ORF

        假设和ISP路由互联,ISP上有很多路由前缀,但是只有部分是我想要的,此时要想让ISP路由器只发送我所需要的路由前缀过来就要用到ORF技术

    Router(config)#neighbor x.x.x.x capability orf prefix-list both
    Router#show ip bgp neighbors 46.1.1.6 advertised-routes 查看我发给46.1.1.6的所有路由

       5、BGP路由过滤-----Policy list

         BGP route-map policy list

         BGP route-map continue

    Router(config)#ip policy-list test deny
    Router(config)#route-map test
    Router(config-route-map)#match policy-list test

                             

       四、BGP优化

        1、PA配置步骤

          定义要统计的感兴趣流量并设置流量suoyin  

          Communitu-list 、AS-PATH 或者AS号等参数都可以用于抓取感兴趣流量

          在route-map中匹配感兴趣流量

    ip community-list 30 permit 300:300
    route-map PA permit 10
    match community-list 30
    set traffic-index 3

           2、将IP流量归类

              在BGP进程中使用table-map关键字关联上面定义好的route-map

            BGP将基于route-map中定义的规则对路由表中路由进行归类

           其实就是把感兴趣流量归类到taffic-index中。

            例如:

    router bap 12
    table-map PA

          3、在接口上激活BGP PA  

    bgp-policy accounting [input | output]

          4、查看BGP PA的统计结果

    show cef interface policy-statistics

           5、提高收敛

            全internet收敛时间大于1小时

            单个ISP要求在半个小时完成收敛

            判断BGP收敛完成的标准(完成收到路由、版本号一致/I/O)

    BGP scanner process 对大量的路由扫描,如果扫描周期短,可导致高的CPU利用率
    BGP router process 每秒运行一次,检查是否需要工作

    Router(config)#router  bgp 66
    Router(config-router)#bgp scan-time 30 修改,默认为30秒

           6、优雅重启

            控制层面重启,数据层面继续保持转发的技术

    Router(config)#router bgp 66
    Router(config-router)#bgp log-neighbor-changes 记录邻居的上/下和重置原因
    Router(config-router)#bgp graceful-restart restart-time 120 设置重启所需要的最大时间
    Router(config-router)#bgp graceful-restart stalepath-time 360 设置保持重新启动peer的陈旧路径的最大时间
    Router(config-router)#bgp graceful-restart

          7、控制收到路由数量

    Router(config-router)#neighbor 46.1.1.4 maximum-prefix 100             从该对等点接受的前缀的最大数目,超过就告警
    Router(config-router)#neighbor 46.1.1.4 maximum-prefix 100 restart     设置超过100条,超过限制后重新启动bgp连接
    Router(config-router)#neighbor 46.1.1.4 maximum-prefix 100 warning-only 仅当超过限制时发出警告消息

          8、解决路由不停的翻滚问题-dampening

            每一次EBGP路由的flap,都会给1000点的惩罚值

            惩罚值按照指数衰减法

            当惩罚值超过抑制限值,路由就被抑制

            一条抑制的路由,当惩罚值小于限值(Suppress 2000)时,重新被传递

            当惩罚值低于一半的重新加载值(Reuse 750)得时候将会被清除

            一条被抑制的时候不会超过最大惩罚值

            一条不可达的路由将会已H的状态显示在BGP表中

            针对某个邻居过来的路径生效而不是这条路径本身

            只对EBGP路由有效

            半衰期Half-time(15分钟);最大半衰期 Max-suppress-time (4Xhalf-time 60min  );Per-flap penalty 无法配置 1000

    Router(config)#router bgp 66
    Router(config-router)#bgp dampening 15 750 2000 60
    Router#show ip bgp dampening flap-statistics         查看闪动的状态
    Router#show ip bgp dampening dampened-paths 查看正在衰减的路由
    Router#show ip bgp dampening parameters

    *d 设置为damp
    *h 设置为history
    *s 可以放进路由表,不能传递给邻居
    *r 不会放进路由表,可以传递给邻居

         五、BGP综合实验

          1、基本配置

            AS12345中R4/R5都是RR,要求用动态建立BGP邻居的方式建立IBGP,并且要求建立尽可能长的TCP连接。

            R1属于10001,与R2建立一条EBGP邻居关系。要求用两台路由器的loo0建立;要求此TCP建立的session无论什么情况,都只能由R1发起,也就是说是通过R1的随机端口到R2的179端口,R2不能主动发起于R1的TCP连接请求;使用最小的EBGP多跳;不能用ACL和任何过滤。

            R1与R3建立一条EBGPsession,要求用最少的配置

            R10与R8建立一条EBGP邻居。要求R10不能出现EBGP关键字,R8不能出现UPDATE关键字;R8不能与R10的fa0/0建立EBGP邻居;当BGP建立时,无论如何都是从R10发起到R8 179端口,用ACL来完成。

            R10和R9建立正常的EBGP邻居关系

    R4配置:

    R4(config)#router bgp 12345                                    启bgp12345
    R4(config-router)#bgp listen range 0.0.0.0/0 peer-group IBGP 动态建立bgp邻居
    R4(config-router)#neighbor IBGP peer-group 启一个盒子IBGP
    R4(config-router)#neighbor IBGP remote-as 12345 把命令装进IBGP盒子里面
    R4(config-router)#neighbor IBGP update-source loopback 0 把命令装进IBGP盒子里面

    R5配置:

    R5(config)#router bgp 12345
    R5(config-router)#neighbor IBGP peer-group
    R5(config-router)#neighbor IBGP remote-as 12345
    R5(config-router)#neighbor IBGP update-source loopback 0
    R5(config-router)#bgp listen range 0.0.0.0/0 peer-group IBGP

    R2:、R3、R6、R7、R8、R9配置:

     router bgp 12345
     neighbor 4.4.4.4 remote-as 12345
     neighbor 4.4.4.4 update-source Loopback0
     neighbor 5.5.5.5 remote-as 12345
     neighbor 5.5.5.5 update-source Loopback0

     R1配置:

    R1(config)#ip route 2.2.2.2 255.255.255.255 12.1.1.2     明细路由
    R2(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.1        R2到R1环回口路由用默认路由,默认路由不会主动发起连接,被动响应
    R1#show tcp brief 查看谁发起的session连接

    R3配置:

    R3(config)# router bgp 12345
    R3(config-router)#neighbor 13.1.1.1 remote-as 10001 物理口建立BGP,配置最少

    R1(config)#router bgp 10001
    R1(config-router)#neighbor 13.1.1.3 remote-as 12345

     R8配置:R8用物理口与R10的环回口建立邻居

    R8(config)#ip route 10.10.10.10 255.255.255.0 100.1.1.10
    R8(config)#router bgp 12345
    R8(config-router)#neighbor 10.10.10.10 remote-as 34567
    R8(config-router)#neighbor 10.10.10.10 ebgp-multihop

    R10配置:

    R10(config)#router bgp 34567
    R10(config-router)#neighbor 100.1.1.8 remote-as 12345
    R10(config-router)#neighbor 100.1.1.8 update-source loopback 0
    R10(config)#ip access-list extended tcp
    R10(config-ext-nacl)#deny tcp host 100.1.1.8 host 10.10.10.10 eq 179
    R10(config-ext-nacl)#permit ip any any
    R10(config-if)#ip access-group tcp in
    R8#clear ip bgp 10.10.10.10

     R9配置:

    R9(config-router)#neighbor 100.1.2.10 remote-as 34567

    R10(config-if)#router bgp 34567
    R10(config-router)#neighbor 100.1.2.9 remote-as 12345

     高级配置

        1、在R5上,通过network宣告一条5.0.0.0/8的路由到BGP中,R1收不到这条路由,此解决方法只能在R5的BGP上做,不可以在任何地方增加接口或者静态或者OSPF汇总BGP手动汇总(auto-summ/comm)

        2、在R5上向BGP下发默认路由。(network 0.0.0.0)

        3、在R1上增加一条环回口loo104,地址为:104.1.1.1 255.255.255.0

          104.1.2.1 255.255.255.0 se

          104.1.3.1 255.255.255.0 se

          104.1.4.1 255.255.255.0 se

          104.1.5.1 255.255.255.0 se

        用最小的命令行把这些路由放进BGP,并且使R5看到这些路由的ORIGINE TYPE是IGP

        4、在R8 R9上做配置,使得R10接受UPDATE时,这几条的AS-PATH为12345 34567 10001 使用最少的配置步骤和命令行。

        5、在R10上做配置,确保R10能收到这4条路由(allowas-in 1)

        6、R10上除了104.1.2.1其余的都从R3到达R1,且负载

     R5配置:

    R5(config)#router bgp 12345
    R5(config-router)#auto-summary
    R5(config-router)#network 5.0.0.0
    R5(config)#access-list 1 permit 5.0.0.0 抓取路由
    R5(config)#route-map NO-E
    R5(config-route-map)#match ip address 1
    R5(config-route-map)#set community no-export 打上不要传出本AS区标签
    R5(config)#route-map NO-E permit 999 大号放行
    R5(config)#router bgp 12345
    R5(config-router)#neighbor IBGP route-map NO-E out
    R5(config-router)#neighbor IBGP send-community

     R5配置:

    R5(config-router)#neighbor IBGP default-originate  向所有邻居下发默认路由

    R1配置:

    R1(config)#int loopback 104
    R1(config-if)#ip address 104.1.1.1 255.255.255.0
    R1(config-if)#ip address 104.1.2.1 255.255.255.0 secondary 
    R1(config-if)#ip address 104.1.3.1 255.255.255.0 secondary 
    R1(config-if)#ip address 104.1.4.1 255.255.255.0 secondary 
    R1(config-if)#ip address 104.1.5.1 255.255.255.0 secondary
    R1(config)#route-map C
    R1(config-route-map)#match interface loopback 104
    R1(config-route-map)#set origin igp
    R1(config-route-map)#router bgp 10001
    R1(config-router)#redistribute connected route-map C      重分布

     R4配置:

    R4(config)#router bgp 12345
    R4(config-router)#neighbor IBGP route-reflector-client 

    R5(config)#router bgp 12345
    R5(config-router)#neighbor IBGP route-reflector-client

    R8配置:

    R8(config)#access-list 21 permit 104.1.0.0 0.0.7.255
    R8(config)#route-map AS
    R8(config-route-map)#match ip address 21
    R8(config-route-map)#set as-path prepend 34567
    R8(config)#route-map AS permit 999
    R8(config-route-map)#router bgp 12345
    R8(config-router)#neighbor 10.10.10.10 route-map AS out

    R9配置:

    R9(config)#access-list 21 permit 104.1.0.0 0.0.7.255
    R9(config)#route-map AS
    R9(config-route-map)#match ip address 21
    R9(config-route-map)#set as-path prepend 34567
    R9(config)#route-map AS permit 999
    R9(config-route-map)#router bgp 12345
    R9(config-router)#neighbor 100.1.2.10 route-map AS out

    R10配置:解决第5条

    R10(config)#router bgp 34567
    R10(config-router)#neighbor 100.1.1.8 allowas-in 1
    R10(config-router)#neighbor 100.1.2.9 allowas-in 1

     R2、R3、R6、R7、R8,R9配置:解答第6条

    R2(config)#ip prefix-list abc permit 104.1.1.0/24
    R2(config)#ip prefix-list abc permit 104.1.3.0/24
    R2(config)#ip prefix-list abc permit 104.1.4.0/24
    R2(config)#ip prefix-list abc permit 104.1.5.0/24
    R2(config)#route-map L
    R2(config-route-map)#match ip address prefix-list abc
    R2(config-route-map)#set local-preference 99
    R2(config)#route-map L permit 999
    R2(config-route-map)#router bgp 12345
    R2(config-router)#neighbor 4.4.4.4 route-map L out

     未完待续

  • 相关阅读:
    Eclipse对printf()不能输出到控制台的解决方法
    Eclipse launch failed.Binary not found解决方案
    Windows 7中使用Eclipse 使用CDT and WinGW 开发C/C++(转载)
    assets
    方法对头,报表模板维护其实很简单
    刷机包各个文件都是啥
    开机logo切换逻辑深入研究
    不同分辨率的LCM进行兼容
    SD卡驱动分析(二)
    SD卡驱动分析(一)
  • 原文地址:https://www.cnblogs.com/aqicheng/p/12403939.html
Copyright © 2020-2023  润新知