通信人家园

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2417|回复: 0
打印

BGP 基础配置实例 [复制链接]

军衔等级:

  二级通信军士

注册:2005-1-28
跳转到指定楼层
1#
发表于 2010-9-17 14:49:19 |只看该作者 |倒序浏览
这次做一个BGP基本的实例:
  //// r1 ////
  int lo1
  int lo2
  ip ad 192.1.25.1 255.255.255.0
  int f1/1
  ip ad 192.1.1.1 255.255.255.0
  router BGP 100
  neighbor 192.1.1.2 remote-as 200
  network 192.1.24.0
  network 192.1.25.0
  //// r2 ////
  int f1/1
  ip address 192.1.1.2 255.255.255.0

  int f3/3
  ip ad 193.1.1.2 255.255.255.0

  int f4/4
  ip ad 194.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
  neighbor 194.1.1.4 remote-as 300

  //// r3 ////
  int f3/3
  ip ad 193.1.1.3 255.255.255.0

  router BGP 300
  neighbor 193.1.1.2 remote-as 200
  //// r4 ////
  int f4/4
  ip ad 194.1.1.4 255.255.255.0

  router BGP 400
  neighbor 194.1.1.2 remote-as 200

  基础配置完成后,一定要验证:
  show ip BGP summary

  r2#sh ip BGP su
  BGP router identifier 194.1.1.2, local AS number 200
  BGP table version is 8, main routing table version 8
  7 network entries and 7 paths using 931 bytes of memory
  3 BGP path attribute entries using 180 bytes of memory
  2 BGP AS-PATH entries using 48 bytes of memory
  0 BGP route-map cache entries using 0 bytes of memory
  0 BGP filter-list cache entries using 0 bytes of memory
  BGP activity 7/46 prefixes, 7/0 paths, scan interval 15 secs
  Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
  192.1.1.1 4 100 46 49 8 0 0 00:42:37 2
  193.1.1.3 4 200 46 52 8 0 0 00:42:06 0
  194.1.1.4 4 300 56 58 8 0 0 00:39:26 2

  show ip BGP
  r2#sh ip BGP
  BGP table version is 8, local router ID is 194.1.1.2
  Status codes: s suppressed, d damped, h history, * valid, >best, i - internal
  Origin codes: i - IGP, e - EGP, ? - incomplete
  Network Next Hop Metric LocPrf Weight Path
  *> 192.1.24.0 192.1.1.1 0 0 100 i
  *> 192.1.25.0 192.1.1.1 0 0 100 i
  *> 192.1.26.0 194.1.1.4 0 0 300 i
  *> 192.1.27.0 194.1.1.4 0 0 300 i
  r2#

  show ip ro
  r2#sh ip ro
  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
  i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
  * - candidate default, U - per-user static route, o - ODR
  P - periodic downloaded static route
  Gateway of last resort is not set
  B 192.1.25.0/24 [20/0] via 192.1.1.1, 00:43:46
  B 192.1.24.0/24 [20/0] via 192.1.1.1, 00:43:46
  B 192.1.27.0/24 [20/0] via 194.1.1.4, 00:38:14
  B 192.1.26.0/24 [20/0] via 194.1.1.4, 00:38:14
  C 193.1.1.0/24 is directly connected, Serial0/0
  C 192.1.1.0/24 is directly connected, FastEthernet0/0
  C 194.1.1.0/24 is directly connected, FastEthernet0/1

  排错:

  我们在验证过程中,可观察到r1上的路由条目:
  show ip ro
  B 192.1.27.0/24 [20/0] via 192.1.1.2, 00:38:14
  B 192.1.26.0/24 [20/0] via 192.1.1.2, 00:38:14
  C 192.1.1.0/24 is directly connected, f0/0

  路由表中含有26 27的路径,我们接下来用ping进一步验证。
  ping 192.1.26.1
  .....
  结果却出乎意料,不通。。。。。。

  仔细检查各路由器的路由表:
  r2# show ip ro
  B 192.1.25.0/24 [20/0] via 192.1.1.1, 00:43:46
  B 192.1.24.0/24 [20/0] via 192.1.1.1, 00:43:46
  B 192.1.27.0/24 [20/0] via 194.1.1.4, 00:38:14
  B 192.1.26.0/24 [20/0] via 194.1.1.4, 00:38:14
  C 193.1.1.0/24 is directly connected, Serial0/0
  C 192.1.1.0/24 is directly connected, FastEthernet0/0
  C 194.1.1.0/24 is directly connected, FastEthernet0/1

  r2上也有到达目的网段的路径:192.1.26.0,我们在R2上ping目的网段进行尝试:
  ping 192.1.26.1
  !!!!!

  问题集中到r4上了,我们看下它的路由表:
  r4# show ip ro
  B 192.1.25.0/24 [20/0] via 192.1.1.1, 00:43:46
  B 192.1.24.0/24 [20/0] via 192.1.1.1, 00:43:46
  C 192.1.26.0/24 is directly connected, lo1
  C 192.1.27.0/24 is directly connected, lo2
  C 194.1.1.4/24 is directly connected, f4/4

  r1发出的ping包可以正确被转发至r2、r4。
  ping是双向的,当我们在r1上发起ping后,是利用的r1的f0/0口IP地址做为其源地址,即192.1.1.1。
  当ping包到达了r4后,在给源做回应时,却发现其路由表中没有到达192.1.1.1的地址,包被丢弃。所以我们见不到!!!!!
  原因找到了,我们在验证时可以使用扩展ping把ping的源地址改为192.168.25.1即可。

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系我们 |网站地图  

GMT+8, 2024-11-16 15:19 , Processed in 0.269053 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部