Saturday, June 4, 2011

Can you run two AS Numbers in Single Router ? - Local AS

according to my experience we can't but similar functionalities given by Local AS option . It enables to act one AS for some of the neighbors and another AS for other neighbors

R2 connects to R1 using remote as 100 , but the R1 using remote-as as 2 rather than 300
R2#
router bgp 300
 no synchronization
 bgp log-neighbor-changes
 network 200.200.200.0
 neighbor 192.168.100.1 remote-as 100
 neighbor 192.168.100.1 local-as 2
R1#router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 192.168.100.2 remote-as 2
 no auto-summary
but when the route injected it shows originated AS as 300
R1#show ip bgp 
BGP table version is 2, local router ID is 192.168.100.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
*> 200.200.200.0    192.168.100.2            0             0 2 300 i

with no-prepend we can remove the local as prepending .
R2#show ip bgp 
BGP table version is 3, local router ID is 192.168.100.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
*> 100.100.100.0/24 192.168.100.1            0             0 100 i
*> 200.200.200.0    0.0.0.0                  0         32768 i
 
R2#router bgp 300
 no synchronization
 bgp log-neighbor-changes
 network 200.200.200.0
 neighbor 192.168.100.1 remote-as 100
 neighbor 192.168.100.1 local-as 2 no-prepend
 no auto-summary

prefix Deaggregation and inject map - BGP Design & Implementation Chap 4

this lab is directly taken from BGP Design & Implementation Chap 4. GNS3 configurations attached below.
Summary -
In the boarder router if the summary route injected as follows
aggregate-address 172.16.0.0 255.255.0.0 as-set summary-only
downwards the originality of the prefix may be lost therefore to specify the best exist path we can regenerate the path we use inject path .
bgp inject-map Map1 exist-map Map2
Map1 injects the path
Map2 checks whether path is available , it at least two match statements one is route-source & aggregate prefix. Whether u can inject weird prefix other than aggregate .. (eg aggregate is 172.16.0.0/16 but if you try to inject 10.0.0.0/24 ???) As usual you can't :)

following is the attached diagram

R5 Relevant configuration.
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 bgp inject-map AS200-Specific exist-map AS200-aggregate
 neighbor 192.168.12.2 remote-as 100
 neighbor 192.168.12.2 send-community
 neighbor 192.168.23.2 remote-as 100
 neighbor 192.168.23.2 send-community
 neighbor 192.168.24.1 remote-as 200
 neighbor 192.168.24.1 send-community
 no auto-summary
!
ip forward-protocol nd
!
ip bgp-community new-format
!
ip http server
no ip http secure-server
!
!
ip prefix-list AS200-R3 seq 5 permit 192.168.24.1/32
!
ip prefix-list Aggregate seq 5 permit 172.16.0.0/16
!
ip prefix-list Specific seq 5 permit 172.16.1.0/24

no cdp run
!
!
!
route-map AS200-Specific permit 10
 set ip address prefix-list Specific
 set community 100:200 no-export
!
route-map AS200-aggregate permit 10
 match ip address prefix-list Aggregate
 match ip route-source AS200-R3
!

R7#show ip bgp
BGP table version is 4, local router ID is 192.168.13.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
*>i172.16.0.0       192.168.24.1             0    100      0 200 300 i
* i                 192.168.35.1             0    100      0 200 400 i
*>i172.16.1.0/24    192.168.24.1             0    100      0 ?
*>i172.16.2.0/24    192.168.35.1             0    100      0 ?

show ip route OSPF sync in the AS100

R7#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

C    192.168.12.0/24 is directly connected, FastEthernet0/1
C    192.168.13.0/24 is directly connected, FastEthernet0/0
O E2 192.168.24.0/24 [110/20] via 192.168.12.1, 00:00:56, FastEthernet0/1
     172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
B       172.16.0.0/16 [200/0] via 192.168.24.1, 00:00:51
B       172.16.1.0/24 [200/0] via 192.168.24.1, 00:00:51
B       172.16.2.0/24 [200/0] via 192.168.35.1, 00:00:23
O    192.168.23.0/24 [110/20] via 192.168.13.2, 01:21:56, FastEthernet0/0
                     [110/20] via 192.168.12.1, 01:21:23, FastEthernet0/1
O E2 192.168.35.0/24 [110/20] via 192.168.13.2, 00:00:46, FastEthernet0/0

when the BGP peer goes down between R3 & R5
*Mar  1 01:25:37.511: %BGP-5-ADJCHANGE: neighbor 192.168.24.1 Down BGP Notification sent
*Mar  1 01:25:37.511: %BGP-3-NOTIFICATION: sent to neighbor 192.168.24.1 4/0 (hold time expired) 0 bytes 
*Mar  1 01:25:38.511: BGP(0): no valid path for 172.16.0.0/16
*Mar  1 01:25:38.511: BGP(0): no valid path for 172.16.1.0/24
*Mar  1 01:25:38.515: BGP(0): nettable_walker 172.16.0.0/16 no best path
*Mar  1 01:25:38.515: BGP(0): nettable_walker 172.16.1.0/24 no best path
*Mar  1 01:25:38.519: BGP(0): 192.168.12.2 send unreachable 172.16.1.0/24
*Mar  1 01:25:38.519: BGP(0): 192.168.12.2 send UPDATE 172.16.1.0/24 -- unreachable
*Mar  1 01:25:38.519: BGP(0): 192.168.12.2 send UPDATE 172.16.0.0/16 -- unreachable
*Mar  1 01:25:38.623: BGP(0): updgrp 3 - 192.168.12.2 updates replicated for neighbors: 192.168.23.2
*Mar  1 01:25:47.283: BGP(0): updating injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:25:47.283: BGP(0): retaining injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16


when the BGP peer up
*Mar  1 01:27:06.899: %BGP-5-ADJCHANGE: neighbor 192.168.24.1 Up 
*Mar  1 01:27:06.947: BGP(0): 192.168.24.1 rcvd UPDATE w/ attr: nexthop 192.168.24.1, origin i, metric 0, aggregated by 200 192.168.46.2, path 200 300
*Mar  1 01:27:06.951: BGP(0): 192.168.24.1 rcvd 172.16.0.0/16
*Mar  1 01:27:06.955: BGP(0): Revise route installing 1 of 1 routes for 172.16.0.0/16 -> 192.168.24.1(main) to main IP table
*Mar  1 01:27:06.959: BGP(0): 192.168.12.2 NEXT_HOP is on same subnet as the bgp peer and set to 192.168.24.1 for net 172.16.0.0/16
*Mar  1 01:27:06.959: BGP(0): 192.168.12.2 send UPDATE (format) 172.16.0.0/16, next 192.168.24.1, metric 0, path 200 300
*Mar  1 01:27:06.963: BGP(0): updgrp 3 - 192.168.12.2 updates replicated for neighbors: 192.168.23.2
*Mar  1 01:27:47.331: BGP(0): creating injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:27:47.331: BGP(0): updating injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:27:47.335: BGP(0): retaining injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:27:47.335: BGP(0): retaining injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:27:48.063: BGP(0): Revise route installing 1 of 1 routes for 172.16.1.0/24 -> 192.168.24.1(main) to main IP table
*Mar  1 01:27:48.063: BGP(0): 192.168.12.2 NEXT_HOP is on same subnet as the bgp peer and set to 192.168.24.1 for net 172.16.1.0/24
*Mar  1 01:27:48.063: BGP(0): 192.168.12.2 send UPDATE (format) 172.16.1.0/24, next 192.168.24.1, metric 0, path Local
*Mar  1 01:27:48.163: BGP(0): updgrp 3 - 192.168.12.2 updates replicated for neighbors: 192.168.23.2
*Mar  1 01:28:47.355: BGP(0): updating injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:28:47.359: BGP(0): updating injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:28:47.359: BGP(0): retaining injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16
*Mar  1 01:28:47.359: BGP(0): retaining injected prefix 172.16.1.0/24, from source prefix 172.16.0.0/16

GNS3 Configurations