BGP-IBGP-EBGP实验配置

好久没看网络的东西,最近突然心血来潮,温习一下BGP的路由协议,虽说这个协议企业里面使用很少,但是总归还是一个重要的协议,以下为拓扑图,其中R1/R2/R4为C7200,其他的均为3640

R1/R2/R3/R4运行基于OSPF的iBGP协议,R1与R5、R6之间,R4与R7、R8之间运行基于EIGRP的eBGP协议

topo.jpg

R1配置:

!
hostname R1
!
interface Loopback1
 ip address 172.11.11.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.100.1.1 255.255.255.252
!
interface FastEthernet0/1
 ip address 10.11.1.1 255.255.255.0
!
interface FastEthernet1/0
 ip address 192.168.15.1 255.255.255.0
!
interface FastEthernet1/1
 ip address 192.168.17.1 255.255.255.0
!
interface FastEthernet2/0
 ip address 10.11.12.1 255.255.255.0
!
router eigrp 11
 network 192.168.15.1 0.0.0.0
 no auto-summary
!
router eigrp 12
 network 192.168.17.1 0.0.0.0
 no auto-summary
!
router ospf 1
 log-adjacency-changes
 network 10.11.1.0 0.0.0.255 area 0
 network 10.11.12.0 0.0.0.255 area 0
 network 10.100.1.0 0.0.0.3 area 0
 network 172.11.11.1 0.0.0.0 area 0
!
router bgp 65332
 no synchronization
 bgp log-neighbor-changes
 network 10.11.1.0 mask 255.255.255.0
 network 10.11.12.0 mask 255.255.255.0
 network 10.100.1.0 mask 255.255.255.252
 network 172.11.11.1 mask 255.255.255.255
 network 192.168.15.0
 network 192.168.17.0
 neighbor 172.11.11.3 remote-as 65332
 neighbor 172.11.11.3 update-source Loopback1
 neighbor 172.12.12.1 remote-as 65332
 neighbor 172.12.12.1 update-source Loopback1
 neighbor 172.12.12.4 remote-as 65332
 neighbor 172.12.12.4 update-source Loopback1
 neighbor 192.168.15.10 remote-as 65115
 neighbor 192.168.15.10 ebgp-multihop 2
 neighbor 192.168.15.10 update-source FastEthernet1/0
 neighbor 192.168.17.10 remote-as 65117
 neighbor 192.168.17.10 ebgp-multihop 2
 neighbor 192.168.17.10 update-source FastEthernet1/1
 no auto-summary
!
R2配置:

!
hostname R2
!
interface Loopback1
 ip address 172.12.12.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.100.1.2 255.255.255.252
!
interface FastEthernet0/1
 ip address 10.12.1.1 255.255.255.0
!
interface FastEthernet3/1
 ip address 10.12.22.1 255.255.255.0
!
router ospf 1
 log-adjacency-changes
 network 10.12.1.0 0.0.0.255 area 0
 network 10.12.22.0 0.0.0.255 area 0
 network 10.100.1.0 0.0.0.3 area 0
 network 172.12.12.1 0.0.0.0 area 0
!
router bgp 65332
 no synchronization
 bgp log-neighbor-changes
 network 10.12.1.0 mask 255.255.255.0
 network 10.12.22.0 mask 255.255.255.0
 network 10.100.1.0 mask 255.255.255.252
 network 172.12.12.1 mask 255.255.255.255
 neighbor 172.11.11.1 remote-as 65332
 neighbor 172.11.11.1 update-source Loopback1
 neighbor 172.11.11.3 remote-as 65332
 neighbor 172.11.11.3 update-source Loopback1
 neighbor 172.12.12.4 remote-as 65332
 neighbor 172.12.12.4 update-source Loopback1
 no auto-summary
!
R3配置

!
hostname R3
!
interface Loopback11
 ip address 172.11.11.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.11.1.2 255.255.255.0
!
interface FastEthernet1/0
 ip address 10.101.1.1 255.255.255.252
!
interface FastEthernet2/0
 ip address 10.12.22.2 255.255.255.0
!
router ospf 1
 log-adjacency-changes
 network 10.11.1.0 0.0.0.255 area 0
 network 10.12.22.0 0.0.0.255 area 0
 network 10.101.1.0 0.0.0.3 area 0
 network 172.11.11.3 0.0.0.0 area 0
!
router bgp 65332
 no synchronization
 bgp log-neighbor-changes
 network 10.11.1.0 mask 255.255.255.0
 network 10.12.22.0 mask 255.255.255.0
 network 10.101.1.0 mask 255.255.255.252
 network 172.11.11.3 mask 255.255.255.255
 neighbor 172.11.11.1 remote-as 65332
 neighbor 172.11.11.1 update-source Loopback11
 neighbor 172.12.12.1 remote-as 65332
 neighbor 172.12.12.1 update-source Loopback11
 neighbor 172.12.12.4 remote-as 65332
 neighbor 172.12.12.4 update-source Loopback11
 no auto-summary
!
R4配置

interface Loopback11
 ip address 172.12.12.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.12.1.2 255.255.255.0
!
interface FastEthernet0/1
 ip address 10.101.1.2 255.255.255.252
!
interface FastEthernet1/0
 ip address 192.168.16.1 255.255.255.0
!
interface FastEthernet1/1
 ip address 192.168.18.1 255.255.255.0
 !
interface FastEthernet2/0
 ip address 10.11.12.2 255.255.255.0
!
router eigrp 1
 network 192.168.16.0
 no auto-summary
!
router eigrp 2
 network 192.168.18.0
 no auto-summary
!
router ospf 11
 log-adjacency-changes
 network 10.11.12.0 0.0.0.255 area 0
 network 10.12.1.0 0.0.0.255 area 0
 network 10.101.1.0 0.0.0.3 area 0
 network 172.12.12.4 0.0.0.0 area 0
!
router bgp 65332
 no synchronization
 bgp log-neighbor-changes
 network 10.11.12.0 mask 255.255.255.0
 network 10.12.1.0 mask 255.255.255.0
 network 10.101.1.0 mask 255.255.255.252
 network 172.12.12.4 mask 255.255.255.255
 network 192.168.16.0
 network 192.168.18.0
 neighbor 172.11.11.1 remote-as 65332
 neighbor 172.11.11.1 update-source Loopback11
 neighbor 172.11.11.3 remote-as 65332
 neighbor 172.11.11.3 update-source Loopback11
 neighbor 172.12.12.1 remote-as 65332
 neighbor 172.12.12.1 update-source Loopback11
 neighbor 192.168.16.10 remote-as 65116
 neighbor 192.168.16.10 ebgp-multihop 2
 neighbor 192.168.16.10 update-source FastEthernet1/0
 neighbor 192.168.18.10 remote-as 65118
 neighbor 192.168.18.10 ebgp-multihop 2
 neighbor 192.168.18.10 update-source FastEthernet1/1
 no auto-summary
!

R5配置

interface FastEthernet0/0
 ip address 192.168.15.10 255.255.255.0
!
router eigrp 11
 network 192.168.15.10 0.0.0.0
 no auto-summary
!
router bgp 65115
 no synchronization
 bgp log-neighbor-changes
 network 192.168.15.0
 neighbor 192.168.15.1 remote-as 65332
 neighbor 192.168.15.1 ebgp-multihop 2
 neighbor 192.168.15.1 update-source FastEthernet0/0
 no auto-summary

R6配置

interface FastEthernet0/0
 ip address 192.168.16.10 255.255.255.0
 duplex auto
 speed auto
!
router eigrp 1
  network 192.168.16.0
 auto-summary
!
router bgp 65116
 no synchronization
 bgp log-neighbor-changes
 network 192.168.16.0
 neighbor 192.168.16.1 remote-as 65332
 neighbor 192.168.16.1 ebgp-multihop 2
 neighbor 192.168.16.1 update-source FastEthernet0/0
 no auto-summary

R7配置

interface FastEthernet0/0
 ip address 192.168.17.10 255.255.255.0
!
router eigrp 12
 network 192.168.17.10 0.0.0.0
 no auto-summary
!
router bgp 65117
 no synchronization
 bgp log-neighbor-changes
 network 192.168.17.0
 neighbor 192.168.17.1 remote-as 65332
 neighbor 192.168.17.1 ebgp-multihop 2
 neighbor 192.168.17.1 update-source FastEthernet0/0
 no auto-summary

R8配置

interface FastEthernet0/0
 ip address 192.168.18.10 255.255.255.0
!
router eigrp 2
 network 192.168.18.0
 no auto-summary
!
router bgp 65118
 no synchronization
 bgp log-neighbor-changes
 network 192.168.18.0
 neighbor 192.168.18.1 remote-as 65332
 neighbor 192.168.18.1 ebgp-multihop 2
 neighbor 192.168.18.1 update-source FastEthernet0/0
 no auto-summary

---------------------------------------------------------------------------

show命令如下:

---------------------------------------------------------------------------

R6#sh ip bgp
BGP table version is 353, local router ID is 192.168.16.10
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
*> 10.11.1.0/24     192.168.16.1                           0 65332 i
*> 10.11.12.0/24    192.168.16.1             0             0 65332 i
*> 10.12.1.0/24     192.168.16.1             0             0 65332 i
*> 10.12.22.0/24    192.168.16.1                           0 65332 i
*> 10.100.1.0/30    192.168.16.1                           0 65332 i
*> 10.101.1.0/30    192.168.16.1             0             0 65332 i
*> 172.11.11.1/32   192.168.16.1                           0 65332 i
*> 172.11.11.3/32   192.168.16.1                           0 65332 i
*> 172.12.12.1/32   192.168.16.1                           0 65332 i
*> 172.12.12.4/32   192.168.16.1             0             0 65332 i
*> 192.168.15.0     192.168.16.1                           0 65332 i
*  192.168.16.0     192.168.16.1             0             0 65332 i
*>                  0.0.0.0                  0         32768 i
*> 192.168.17.0     192.168.16.1                           0 65332 i
*> 192.168.18.0     192.168.16.1             0             0 65332 i

R6#sh ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.168.15.0/24 [20/0] via 192.168.16.1, 00:39:10
     172.11.0.0/32 is subnetted, 2 subnets
B       172.11.11.1 [20/0] via 192.168.16.1, 00:39:10
B       172.11.11.3 [20/0] via 192.168.16.1, 00:39:10
     172.12.0.0/32 is subnetted, 2 subnets
B       172.12.12.4 [20/0] via 192.168.16.1, 00:39:10
B       172.12.12.1 [20/0] via 192.168.16.1, 00:39:10
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.16.1/32 is directly connected, Loopback11
D       172.16.0.0/16 is a summary, 01:59:06, Null0
     10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
B       10.11.1.0/24 [20/0] via 192.168.16.1, 00:39:10
B       10.12.1.0/24 [20/0] via 192.168.16.1, 00:39:10
B       10.11.12.0/24 [20/0] via 192.168.16.1, 00:39:10
B       10.12.22.0/24 [20/0] via 192.168.16.1, 00:39:10
B       10.101.1.0/30 [20/0] via 192.168.16.1, 00:39:10
B       10.100.1.0/30 [20/0] via 192.168.16.1, 00:39:10
B    192.168.17.0/24 [20/0] via 192.168.16.1, 00:39:10
C    192.168.16.0/24 is directly connected, FastEthernet0/0
B    192.168.18.0/24 [20/0] via 192.168.16.1, 00:39:10

-------------------------------------------------------------------------

R5#sh ip bgp
BGP table version is 21, local router ID is 192.168.15.10
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
*> 10.11.1.0/24     192.168.15.1             0             0 65332 i
*> 10.11.12.0/24    192.168.15.1             0             0 65332 i
*> 10.12.1.0/24     192.168.15.1                           0 65332 i
*> 10.12.22.0/24    192.168.15.1                           0 65332 i
*> 10.100.1.0/30    192.168.15.1             0             0 65332 i
*> 10.101.1.0/30    192.168.15.1                           0 65332 i
*> 172.11.11.1/32   192.168.15.1             0             0 65332 i
*> 172.11.11.3/32   192.168.15.1                           0 65332 i
*> 172.12.12.1/32   192.168.15.1                           0 65332 i
*> 172.12.12.4/32   192.168.15.1                           0 65332 i
*> 192.168.15.0     0.0.0.0                  0         32768 i
*                   192.168.15.1             0             0 65332 i
*> 192.168.16.0     192.168.15.1                           0 65332 i
*> 192.168.17.0     192.168.15.1             0             0 65332 i
*> 192.168.18.0     192.168.15.1                           0 65332 i

R5#sh ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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

C    192.168.15.0/24 is directly connected, FastEthernet0/0
     172.11.0.0/32 is subnetted, 2 subnets
B       172.11.11.1 [20/0] via 192.168.15.1, 02:23:02
B       172.11.11.3 [20/0] via 192.168.15.1, 02:21:39
     172.12.0.0/32 is subnetted, 2 subnets
B       172.12.12.4 [20/0] via 192.168.15.1, 02:24:12
B       172.12.12.1 [20/0] via 192.168.15.1, 02:22:21
     10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
B       10.11.1.0/24 [20/0] via 192.168.15.1, 04:05:40
B       10.12.1.0/24 [20/0] via 192.168.15.1, 04:05:40
B       10.11.12.0/24 [20/0] via 192.168.15.1, 04:05:40
B       10.12.22.0/24 [20/0] via 192.168.15.1, 04:05:40
B       10.101.1.0/30 [20/0] via 192.168.15.1, 04:05:40
B       10.100.1.0/30 [20/0] via 192.168.15.1, 04:05:41
B    192.168.17.0/24 [20/0] via 192.168.15.1, 01:53:17
B    192.168.16.0/24 [20/0] via 192.168.15.1, 01:56:03
B    192.168.18.0/24 [20/0] via 192.168.15.1, 01:56:34

----------------------------------------------------------------

R4#sh ip bgp
BGP table version is 29, local router ID is 172.12.12.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
r i10.11.1.0/24     172.11.11.3              0    100      0 i
r>i                 172.11.11.1              0    100      0 i
* i10.11.12.0/24    172.11.11.1              0    100      0 i
*>                  0.0.0.0                  0         32768 i
* i10.12.1.0/24     172.12.12.1              0    100      0 i
*>                  0.0.0.0                  0         32768 i
r>i10.12.22.0/24    172.11.11.3              0    100      0 i
r i                 172.12.12.1              0    100      0 i
r>i10.100.1.0/30    172.11.11.1              0    100      0 i
r i                 172.12.12.1              0    100      0 i
* i10.101.1.0/30    172.11.11.3              0    100      0 i
*>                  0.0.0.0                  0         32768 i
r>i172.11.11.1/32   172.11.11.1              0    100      0 i
r>i172.11.11.3/32   172.11.11.3              0    100      0 i
r>i172.12.12.1/32   172.12.12.1              0    100      0 i
*> 172.12.12.4/32   0.0.0.0                  0         32768 i
*>i192.168.15.0     172.11.11.1              0    100      0 i
   Network          Next Hop            Metric LocPrf Weight Path
*  192.168.16.0     192.168.16.10            0             0 65116 i
*>                  0.0.0.0                  0         32768 i
*>i192.168.17.0     172.11.11.1              0    100      0 i
*  192.168.18.0     192.168.18.10            0             0 65118 i
*>                  0.0.0.0                  0         32768 i

R4#sh ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.168.15.0/24 [200/0] via 172.11.11.1, 01:59:50
     172.11.0.0/32 is subnetted, 2 subnets
O       172.11.11.1 [110/2] via 10.11.12.1, 04:19:29, FastEthernet2/0
O       172.11.11.3 [110/2] via 10.101.1.1, 04:17:12, FastEthernet0/1
     172.12.0.0/32 is subnetted, 2 subnets
C       172.12.12.4 is directly connected, Loopback11
O       172.12.12.1 [110/2] via 10.12.1.1, 04:18:59, FastEthernet0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D       172.16.18.1/32
           [90/156160] via 192.168.18.10, 02:18:35, FastEthernet1/1
D       172.16.0.0/16 [90/156160] via 192.168.16.10, 02:06:57, FastEthernet1/0
     10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O       10.11.1.0/24 [110/2] via 10.101.1.1, 04:17:12, FastEthernet0/1
                     [110/2] via 10.11.12.1, 04:19:29, FastEthernet2/0
C       10.12.1.0/24 is directly connected, FastEthernet0/0
C       10.11.12.0/24 is directly connected, FastEthernet2/0
O       10.12.22.0/24 [110/2] via 10.101.1.1, 04:17:13, FastEthernet0/1
                      [110/2] via 10.12.1.1, 04:18:59, FastEthernet0/0
C       10.101.1.0/30 is directly connected, FastEthernet0/1
O       10.100.1.0/30 [110/2] via 10.12.1.1, 04:18:59, FastEthernet0/0
                      [110/2] via 10.11.12.1, 04:19:29, FastEthernet2/0
B    192.168.17.0/24 [200/0] via 172.11.11.1, 01:59:47
C    192.168.16.0/24 is directly connected, FastEthernet1/0
C    192.168.18.0/24 is directly connected, FastEthernet1/1-------------------------------------------------------------------

R3#sh ip bgp
BGP table version is 25, local router ID is 172.11.11.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
* i10.11.1.0/24     172.11.11.1              0    100      0 i
*>                  0.0.0.0                  0         32768 i
r>i10.11.12.0/24    172.11.11.1              0    100      0 i
r i                 172.12.12.4              0    100      0 i
r i10.12.1.0/24     172.12.12.4              0    100      0 i
r>i                 172.12.12.1              0    100      0 i
* i10.12.22.0/24    172.12.12.1              0    100      0 i
*>                  0.0.0.0                  0         32768 i
r>i10.100.1.0/30    172.11.11.1              0    100      0 i
r i                 172.12.12.1              0    100      0 i
* i10.101.1.0/30    172.12.12.4              0    100      0 i
*>                  0.0.0.0                  0         32768 i
r>i172.11.11.1/32   172.11.11.1              0    100      0 i
*> 172.11.11.3/32   0.0.0.0                  0         32768 i
r>i172.12.12.1/32   172.12.12.1              0    100      0 i
r>i172.12.12.4/32   172.12.12.4              0    100      0 i
*>i192.168.15.0     172.11.11.1              0    100      0 i
   Network          Next Hop            Metric LocPrf Weight Path
*>i192.168.16.0     172.12.12.4              0    100      0 i
*>i192.168.17.0     172.11.11.1              0    100      0 i
*>i192.168.18.0     172.12.12.4              0    100      0 i

R3#sh ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.168.15.0/24 [200/0] via 172.11.11.1, 01:57:26
     172.11.0.0/32 is subnetted, 2 subnets
O       172.11.11.1 [110/2] via 10.11.1.1, 04:14:51, FastEthernet0/0
C       172.11.11.3 is directly connected, Loopback11
     172.12.0.0/32 is subnetted, 2 subnets
O       172.12.12.4 [110/2] via 10.101.1.2, 04:14:51, FastEthernet1/0
O       172.12.12.1 [110/2] via 10.12.22.1, 04:14:51, FastEthernet2/0
     10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C       10.11.1.0/24 is directly connected, FastEthernet0/0
O       10.12.1.0/24 [110/2] via 10.101.1.2, 04:14:51, FastEthernet1/0
                     [110/2] via 10.12.22.1, 04:14:51, FastEthernet2/0
O       10.11.12.0/24 [110/2] via 10.101.1.2, 04:14:51, FastEthernet1/0
                      [110/2] via 10.11.1.1, 04:14:51, FastEthernet0/0
C       10.12.22.0/24 is directly connected, FastEthernet2/0
C       10.101.1.0/30 is directly connected, FastEthernet1/0
O       10.100.1.0/30 [110/2] via 10.12.22.1, 04:14:52, FastEthernet2/0
                      [110/2] via 10.11.1.1, 04:14:52, FastEthernet0/0
B    192.168.17.0/24 [200/0] via 172.11.11.1, 01:57:23
B    192.168.16.0/24 [200/0] via 172.12.12.4, 02:00:10
B    192.168.18.0/24 [200/0] via 172.12.12.4, 02:00:13

猜你喜欢

转载自blog.51cto.com/8669236/2298158