Saturday, October 8, 2011

LAB: BGP - BGP Conditional Advertisement

- Configure R3 in such a way that AS 300 uses AS 100 to get to all prefixes learned from AS 254.
- If the link between R1 and R3 goes down traffic from AS 300 to AS 254 should be rerouted directly to AS 200.



The syntax for conditional advertisement is as follows:

neighbor <IP> advertise-map MAP1 {non-exist|exist-map} MAP2

The configuration involves defining two route-maps. One route-map (MAP1) selects the prefixes to be advertised to the peer. These prefixes must already exist in the local BGP table. The other route-map (MAP2) selects the prefixes to be tracked in the local BGP table. If this is a “non-exist” map, than condition is triggered when no prefixes in the BGP table match the route-map. If this is an
“exist” map, then condition is triggered when there is a prefix in the BGP table matching the route-map. BGP process performs condition verification every time BGP scanner runs (60 seconds by default) so it may take some time after your configuration change before the conditional advertisement occurs.

configuration:

R3:
ip as-path access-list 1 permit 254$
!
route-map ADVERTISE_MAP permit 10
match as-path 1
!
ip prefix-list LINK_R1_R3 permit 155.1.13.0/24
!
route-map NON_EXIST_MAP permit 10
match ip address prefix-list LINK_R1_R3
!
router bgp 200
network 155.1.13.0 mask 255.255.255.0
neighbor 155.1.37.7 advertise-map ADVERTISE_MAP non-exist-map NON_EXIST_MAP

verification:

normal condition:

Rack1R3#show ip bgp regexp 254$
BGP table version is 94, local router ID is 150.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
* i205.90.31.0      192.10.1.254             0    100      0 254 ?
*>i                 192.10.1.254             0    100      0 254 ?
* i220.20.3.0       192.10.1.254             0    100      0 254 ?
*>i                 192.10.1.254             0    100      0 254 ?
* i222.22.2.0       192.10.1.254             0    100      0 254 ?
*>i                 192.10.1.254             0    100      0 254 ?

Rack1R3#show ip bgp neighbors 155.1.37.7 advertised-routes
BGP table version is 94, local router ID is 150.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
*>i10.0.0.0/24      155.1.23.2               0    100      0 i
*>i10.0.0.0/22      155.1.0.5                0    100      0 i
*>i10.0.1.0/24      155.1.23.2               0    100      0 i
*>i10.0.2.0/24      155.1.23.2               0    100      0 i
*>i10.0.3.0/24      155.1.23.2               0    100      0 i
*> 28.119.16.0/24   155.1.13.1                             0 100 54 i
*> 28.119.17.0/24   155.1.13.1                             0 100 54 i
*> 112.0.0.0        155.1.13.1                             0 100 54 50 60 i
*> 113.0.0.0        155.1.13.1                             0 100 54 50 60 i
*> 114.0.0.0        155.1.13.1                             0 100 54 i
*> 115.0.0.0        155.1.13.1                             0 100 54 i
*> 116.0.0.0        155.1.13.1                             0 100 54 i
*> 117.0.0.0        155.1.13.1                             0 100 54 i
*> 118.0.0.0        155.1.13.1                             0 100 54 i
*> 119.0.0.0        155.1.13.1                             0 100 54 i
*> 155.1.0.0        155.1.13.1                             0 100 i
*> 155.1.13.0/24    0.0.0.0                  0         32768 i
*>i222.22.0.0       155.1.23.2               0    100      0 i
*>i222.22.1.0       155.1.23.2               0    100      0 i

Rack1R3#show ip bgp neighbors 155.1.37.7                 
BGP neighbor is 155.1.37.7,  remote AS 300, external link
  BGP version 4, remote router ID 150.1.77.77
  BGP state = Established, up for 02:12:44
  Last read 00:00:15, last write 00:00:44, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
  Message statistics:
    InQ depth is 0
    OutQ depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:               52         31
    Keepalives:           134        128
    Route Refresh:          0          1
    Total:                187        161
  Default minimum time between advertisement runs is 30 seconds

 For address family: IPv4 Unicast
  BGP table version 94, neighbor version 94/0
 Output queue size : 0
  Index 4, Offset 0, Mask 0x10
  4 update-group member
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor
  Condition-map NON_EXIST_MAP, Advertise-map ADVERTISE_MAP, status: Withdraw
                                 Sent       Rcvd
  Prefix activity:               ----       ----
    Prefixes Current:              19         12 (Consumes 624 bytes)
    Prefixes Total:                19         36
    Implicit Withdraw:             19         12
    Explicit Withdraw:              3         12
    Used as bestpath:             n/a          1
    Used as multipath:            n/a          0

                                   Outbound    Inbound
  Local Policy Denied Prefixes:    --------    -------
    Suppressed duplicate:                 0         12
    AS_PATH loop:                       n/a         42
    advertise-map:                        6        n/a
    Well-known Community:                 3        n/a
    Bestpath from this peer:              4        n/a
    Total:                               13         54
  Number of NLRIs in the update sent: max 8, min 0
         
  Connections established 1; dropped 0
  Last reset never
Connection state is ESTAB, I/O status: 1, unread input bytes: 0           
Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 1
Local host: 155.1.37.3, Local port: 179
Foreign host: 155.1.37.7, Foreign port: 45858

Enqueued packets for retransmit: 0, input: 0  mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x79FF68):
Timer          Starts    Wakeups            Next
Retrans           151          0             0x0
TimeWait            0          0             0x0
AckHold           142        136             0x0
SendWnd             0          0             0x0
KeepAlive           0          0             0x0
GiveUp              0          0             0x0
PmtuAger            0          0             0x0
DeadWait            0          0             0x0

iss:  189714911  snduna:  189720443  sndnxt:  189720443     sndwnd:  15320
irs:  437617711  rcvnxt:  437621950  rcvwnd:      15280  delrcvwnd:   1104

SRTT: 300 ms, RTTO: 303 ms, RTV: 3 ms, KRTT: 0 ms
minRTT: 4 ms, maxRTT: 300 ms, ACK hold: 200 ms
Flags: passive open, nagle, gen tcbs
IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):
Rcvd: 287 (out of order: 0), with data: 143, total data bytes: 4238
Sent: 291 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 152, total data bytes: 5550


after shutting down the link between R1 and R3:


Rack1R3#show ip bgp neighbors 155.1.37.7 advertised-routes
BGP table version is 111, local router ID is 150.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
*>i10.0.0.0/24      155.1.23.2               0    100      0 i
*>i10.0.0.0/22      155.1.0.5                0    100      0 i
*>i10.0.1.0/24      155.1.23.2               0    100      0 i
*>i10.0.2.0/24      155.1.23.2               0    100      0 i
*>i10.0.3.0/24      155.1.23.2               0    100      0 i
*>i28.119.16.0/24   155.1.45.4               0    100      0 100 54 i
*>i28.119.17.0/24   155.1.45.4               0    100      0 100 54 i
*>i112.0.0.0        155.1.45.4               0    100      0 100 54 50 60 i
*>i113.0.0.0        155.1.45.4               0    100      0 100 54 50 60 i
*>i114.0.0.0        155.1.45.4               0    100      0 100 54 i
*>i115.0.0.0        155.1.45.4               0    100      0 100 54 i
*>i116.0.0.0        155.1.45.4               0    100      0 100 54 i
*>i117.0.0.0        155.1.45.4               0    100      0 100 54 i
*>i118.0.0.0        155.1.45.4               0    100      0 100 54 i
*>i119.0.0.0        155.1.45.4               0    100      0 100 54 i
*>i155.1.0.0        155.1.45.4               0    100      0 100 i
*>i205.90.31.0      192.10.1.254             0    100      0 254 ?
*>i220.20.3.0       192.10.1.254             0    100      0 254 ?
*>i222.22.0.0       155.1.23.2               0    100      0 i
*>i222.22.1.0       155.1.23.2               0    100      0 i
*>i222.22.2.0       192.10.1.254             0    100      0 254 ?

Rack1R3#show ip bgp neighbors 155.1.37.7                 
BGP neighbor is 155.1.37.7,  remote AS 300, external link
  BGP version 4, remote router ID 150.1.77.77
  BGP state = Established, up for 02:16:12
  Last read 00:00:42, last write 00:00:12, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
  Message statistics:
    InQ depth is 0
    OutQ depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:               58         31
    Keepalives:           138        131
    Route Refresh:          0          1
    Total:                197        164
  Default minimum time between advertisement runs is 30 seconds

 For address family: IPv4 Unicast
  BGP table version 111, neighbor version 108/0
 Output queue size : 0
  Index 4, Offset 0, Mask 0x10
  4 update-group member
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor
  Condition-map NON_EXIST_MAP, Advertise-map ADVERTISE_MAP, status: Advertise
                                 Sent       Rcvd
  Prefix activity:               ----       ----
    Prefixes Current:              18         12 (Consumes 624 bytes)
    Prefixes Total:                31         36
    Implicit Withdraw:             30         12
    Explicit Withdraw:              5         12
    Used as bestpath:             n/a          1
    Used as multipath:            n/a          0

                                   Outbound    Inbound
  Local Policy Denied Prefixes:    --------    -------
    Suppressed duplicate:                 0         12
    AS_PATH loop:                       n/a         42
    advertise-map:                        6        n/a
    Well-known Community:                 3        n/a
    Bestpath from this peer:              4        n/a
    Total:                               13         54
  Number of NLRIs in the update sent: max 8, min 0
         
  Connections established 1; dropped 0
  Last reset never
Connection state is ESTAB, I/O status: 1, unread input bytes: 0           
Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 1
Local host: 155.1.37.3, Local port: 179
Foreign host: 155.1.37.7, Foreign port: 45858

Enqueued packets for retransmit: 0, input: 0  mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x7D288C):
Timer          Starts    Wakeups            Next
Retrans           159          0             0x0
TimeWait            0          0             0x0
AckHold           146        140             0x0
SendWnd             0          0             0x0
KeepAlive           0          0             0x0
GiveUp              0          0             0x0
PmtuAger            0          0             0x0
DeadWait            0          0             0x0

iss:  189714911  snduna:  189720871  sndnxt:  189720871     sndwnd:  16384
irs:  437617711  rcvnxt:  437622042  rcvwnd:      15188  delrcvwnd:   1196

SRTT: 300 ms, RTTO: 303 ms, RTV: 3 ms, KRTT: 0 ms
minRTT: 4 ms, maxRTT: 300 ms, ACK hold: 200 ms
Flags: passive open, nagle, gen tcbs
IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):
Rcvd: 298 (out of order: 0), with data: 147, total data bytes: 4330
Sent: 302 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 159, total data bytes: 5959

No comments:

Post a Comment