BGP Confederation配置实例

如下图示:

R1:
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
interface FastEthernet0/0
 ip address 12.1.1.1 255.255.255.0
 no sh
interface FastEthernet0/1
 ip address 13.1.1.1 255.255.255.0
 no sh
router bgp 65001
 bgp router-id 1.1.1.1
 bgp confederation identifier 100     //联邦AS号
 bgp confederation peers 65002        //如果不加peers的话,65001学习不到同为联邦的AS 65002子路由。
 network 1.1.1.1 mask 255.255.255.255
 neighbor 12.1.1.2 remote-as 200
 neighbor 13.1.1.3 remote-as 65002
 neighbor 13.1.1.3 next-hop-self

R2:
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
interface FastEthernet0/0
 ip address 12.1.1.2 255.255.255.0
 no sh
interface FastEthernet1/0
 ip address 23.1.1.2 255.255.255.0
 no sh
router bgp 200
 bgp router-id 2.2.2.2
 network 2.2.2.2 mask 255.255.255.255
 network 12.1.1.0 mask 255.255.255.0      //需要宣告所有互连网络的eBGP网段,才能互通R4的路由。
 network 23.1.1.0 mask 255.255.255.0      //同上。
 neighbor 12.1.1.1 remote-as 100
 neighbor 23.1.1.3 remote-as 100

R3:
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
interface FastEthernet0/0
 ip address 34.1.1.3 255.255.255.0
 no 
interface FastEthernet0/1
 ip address 13.1.1.3 255.255.255.0
 no sh
interface FastEthernet1/0
 ip address 23.1.1.3 255.255.255.0
 no sh
router eigrp 1      //R3和R4互联IGP路由
 network 3.0.0.0
 network 34.0.0.0
 no auto-summary
router bgp 65002
 bgp router-id 3.3.3.3
 bgp confederation identifier 100       //联邦AS号
 bgp confederation peers 65001         //如果不加peers的话,65002学习不到同为联邦的AS 65001子路由。
 network 3.3.3.3 mask 255.255.255.255
 network 13.1.1.0 mask 255.255.255.0  //需要宣告所有网段路由,才能让各种iBGP和eBGP学习到精确路由,否则会产生路由环,导致网络不通。
 network 23.1.1.0 mask 255.255.255.0  //同上
 network 34.1.1.0 mask 255.255.255.0  //同上
 neighbor 4.4.4.4 remote-as 65002
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 13.1.1.1 remote-as 65001
 neighbor 13.1.1.1 next-hop-self
 neighbor 23.1.1.2 remote-as 200

R4:
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
interface FastEthernet0/0
 ip address 34.1.1.4 255.255.255.0
 no sh
router eigrp 1     //R3和R4互联IGP路由  
 network 4.0.0.0
 network 34.0.0.0
 no auto-summary
router bgp 65002
 bgp router-id 4.4.4.4
 network 4.4.4.4 mask 255.255.255.255
 network 34.1.1.0 mask 255.255.255.0  //需要宣告本地互连网络到iBGP,才能让iBGP和eBGP学习到相关路由,和去向iBGP和eBGP路由学习。如果不宣告,R2学习不到R4的路由。
 neighbor 3.3.3.3 remote-as 65002
 neighbor 3.3.3.3 update-source Loopback0
R2#ping 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/37/56 ms
R2#
R2#
R2#show 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

     34.0.0.0/24 is subnetted, 1 subnets
B       34.1.1.0 [20/0] via 23.1.1.3, 00:01:43
     1.0.0.0/32 is subnetted, 1 subnets
B       1.1.1.1 [20/0] via 12.1.1.1, 00:01:43
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
B       3.3.3.3 [20/0] via 23.1.1.3, 00:01:43
     4.0.0.0/32 is subnetted, 1 subnets
B       4.4.4.4 [20/0] via 23.1.1.3, 00:01:43
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, FastEthernet1/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
B       13.1.1.0 [20/0] via 23.1.1.3, 00:01:46



R4#ping 2.2.2.2 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/30/36 ms
R4#show 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

     34.0.0.0/24 is subnetted, 1 subnets
C       34.1.1.0 is directly connected, FastEthernet0/0
     1.0.0.0/32 is subnetted, 1 subnets
B       1.1.1.1 [200/0] via 3.3.3.3, 00:02:47
     2.0.0.0/32 is subnetted, 1 subnets
B       2.2.2.2 [200/0] via 3.3.3.3, 00:02:47
     3.0.0.0/32 is subnetted, 1 subnets
D       3.3.3.3 [90/409600] via 34.1.1.3, 00:03:37, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
B       23.1.1.0 [200/0] via 3.3.3.3, 00:02:48
     12.0.0.0/24 is subnetted, 1 subnets
B       12.1.1.0 [200/0] via 3.3.3.3, 00:02:49
     13.0.0.0/24 is subnetted, 1 subnets
B       13.1.1.0 [200/0] via 3.3.3.3, 00:02:49
R1#show ip bgp all summary 
For address family: IPv4 Unicast
BGP router identifier 1.1.1.1, local AS number 65001
BGP table version is 12, main routing table version 12
8 network entries using 936 bytes of memory
11 path entries using 572 bytes of memory
5/3 BGP path/bestpath attribute entries using 620 bytes of memory
3 BGP AS-PATH entries using 72 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 using 2200 total bytes of memory
BGP activity 8/0 prefixes, 11/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.2        4   200      13      11       12    0    0 00:06:08        3
13.1.1.3        4 65002      12      11       12    0    0 00:06:03        7

R2#show ip bgp all summary 
For address family: IPv4 Unicast
BGP router identifier 2.2.2.2, local AS number 200
BGP table version is 9, main routing table version 9
8 network entries using 936 bytes of memory
15 path entries using 780 bytes of memory
4/3 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP AS-PATH entries using 24 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 using 2236 total bytes of memory
BGP activity 8/0 prefixes, 15/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.1        4   100      12      14        9    0    0 00:07:22        6
23.1.1.3        4   100      13      14        9    0    0 00:07:16        6

R3#show ip bgp all summary 
For address family: IPv4 Unicast
BGP router identifier 3.3.3.3, local AS number 65002
BGP table version is 10, main routing table version 10
8 network entries using 936 bytes of memory
12 path entries using 624 bytes of memory
6/4 BGP path/bestpath attribute entries using 744 bytes of memory
3 BGP AS-PATH entries using 72 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 using 2376 total bytes of memory
BGP activity 8/0 prefixes, 12/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
4.4.4.4         4 65002      10      12       10    0    0 00:06:36        2
13.1.1.1        4 65001      11      12       10    0    0 00:06:29        3
23.1.1.2        4   200      13      12       10    0    0 00:06:28        3

R4#show ip bgp all summary 
For address family: IPv4 Unicast
BGP router identifier 4.4.4.4, local AS number 65002
BGP table version is 10, main routing table version 10
8 network entries using 936 bytes of memory
9 path entries using 468 bytes of memory
5/4 BGP path/bestpath attribute entries using 620 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 using 2072 total bytes of memory
BGP activity 8/0 prefixes, 9/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
3.3.3.3         4 65002      11       9       10    0    0 00:05:38        7

 

posted @ 2017-02-24 15:59  myway_liang  阅读(2547)  评论(0编辑  收藏  举报