BGP实验一

一、拓扑图

二、需求

1.合理规划IP地址,AS200区域内IGP协议为OSPF。

2.R1属于AS100,R2R3R4属于小AS234,R5R6R7属于小AS567,同时声明大AS200,R8属于AS300。

3.R2-R5  R4-R7之间为联邦EBGP邻居关系。

4.R1-R8之间通信。

三、配置过程

1.IP地址规划与配置

2.AS200区域内IGP协议配置为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.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 25.1.1.1 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[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.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 47.1.1.1 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 25.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 56.1.1.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 56.1.1.2 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 67.1.1.1 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 47.1.1.2 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 67.1.1.2 0.0.0.0

3.根据要求进行BGP配置

(R1属于AS100,R2R3R4属于小AS234,R5R6R7属于小AS567,同时声明大AS200,R8属于AS300)(R2-R5  R4-R7之间为联邦EBGP邻居关系

[r1]bgp 100	
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 200
[r1-bgp]import-route direct 

[r2]bgp 234 
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 200  #联邦内所有运行BGP协议的设备均声明自己所在的大AS号
[r2-bgp]confederation peer-as 567 #在联邦内的ebgp邻居关系间的两台设备,互相定义对端                                                            的小AS号
[r2-bgp]peer 12.1.1.1 as-number 100
 
[r2-bgp]peer 3.3.3.3 as-number 234  
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0  #一旦使用环回接口作为目标ip地址时,                                                                                     也应该修改源为本地的环回接口ip地址
[r2-bgp]peer 5.5.5.5 as-number 567
[r2-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r2-bgp]peer 5.5.5.5 ebgp-max-hop  #BGP规定EBGP邻居间默认所有的BGP数据包TTL值                                                                为 1,应该修改为多跳 

[r2-bgp]import-route direct 

[r3]bgp 234
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 200
[r3-bgp]peer 2.2.2.2 as-number 234	
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r3-bgp]peer 4.4.4.4 as-number 234	
[r3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r4]bgp 234
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 200
[r4-bgp]confederation peer-as 567
[r4-bgp]peer 3.3.3.3 as-number 234	
[r4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r4-bgp]peer 7.7.7.7 as-number 567
[r4-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[r4-bgp]peer 7.7.7.7 ebgp-max-hop
[r5]bgp 567
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 200
[r5-bgp]confederation peer-as 234
[r5-bgp]peer 2.2.2.2 as-number 234	
[r5-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r5-bgp]peer 6.6.6.6 as-number 567	
[r5-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[r5-bgp]peer 2.2.2.2 ebgp-max-hop
[r6]bgp 567
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 200
[r6-bgp]peer 5.5.5.5 as-number 567	
[r6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r6-bgp]peer 7.7.7.7 as-number 567
[r6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[r7]bgp 567
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 200
[r7-bgp]confederation peer-as 234
[r7-bgp]peer 4.4.4.4 as-number 234	
[r7-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r7-bgp]peer 6.6.6.6 as-number 567	
[r7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[r7-bgp]peer 78.1.1.2 as-number 300	
[r7-bgp]peer 4.4.4.4 ebgp-max-hop
[r7-bgp]import-route direct 
[r8]bgp 300
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 7.7.7.7 as-number 200
[r8-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[r8-bgp]import-route direct 

4.R1-R8之间通信

[r1-bgp]network 1.1.1.1 24

[r8-bgp]network 8.8.8.8 24

 观察到R3的BGP表的条目不优,原因是下一跳不可达

[r2-bgp]peer  3.3.3.3 next-hop-local 将BGP路由传输给邻居3.3.3.3时修改下一跳属性为本地(2.2.2.2)

路由条目变优了: 

使用同样方法处理 R2-R5/R4-R7 之间的条目不优问题。

 将R3、R6作为路由反射器:

[r3-bgp]peer 2.2.2.2 reflect-client 

[r3-bgp]peer 4.4.4.4 reflect-client

[r6-bgp]peer 5.5.5.5 reflect-client 

[r6-bgp]peer 7.7.7.7 reflect-client

R4上学习到路由: 

在R2与R7上做重发布:

[r2-bgp]import-route ospf 1

[r2-bgp]import-route direct ----- 重发布直连

[r7-bgp]import-route ospf 1  
[r7-bgp]import-route direct

 最终路由表:

<r3>display bgp ro

 BGP Local router ID is 3.3.3.3 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 28
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  1.1.1.0/24         2.2.2.2         0          100        0      100i
 *>i  2.2.2.0/24         2.2.2.2         0          100        0      ?
 *>i  2.2.2.2/32         7.7.7.7         3          100        0      (567)?
 *>i  3.3.3.3/32         2.2.2.2         1          100        0      ?
 * i                     7.7.7.7         2          100        0      (567)?
 *>i  4.4.4.4/32         2.2.2.2         2          100        0      ?
 * i                     7.7.7.7         1          100        0      (567)?
 *>i  5.5.5.5/32         2.2.2.2         1          100        0      ?
 * i                     7.7.7.7         2          100        0      (567)?
 *>i  6.6.6.6/32         2.2.2.2         2          100        0      ?
 * i                     7.7.7.7         1          100        0      (567)?
 *>i  7.7.7.0/24         7.7.7.7         0          100        0      (567)?
 *>i  7.7.7.7/32         2.2.2.2         3          100        0      ?
 *>i  8.8.8.0/24         7.7.7.7         0          100        0      (567) 300i
 *>i  12.1.1.0/24        2.2.2.2         0          100        0      ?
 *>i  23.1.1.0/24        2.2.2.2         0          100        0      ?
 * i                     7.7.7.7         3          100        0      (567)?
 *>i  25.1.1.0/24        2.2.2.2         0          100        0      ?
 * i                     7.7.7.7         3          100        0      (567)?
 *>i  34.1.1.0/24        2.2.2.2         2          100        0      ?
 * i                     7.7.7.7         2          100        0      (567)?
 *>i  47.1.1.0/24        2.2.2.2         3          100        0      ?
 * i                     7.7.7.7         0          100        0      (567)?
 *>i  56.1.1.0/24        2.2.2.2         2          100        0      ?
 * i                     7.7.7.7         2          100        0      (567)?
 *>i  67.1.1.0/24        2.2.2.2         3          100        0      ?
 * i                     7.7.7.7         0          100        0      (567)?
 *>i  78.1.1.0/24        7.7.7.7         0          100        0      (567)?
<r3>

5.全网可达测试

<r1>ping 5.5.5.5
  PING 5.5.5.5: 56  data bytes, press CTRL_C to break
    Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=254 time=20 ms
    Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=254 time=20 ms
    Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=254 time=40 ms

  --- 5.5.5.5 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/40 ms
<r1>ping 7.7.7.7
  PING 7.7.7.7: 56  data bytes, press CTRL_C to break
    Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=252 time=40 ms
    Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=252 time=30 ms
    Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=252 time=40 ms
    Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=252 time=40 ms
    Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=252 time=30 ms

  --- 7.7.7.7 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/36/40 ms
[r1-bgp]ping 8.8.8.8
  PING 8.8.8.8: 56  data bytes, press CTRL_C to break
    Reply from 8.8.8.8: bytes=56 Sequence=1 ttl=251 time=60 ms
    Reply from 8.8.8.8: bytes=56 Sequence=2 ttl=251 time=50 ms
    Reply from 8.8.8.8: bytes=56 Sequence=3 ttl=251 time=50 ms
    Reply from 8.8.8.8: bytes=56 Sequence=4 ttl=251 time=50 ms
    Reply from 8.8.8.8: bytes=56 Sequence=5 ttl=251 time=50 ms

  --- 8.8.8.8 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/52/60 ms
<r3>ping 8.8.8.8
  PING 8.8.8.8: 56  data bytes, press CTRL_C to break
    Reply from 8.8.8.8: bytes=56 Sequence=1 ttl=253 time=30 ms
    Reply from 8.8.8.8: bytes=56 Sequence=2 ttl=253 time=30 ms
    Reply from 8.8.8.8: bytes=56 Sequence=3 ttl=253 time=30 ms
    Reply from 8.8.8.8: bytes=56 Sequence=4 ttl=253 time=30 ms
    Reply from 8.8.8.8: bytes=56 Sequence=5 ttl=253 time=40 ms

  --- 8.8.8.8 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/32/40 ms
<r8>ping 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=251 time=50 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=251 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=251 time=50 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=251 time=50 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=251 time=50 ms

  --- 1.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/48/50 ms

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值