Mr.Chan

导航

网友实验日记...

照cisco bgp 4命令与配置手册做实验。在宿舍。
aggregate 命令,
在r3上
router bgp 2
aggregate-address 172.16.0.0 255.255.252.0

在r2上。
r2#sh ip bgp
BGP table version is 16, local router ID is 133.1.2.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
*> 172.16.0.0/24    133.1.23.3               0             0 2 i
*> 172.16.0.0/22    133.1.23.3               0             0 2 i
*> 172.16.1.0/24    133.1.23.3               0             0 2 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
在r3上
r3#sh ip bgp
BGP table version is 24, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.0.0/22    0.0.0.0                            32768 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.16.2.0/24    0.0.0.0                  0         32768 i
*> 172.16.3.0/24    0.0.0.0                  0         32768 i
r3#
r3上的debug ip bgp 信息
*Mar  1 00:28:19.067: BGP: Applying map to find origin for 172.16.0.0/24
*Mar  1 00:28:19.071: BGP: Applying map to find origin for 172.16.1.0/24
*Mar  1 00:28:19.075: BGP: Applying map to find origin for 172.16.2.0/24
*Mar  1 00:28:19.079: BGP: Applying map to find origin for 172.16.3.0/24
在r3上看那条22位聚合路由
r3#sh ip bgp 172.16.0.0 255.255.252.0
BGP routing table entry for 172.16.0.0/22, version 24
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  133.1.23.2
  Local, (aggregated by 2 133.1.3.3)
    0.0.0.0 from 0.0.0.0 (133.1.3.3)
      Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-
aggregate, best
r3#
在r2上看那条聚合路由。
r2#sh ip bgp 172.16.0.0 255.255.252.0
BGP routing table entry for 172.16.0.0/22, version 16
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  2, (aggregated by 2 133.1.3.3)
    133.1.23.3 from 133.1.23.3 (133.1.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, be
st

在r2上看路由表

     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
B       172.16.0.0/24 [20/0] via 133.1.23.3, 00:54:27
B       172.16.0.0/22 [20/0] via 133.1.23.3, 00:53:33
B       172.16.1.0/24 [20/0] via 133.1.23.3, 00:54:01
B       172.16.2.0/24 [20/0] via 133.1.23.3, 00:54:58
B       172.16.3.0/24 [20/0] via 133.1.23.3, 00:54:58
     133.1.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       133.1.4.4/32 [110/129] via 133.1.23.3, 01:09:13, Serial0
O       133.1.3.3/32 [110/65] via 133.1.23.3, 01:09:13, Serial0
C       133.1.2.2/32 is directly connected, Loopback0
C       133.1.23.0/24 is directly connected, Serial0
O       133.1.34.0/24 [110/128] via 133.1.23.3, 01:09:14, Serial0
r2#

聚合bgp得到的路由:
在r2上
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 aggregate-address 172.16.0.0 255.255.252.0
 neighbor 10.0.0.4 remote-as 4
 neighbor 10.0.0.4 ebgp-multihop 255
 neighbor 133.1.23.3 remote-as 2
 neighbor 133.1.23.3 ebgp-multihop 255
 no auto-summary

r2#sh ip bgp
BGP table version is 18, local router ID is 133.1.2.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
*> 172.16.0.0/24    133.1.23.3               0             0 2 i
*> 172.16.0.0/22    0.0.0.0                            32768 i
*> 172.16.1.0/24    133.1.23.3               0             0 2 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#

r4#sh ip bgp
BGP table version is 6, local router ID is 133.1.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
*> 172.16.0.0/24    10.0.0.2                               0 1 2 i
*> 172.16.0.0/22    10.0.0.2                 0             0 1 i
*> 172.16.1.0/24    10.0.0.2                               0 1 2 i
*> 172.16.2.0/24    10.0.0.2                               0 1 2 i
*> 172.16.3.0/24    10.0.0.2                               0 1 2 i
r4#
--------------------------------------------

r2#sh run
Building configuration...
Current configuration : 884 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r2
!
logging queue-limit 100
!
ip subnet-zero
no ip domain lookup
!
!
!
!
interface Loopback0
 ip address 133.1.2.2 255.255.255.255
!
interface Ethernet0
 ip address 10.0.0.2 255.255.255.0
!
interface Serial0
 ip address 133.1.23.2 255.255.255.0
!
interface Serial1
 no ip address
 shutdown
!
router ospf 1
 router-id 133.1.2.2
 log-adjacency-changes
 network 133.1.2.2 0.0.0.0 area 0
 network 133.1.23.2 0.0.0.0 area 0
!
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 10.0.0.4 remote-as 4
 neighbor 10.0.0.4 ebgp-multihop 255
 neighbor 133.1.23.3 remote-as 2
 neighbor 133.1.23.3 ebgp-multihop 255
 no auto-summary
!
no synchronization
 bgp log-neighbor-changes
 neighbor 10.0.0.4 remote-as 4
 neighbor 10.0.0.4 ebgp-multihop 255
 neighbor 133.1.23.3 remote-as 2
 neighbor 133.1.23.3 ebgp-multihop 255
 no auto-summary
!
no ip http server
ip classless
!
!
!
!
!
line con 0
 logging synchronous
line aux 0
line vty 0 4
 login
!


r4#sh run
Building configuration...

Current configuration : 1115 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r4
!
logging queue-limit 100
!
ip subnet-zero
no ip domain lookup
!
!
!
!
interface Loopback0
 ip address 133.1.4.4 255.255.255.255
!
interface Loopback1
 ip address 172.16.2.1 255.255.255.0 secondary
ip address 172.16.1.1 255.255.255.0 secondary
 ip address 172.16.0.1 255.255.255.0 secondary
 ip address 172.16.3.1 255.255.255.0
!
interface Ethernet0
 ip address 10.0.0.4 255.255.255.0
!
interface Serial0
 ip address 133.1.34.4 255.255.255.0
!
interface Serial1
 no ip address
 shutdown
!
router ospf 1
 router-id 133.1.4.4
 log-adjacency-changes
 network 133.1.4.4 0.0.0.0 area 0
 network 133.1.34.4 0.0.0.0 area 0
!
router bgp 4
 no synchronization
 bgp router-id 133.1.4.4
bgp router-id 133.1.4.4
 bgp log-neighbor-changes
 network 172.16.0.0 mask 255.255.255.0
 network 172.16.1.0 mask 255.255.255.0
 neighbor 10.0.0.2 remote-as 1
 neighbor 10.0.0.2 ebgp-multihop 255
 no auto-summary
!
no ip http server
ip classless
!
!
!
!
!
line con 0
 logging synchronous
line aux 0
line vty 0 4
 login
!
end

r4#


r2#sh ip bgp
BGP table version is 25, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#


r4#
*Mar  1 01:44:17.907: BGP: Applying map to find origin for 172.16.0.0/24
*Mar  1 01:44:17.911: BGP: Applying map to find origin for 172.16.1.0/24
r4#sh ip bgp
BGP table version is 17, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
r> 172.16.2.0/24    10.0.0.2                               0 1 2 i
r> 172.16.3.0/24    10.0.0.2                               0 1 2 i
r4#

----------------------
修改了重复的地址之后。
r2#sh ip bgp
BGP table version is 31, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#

r4#sh ip bgp
BGP table version is 25, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.16.2.0/24    10.0.0.2                               0 1 2 i
*> 172.16.3.0/24    10.0.0.2                               0 1 2 i
r4#

接着在r2(中间的路由器)上做聚合
r2(config-router)#aggregate-address 172.16.0.0 255.255.252.0
debug ip bgp  ing
r2(config)#exi
*Mar  1 02:00:56.919: BGP(0): Aggregate processing for IPv4 Unicast
*Mar  1 02:00:56.923: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 02:00:56.923: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 02:00:56.931: BGP(0): sub-prefix : 172.16.0.0/24
*Mar  1 02:00:56.931: BGP(0): Needs to be re-aggregated
*Mar  1 02:00:56.935: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 02:00:56.939: BGP(0): 172.16.0.0/22 aggregate has 172.16.0.0/24 more-spe
cific
*Mar  1 02:00:56.943: BGP(0): 172.16.0.0/22 aggregate created, attributes update
d
看bgp表
r2#sh ip bgp
BGP table version is 32, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.0.0/22    0.0.0.0                            32768 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
看看给邻居发了啥路由。
r2#sh ip bgp nei 10.0.0.4 advertised-routes
BGP table version is 32, local router ID is 133.1.2.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
*> 172.16.0.0/22    0.0.0.0                            32768 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
r2#sh ip bgp nei 133.1.23.3 advertised-routes
BGP table version is 32, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.0.0/22    0.0.0.0                            32768 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
r2#

在r3上看bgp表
r3#sh ip bgp
BGP table version is 52, local router ID is 133.1.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
*> 172.16.0.0/24    133.1.23.2                             0 1 4 i
*> 172.16.0.0/22    133.1.23.2               0             0 1 i
*> 172.16.1.0/24    133.1.23.2                             0 1 4 i
*> 172.16.2.0/24    0.0.0.0                  0         32768 i
*> 172.16.3.0/24    0.0.0.0                  0         32768 i

在r4上看
r4#sh ip bgp
BGP table version is 26, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.0.0/22    10.0.0.2                 0             0 1 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.16.2.0/24    10.0.0.2                               0 1 2 i
*> 172.16.3.0/24    10.0.0.2                               0 1 2 i
r4#
r4#sh ip bgp 172.16.0.0
BGP routing table entry for 172.16.0.0/24, version 22
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.2
  Local
    0.0.0.0 from 0.0.0.0 (133.1.4.4)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local,
best
r4#sh ip bgp 172.16.0.0/22
BGP routing table entry for 172.16.0.0/22, version 26
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  1, (aggregated by 1 133.1.2.2)
    10.0.0.2 from 10.0.0.2 (133.1.2.2)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, be
st
r4#
----------------
现在把那条聚合的语句no了。
r2(config-router)#no aggregate-address 172.16.0.0 255.255.252.0
r2(config-router)#
*Mar  1 02:09:16.927: BGP(0): Aggregate processing for IPv4 Unicast
*Mar  1 02:09:16.931: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 02:09:16.931: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 02:09:16.939: BGP(0): sub-prefix : 172.16.0.0/24
*Mar  1 02:09:16.939: BGP(0): Needs to be re-aggregated
*Mar  1 02:09:16.943: BGP(0): 172.16.0.0/22 aggregate is removed
*Mar  1 02:09:16.943: BGP(0): Aggregate 172.16.0.0/22 does not have more-specifi
cs
加上个as-set参数
r2(config-router)#aggregate-address 172.16.0.0 255.255.252.0 as-set
r2(config-router)#
*Mar  1 02:10:06.775: BGP(0): Aggregate processing for IPv4 Unicast
*Mar  1 02:10:06.779: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 02:10:06.783: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 02:10:06.787: BGP(0): sub-prefix : 172.16.0.0/24
*Mar  1 02:10:06.787: BGP(0): Needs to be re-aggregated
*Mar  1 02:10:06.791: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 02:10:06.795: BGP(0): 172.16.0.0/22 aggregate has 172.16.0.0/24 more-spe
cific
*Mar  1 02:10:06.799: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 02:10:06.807: BGP(0): 172.16.0.0/22 aggregate created, attributes update
d
这样就有as-path的信息了。看看bgp表
r2#sh ip bgp
BGP table version is 34, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.0.0/22    0.0.0.0                       100  32768 {4,2} i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
------------------
把这条聚合也no了,换一条
r2(config-router)#no aggregate-address 172.16.0.0 255.255.252.0 as-set
r2(config-router)#
*Mar  1 03:31:37.015: BGP(0): Aggregate processing for IPv4 Unicast
*Mar  1 03:31:37.019: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 03:31:37.019: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 03:31:37.027: BGP(0): sub-prefix : 172.16.0.0/24
*Mar  1 03:31:37.027: BGP(0): Needs to be re-aggregated
*Mar  1 03:31:37.031: BGP(0): 172.16.0.0/22 aggregate is removed
*Mar  1 03:31:37.035: BGP(0): Aggregate 172.16.0.0/22 does not have more-specifi
cs
r2(config-router)#

r2(config-router)#aggregate-address 172.16.0.0 255.255.252.0 as-set ad
r2(config-router)#$ddress 172.16.0.0 255.255.252.0 as-set advertise-map ass
r2(config-router)#
*Mar  1 03:32:53.159: BGP(0): Aggregate processing for IPv4 Unicast
*Mar  1 03:32:53.163: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 03:32:53.163: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 03:32:53.171: BGP(0): sub-prefix : 172.16.0.0/24
*Mar  1 03:32:53.171: BGP(0): Needs to be re-aggregated
*Mar  1 03:32:53.175: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 03:32:53.179: BGP(0): 172.16.0.0/22 aggregate has 172.16.0.0/24 more-spe
cific
*Mar  1 03:32:53.183: BGP(0): 172.16.0.0/22 aggregate has 172.16.1.0/24 more-spe
cific
*Mar  1 03:32:53.191: BGP(0): 172.16.0.0/22 aggregate has 172.16.2.0/24 more-spe
cific
r2(config-router)#
*Mar  1 03:32:53.195: BGP(0): 172.16.0.0/22 aggregate has 172.16.3.0/24 more-spe
cific
*Mar  1 03:32:53.195: BGP(0): Aggregate 172.16.0.0/22 does not have more-specifi
cs
r2(config-router)#
看了bgp表,没有变化。别的路由器也一样。
r2#sh ip bgp
BGP table version is 35, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
什么情况?

r2#sh access-li
Standard IP access list 1
    10 permit 172.16.0.0, wildcard bits 0.0.0.255
    20 permit 172.16.1.0, wildcard bits 0.0.0.255
r2#
r2#sh ro
route-map ass, permit, sequence 10
  Match clauses:
    ip address (access-lists): 1
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
r2#
原来是route-map错了。
r2#sh ro
route-map ass, permit, sequence 10
  Match clauses:
    as-path (as-path filter): 1
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
r2#
改了route-map之后,清一下,还是不行。

 

r2#sh log | in 172.16.0.0/22
*Mar  1 03:45:29.651: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 03:45:29.651: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 03:45:29.663: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 03:45:29.667: BGP(0): 172.16.0.0/22 aggregate has 172.16.0.0/24 more-spe
cific
*Mar  1 03:45:29.671: BGP(0): 172.16.0.0/22 aggregate has 172.16.1.0/24 more-spe
cific
*Mar  1 03:45:29.679: BGP(0): 172.16.0.0/22 aggregate has 172.16.2.0/24 more-spe
cific
*Mar  1 03:45:29.683: BGP(0): 172.16.0.0/22 aggregate has 172.16.3.0/24 more-spe
cific
*Mar  1 03:45:29.683: BGP(0): Aggregate 172.16.0.0/22 does not have more-specifi
cs
r2#sh cloc
*03:50:10.435 UTC Mon Mar 1 1993
r2#
wtf??有更详细的路由。。
看看as-path呢?
也不行。。
r4#sh ip bgp
BGP table version is 31, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.16.2.0/24    10.0.0.2                               0 1 2 i
*> 172.16.3.0/24    10.0.0.2                               0 1 2 i
为啥没成功呢?。。郁闷了。
看看attirbute-map和它的区别。
r2(config-router)#aggregate-address 172.16.0.0 255.255.252.0 as-set a
r2(config-router)#aggregate-address 172.16.0.0 255.255.252.0 as-set att
r2(config-router)#$ddress 172.16.0.0 255.255.252.0 as-set attribute-map ?
  WORD  Route map for parameter control

r2(config-router)#$ddress 172.16.0.0 255.255.252.0 as-set attribute-map att
r2(config-router)#exi
r2(config)#
*Mar  1 04:06:27.406: BGP(0): Aggregate processing for IPv4 Unicast
*Mar  1 04:06:27.410: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 04:06:27.410: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 04:06:27.418: BGP(0): sub-prefix : 172.16.0.0/24
*Mar  1 04:06:27.418: BGP(0): Needs to be re-aggregated
*Mar  1 04:06:27.422: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 04:06:27.426: BGP(0): 172.16.0.0/22 aggregate has 172.16.0.0/24 more-spe
cific
*Mar  1 04:06:27.430: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 04:06:27.438: BGP(0): 172.16.0.0/22 aggregate created, attributes update
d
r2(config)#
继续研究ing。这本书很老,ios用的是10.0的。会不会与这个有关。。我想该不会吧。理论上。。
然后我去掉了as-set这个,就:
r2#sh ip bgp
BGP table version is 10, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.0.0/22    0.0.0.0                 50         32768 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
居然。。
r3#sh ip bgp
BGP table version is 58, local router ID is 133.1.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
*> 172.16.0.0/24    133.1.23.2                             0 1 4 i
*> 172.16.0.0/22    133.1.23.2              50             0 1 i
*> 172.16.1.0/24    133.1.23.2                             0 1 4 i
*> 172.16.2.0/24    0.0.0.0                  0         32768 i
*> 172.16.3.0/24    0.0.0.0                  0         32768 i
r3#
回过头,改过来,看看刚才的advertise-map...似乎还不行。。

r2#sh ip bgp
BGP table version is 11, local router ID is 133.1.2.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
*> 172.16.0.0/24    10.0.0.4                 0             0 4 i
*> 172.16.1.0/24    10.0.0.4                 0             0 4 i
*> 172.16.2.0/24    133.1.23.3               0             0 2 i
*> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
昏倒。

-----------
summary-only。
这回,这4个网段全从r3公布。发现一个奇怪的现象。
我sh ip pro
看见:
Routing Protocol is "bgp 2"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  IGP synchronization is disabled
  Automatic route summarization is disabled
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    133.1.23.2
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    34.112.3.42          200      04:18:48
    133.1.23.2            20      00:20:25
  Distance: external 20 internal 200 local 200

这个34.的gateway是哪来的?
router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 172.16.0.0 mask 255.255.255.0
 network 172.16.1.0 mask 255.255.255.0
 network 172.16.2.0 mask 255.255.255.0
 network 172.16.3.0 mask 255.255.255.0
 neighbor 133.1.23.2 remote-as 1
 neighbor 133.1.23.2 ebgp-multihop 255
 no auto-summary
难道这就是传说中的cisco后门?.. ...又瞧了一眼r2。
Routing Protocol is "bgp 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  IGP synchronization is disabled
  Automatic route summarization is disabled
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    10.0.0.4
    133.1.23.3
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    10.0.0.4              20      00:53:37
    91.30.0.0            200      03:19:07
    32.104.3.42          200      00:23:34
    133.1.23.3            20      00:03:37
  Distance: external 20 internal 200 local 200

r2#
请注意中间这两条跳目。再看看我的config。对比一下。
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 10.0.0.4 remote-as 4
 neighbor 10.0.0.4 ebgp-multihop 255
 neighbor 133.1.23.3 remote-as 2
 neighbor 133.1.23.3 ebgp-multihop 255
 no auto-summary
。。。
不管它了。做朕的实验。
router bgp 1
aggregate-address 172.16.0.0 255.255.252.0 summary-only
r2#
r2#sh ip bgp
BGP table version is 10, local router ID is 133.1.2.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
s> 172.16.0.0/24    133.1.23.3               0             0 2 i
*> 172.16.0.0/22    0.0.0.0                 50         32768 i
s> 172.16.1.0/24    133.1.23.3               0             0 2 i
s> 172.16.2.0/24    133.1.23.3               0             0 2 i
s> 172.16.3.0/24    133.1.23.3               0             0 2 i
r2#
明细的条目被抑制。
r4上只有聚合的22位。
r4#sh ip bgp
BGP table version is 44, local router ID is 133.1.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
*> 172.16.0.0/22    10.0.0.2                 0             0 1 i
r4#

r3上却。。

r3#sh ip bgp
BGP table version is 66, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.0.0/22    133.1.23.2               0             0 1 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.16.2.0/24    0.0.0.0                  0         32768 i
*> 172.16.3.0/24    0.0.0.0                  0         32768 i
r3#
这不太好吧。个人认为。。
r2想r3也发
r2#sh ip bgp nei 133.1.23.3 advertised-routes
BGP table version is 10, local router ID is 133.1.2.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
*> 172.16.0.0/22    0.0.0.0                 50         32768 i
r2#
在各路由器上仔细看。
r4#sh ip bgp 172.16.0.0/22
BGP routing table entry for 172.16.0.0/22, version 44
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  1, (aggregated by 1 133.1.2.2)
    10.0.0.2 from 10.0.0.2 (133.1.2.2)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, be
st
r4#
r3#sh ip bgp 172.16.0.0/22
BGP routing table entry for 172.16.0.0/22, version 66
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  1, (aggregated by 1 133.1.2.2)
    133.1.23.2 from 133.1.23.2 (133.1.2.2)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, be
st
r3#

r2#
r2#sh ip bgp 172.16.0.0/22
BGP routing table entry for 172.16.0.0/22, version 6
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.4 133.1.23.3
  Local, (aggregated by 1 133.1.2.2)
    0.0.0.0 from 0.0.0.0 (133.1.2.2)
      Origin IGP, metric 50, localpref 100, weight 32768, valid, aggregated, loc
al, atomic-aggregate, best
r2#
--
这回改在r3上做聚合。just look.
r3#sh ip bgp 172.16.3.0/24
BGP routing table entry for 172.16.3.0/24, version 74
Paths: (1 available, best #1, table Default-IP-Routing-Table, Advertisements sup
pressed by an aggregate.)
  Not advertised to any peer
  Local
    0.0.0.0 from 0.0.0.0 (133.1.3.3)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local,
best
r3#

-----------------
suppress-map
r3:
router bgp 2
aggregate-address 172.16.0.0 255.255.252.0 suppress-map supp

r3#sh ro
route-map supp, permit, sequence 10
  Match clauses:
    ip address (access-lists): 1
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
r3#
r3#sh access-li 1
Standard IP access list 1
    10 permit 172.16.1.0 (1 match)
    20 permit 172.16.3.0 (1 match)
r3#


r3#sh log | in 172.16.0.0/22
*Mar  1 05:01:08.050: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 05:01:08.050: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 05:01:08.062: BGP(0): 172.16.0.0/22 aggregate is removed
*Mar  1 05:01:08.062: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 05:01:08.070: BGP(0): Found sub-prefix 172.16.0.0/22:
*Mar  1 05:02:39.110: BGP(0): For aggregate 172.16.0.0/22
*Mar  1 05:02:39.110: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 05:02:39.122: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 05:02:39.126: BGP(0): 172.16.0.0/22 aggregate has 172.16.0.0/24 more-spe
cific
*Mar  1 05:02:39.130: BGP(0): 172.16.0.0/22 aggregate created, attributes update
d
*Mar  1 05:02:39.134: BGP(0): 172.16.0.0/22 subtree has an entry 172.16.0.0/24
*Mar  1 05:02:39.142: BGP(0): Found sub-prefix 172.16.0.0/22:

r3#sh ip bgp
BGP table version is 82, local router ID is 133.1.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
*> 172.16.0.0/24    0.0.0.0                  0         32768 i
*> 172.16.0.0/22    0.0.0.0                            32768 i
s> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.16.2.0/24    0.0.0.0                  0         32768 i
s> 172.16.3.0/24    0.0.0.0                  0         32768 i
r3#

posted on 2005-05-30 16:45  cunshen  阅读(667)  评论(0编辑  收藏  举报