建立BGP互连
前提:接口互通
1、  各路由器的配制如下:
R1(config)#router bgp 100
R1(config-router)#neig
R1(config-router)#neighbor 12.0.0.2 remote-as 200
R1(config-router)#neig
R1(config-router)#neighbor 15.0.0.5 remote-as 300
R1(config-router)#net
R1(config-router)#network 1.1.1.0 mask 255.255.255.0
R1(config-router)#end
 
R2(config)#router eigrp 100
R2(config-router)#net
R2(config-router)#network 23.0.0.0 0.0.0.0 
R2(config-router)#no au
R2(config-router)#exit
R2(config)#
R2(config)#router bgp 200
R2(config-router)#neighbor 23.0.0.3 remote-as 200
R2(config-router)#neighbor 12.0.0.1 remote-as 100
R2(config-router)#network 2.2.2.0 mask 255.255.255.0
R2(config-router)#end
 
R3(config)#router eigrp 100
R3(config-router)#no au
R3(config-router)#net 23.0.0.0 0.0.0.255
R3(config-router)#net 3.3.3.0 0.0.0.0
R3(config-router)#exit
R3(config)#
R3(config)#
R3(config)#router bgp 200
R3(config-router)#neighbor 23.0.0.2 remote-as 200
R3(config-router)#neighbor 34.0.0.4 remote-as 300
R3(config-router)#networ
R3(config-router)#network 3.3.3.0 mask 255.255.255.0
R3(config-router)#end
 
R4(config)#router eigrp 100
R4(config-router)#no au
R4(config-router)#net 4.4.4.0 0.0.0.0
R4(config-router)#net 45.0.0.0 0.0.0.0
R4(config-router)#exit
R4(config)#
R4(config)#
R4(config)#router bgp 300
R4(config-router)#neighbor 45.0.0.5 remote-as 300
R4(config-router)#neighbor 34.0.0.3 remote-as 200
R4(config-router)#network 4.4.4.0 mask 255.255.255.0
R4(config-router)#end
 
R5(config)#router eigrp 100
R5(config-router)#no au
R5(config-router)#net 45.0.0.0 0.0.0.0
R5(config-router)#net 5.5.5.0 0.0.0.0
R5(config-router)#exit
R5(config)# 
R5(config)#
R5(config)#
R5(config)#router bgp 300
R5(config-router)#neighbor 45.0.0.4 remote-as 300
R5(config-router)#neighbor 45.0.0.4 next-h
R5(config-router)#neighbor 15.0.0.1 remote-as 100
R5(config-router)#network 5.5.5.0 mask 255.255.255.0
R5(config-router)#end
 
2、  查看bgp建立情况
 
 
R1#sh ip bgp
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       0.0.0.0                  0         32768 i
*  2.2.2.0/24       15.0.0.5                               0 300 200 i
*>                  12.0.0.2                 0             0 200 i
*  3.3.3.0/24       15.0.0.5                               0 300 200 i
*>                  12.0.0.2                               0 200 i
*> 4.4.4.0/24       15.0.0.5                               0 300 i
*> 5.5.5.0/24       15.0.0.5                 0             0 300 i
 
 
R2#sh ip bgp
BGP table version is 6, local router ID is 23.0.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       12.0.0.1                 0             0 100 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i
*>i3.3.3.0/24       23.0.0.3                 0    100      0 i
*> 4.4.4.0/24       12.0.0.1                               0 100 300 i
* i                 34.0.0.4                 0    100      0 300 i
* i5.5.5.0/24       34.0.0.4                 0    100      0 300 i
*>                  12.0.0.1                               0 100 300 i
R2#
 
R3#sh ip bgp
BGP table version is 6, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*  1.1.1.0/24       34.0.0.4                               0 300 100 i
*>i                 23.0.0.2                 0    100      0 100 i
*>i2.2.2.0/24       23.0.0.2                 0    100      0 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i
* i4.4.4.0/24       23.0.0.2                 0    100      0 100 300 i
*>                  34.0.0.4                 0             0 300 i
* i5.5.5.0/24       23.0.0.2                 0    100      0 100 300 i
*>                  34.0.0.4                               0 300 i
R3#trac
 
R4(config)#do sh ip bgp
BGP table version is 7, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*  1.1.1.0/24       34.0.0.3                               0 200 100 i
*>i                 45.0.0.5                 0    100      0 100 i
* i2.2.2.0/24       45.0.0.5                 0    100      0 100 200 i
*>                  34.0.0.3                               0 200 i
* i3.3.3.0/24       45.0.0.5                 0    100      0 100 200 i
*>                  34.0.0.3                 0             0 200 i
*> 4.4.4.0/24       0.0.0.0                  0         32768 i
*>i5.5.5.0/24       45.0.0.5                 0    100      0 i
 
 
R5#sh ip bgp
BGP table version is 8, local router ID is 45.0.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       15.0.0.1                 0             0 100 i
*>i2.2.2.0/24       45.0.0.4                 0    100      0 200 i
*                   15.0.0.1                               0 100 200 i
*  3.3.3.0/24       15.0.0.1                               0 100 200 i
*>i                 45.0.0.4                 0    100      0 200 i
*>i4.4.4.0/24       45.0.0.4                 0    100      0 i
*> 5.5.5.0/24       0.0.0.0                  0         32768 i
R5#