miércoles, 22 de junio de 2011

Configuracion de BGP con as-path prepend

Este caso es muy comun en ISP y sirve como una guia practica para orientar a los ingenieros de redes IP en el anuncio de sus rangos en la red de Internet.

En este laboratorio veremos la aplicacion de as-path prepend para darle mayor prioridad a un grupo de rangos de IP por R1 y otros rangos de IP por R2.

De este maneraconoceremos la aplicacion del atributo as-path, local-preference en BGP.

Configuración Router R1
!
! Last configuration change at 00:17:40 UTC Wed Jan 12 2011
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip source-route
!
!
!
!
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.0.0.2 255.255.255.255
 ip ospf authentication-key 123456
 ip ospf 1 area 0
!
interface Loopback1
 ip address 190.110.2.1 255.255.255.255
!
interface Loopback2
 ip address 190.110.4.1 255.255.255.255
!
interface Loopback3
 ip address 190.110.6.1 255.255.255.255
!
interface Loopback4
 ip address 190.110.8.1 255.255.255.255
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 description To R3
 ip address 204.20.20.2 255.255.255.252
 ip ospf 1 area 0
 media-type gbic
 speed 1000
 duplex full
 negotiation auto
!
interface GigabitEthernet1/0
 description To R7
 ip address 172.17.1.6 255.255.255.252
 ip ospf authentication-key 123456
 ip ospf 1 area 0
 negotiation auto
!
interface GigabitEthernet2/0
 description To R2
 ip address 172.17.1.1 255.255.255.252
 ip ospf authentication-key 123456
 ip ospf 1 area 0
 negotiation auto
!
interface GigabitEthernet3/0
 no ip address
 shutdown
 negotiation auto
!
router ospf 1
 router-id 10.0.0.2
 log-adjacency-changes
 area 0 authentication
 passive-interface GigabitEthernet0/0
!
router bgp 23520
 bgp router-id 204.20.20.2
 bgp log-neighbor-changes
 neighbor 10.0.0.1 remote-as 23520
 neighbor 10.0.0.1 description To RR_R7
 neighbor 10.0.0.1 password 123456
 neighbor 10.0.0.1 version 4
 neighbor 204.20.20.1 remote-as 3549
 neighbor 204.20.20.1 description To_Global_Crossing
 !
 address-family ipv4
  no synchronization
  network 190.110.2.1 mask 255.255.255.255
  network 190.110.4.1 mask 255.255.255.255
  network 190.110.6.1 mask 255.255.255.255
  network 190.110.8.1 mask 255.255.255.255
  aggregate-address 190.110.7.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.5.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.3.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.1.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.0.0 255.255.224.0 as-set
  neighbor 10.0.0.1 activate
  neighbor 204.20.20.1 activate
  neighbor 204.20.20.1 send-community
  neighbor 204.20.20.1 soft-reconfiguration inbound
  neighbor 204.20.20.1 route-map internet out
  no auto-summary
 exit-address-family
!
!
ip bgp-community new-format
!
no ip http server
no ip http secure-server
!
!
ip prefix-list external seq 1 permit 190.110.1.0/24
ip prefix-list external seq 2 permit 190.110.3.0/24
ip prefix-list external seq 3 permit 190.110.5.0/24
ip prefix-list external seq 4 permit 190.110.7.0/24
!
ip prefix-list internet seq 10 permit 190.110.0.0/19
!
ip prefix-list internet2 seq 1 permit 190.110.2.0/24
ip prefix-list internet2 seq 2 permit 190.110.4.0/24
ip prefix-list internet2 seq 3 permit 190.110.6.0/24
ip prefix-list internet2 seq 4 permit 190.110.8.0/24
!
route-map internet permit 10
 match ip address prefix-list external
 set as-path prepend 23520
 set community 3549:23520
!
route-map internet permit 20
 match ip address prefix-list internet2 internet
!
route-map local-pref permit 10
 set local-preference 110
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
 login
!
end
Configuración Router R2

!
! Last configuration change at 23:49:01 UTC Tue Jan 11 2011
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip source-route
!
!
!
!
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.0.0.3 255.255.255.255
 ip ospf authentication-key 123456
 ip ospf 1 area 0
!
interface Loopback1
 ip address 190.110.1.1 255.255.255.255
!
interface Loopback2
 ip address 190.110.3.1 255.255.255.255
!
interface Loopback3
 ip address 190.110.5.1 255.255.255.255
!
interface Loopback4
 ip address 190.110.7.1 255.255.255.255
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 description To R4
 ip address 198.20.20.2 255.255.255.252
 ip ospf 1 area 0
 media-type gbic
 speed 1000
 duplex full
 negotiation auto
!
interface GigabitEthernet1/0
 description To R7
 ip address 172.17.1.10 255.255.255.252
 ip ospf authentication-key 123456
 ip ospf 1 area 0
 negotiation auto
!
interface GigabitEthernet2/0
 description To R1
 ip address 172.17.1.2 255.255.255.252
 ip ospf authentication-key 123456
 ip ospf 1 area 0
 negotiation auto
!
router ospf 1
 router-id 10.0.0.3
 log-adjacency-changes
 area 0 authentication
 passive-interface GigabitEthernet0/0
!
router bgp 23520
 bgp router-id 198.20.20.2
 bgp log-neighbor-changes
 neighbor 10.0.0.1 remote-as 23520
 neighbor 10.0.0.1 description To RR_R7
 neighbor 10.0.0.1 password 123456
 neighbor 10.0.0.1 update-source Loopback0
 neighbor 10.0.0.1 version 4
 neighbor 198.20.20.1 remote-as 1239
 neighbor 198.20.20.1 description To_Sprint
 !
 address-family ipv4
  no synchronization
  network 190.110.1.1 mask 255.255.255.255
  network 190.110.3.1 mask 255.255.255.255
  network 190.110.5.1 mask 255.255.255.255
  network 190.110.7.1 mask 255.255.255.255
  aggregate-address 190.110.8.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.7.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.6.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.5.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.4.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.3.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.2.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.1.0 255.255.255.0 as-set summary-only
  aggregate-address 190.110.0.0 255.255.224.0 as-set
  neighbor 10.0.0.1 activate
  neighbor 198.20.20.1 activate
  neighbor 198.20.20.1 send-community
  neighbor 198.20.20.1 soft-reconfiguration inbound
  neighbor 198.20.20.1 route-map internet out
  no auto-summary
 exit-address-family
!
!
ip bgp-community new-format
ip community-list 1 permit 1239:1
ip as-path access-list 1 permit ^1239$
!
no ip http server
no ip http secure-server
!
!
ip prefix-list external seq 1 permit 190.110.2.0/24
ip prefix-list external seq 2 permit 190.110.4.0/24
ip prefix-list external seq 3 permit 190.110.6.0/24
ip prefix-list external seq 4 permit 190.110.8.0/24
!
ip prefix-list internet seq 10 permit 190.110.0.0/19
!
ip prefix-list internet2 seq 1 permit 190.110.1.0/24
ip prefix-list internet2 seq 2 permit 190.110.3.0/24
ip prefix-list internet2 seq 3 permit 190.110.5.0/24
ip prefix-list internet2 seq 4 permit 190.110.7.0/24
!
route-map internet permit 10
 match ip address prefix-list external
 set as-path prepend 23520
 set community 1239:23520
!
route-map internet permit 20
 match ip address prefix-list internet2 internet
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
 login
!
end


Configuración Router R3 


version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip source-route
!
!
!
!
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 description To R6
 ip address 178.20.20.2 255.255.255.252
 media-type gbic
 speed 1000
 duplex full
 negotiation auto
!
interface GigabitEthernet1/0
 description To R1
 ip address 204.20.20.1 255.255.255.252
 negotiation auto
!
interface GigabitEthernet2/0
 no ip address
 shutdown
 negotiation auto
!
router bgp 3549
 bgp router-id 204.20.20.1
 bgp log-neighbor-changes
 neighbor 178.20.20.1 remote-as 2914
 neighbor 178.20.20.1 description To_R65
 neighbor 204.20.20.2 remote-as 23520
 neighbor 204.20.20.2 description To_R1
 !
 address-family ipv4
  no synchronization
  network 156.40.40.0 mask 255.255.255.252
  network 204.20.20.0 mask 255.255.255.252
  aggregate-address 204.20.20.0 255.255.255.0 as-set summary-only
  aggregate-address 156.40.40.0 255.255.255.0 as-set summary-only
  neighbor 178.20.20.1 activate
  neighbor 178.20.20.1 send-community
  neighbor 178.20.20.1 soft-reconfiguration inbound
  neighbor 204.20.20.2 activate
  neighbor 204.20.20.2 send-community
  neighbor 204.20.20.2 soft-reconfiguration inbound
  no auto-summary
 exit-address-family
!
!
!
no ip http server
no ip http secure-server
ip route 156.40.40.0 255.255.255.252 Null0
ip route 204.20.20.0 255.255.255.252 Null0
!
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
 login
!
end
Configuración Router R4
! Last configuration change at 00:26:24 UTC Sat Jan 8 2011
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip source-route
!
!
!
!
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 description To R6
 ip address 178.20.20.6 255.255.255.252
 media-type gbic
 speed 1000
 duplex full
 negotiation auto
!
interface GigabitEthernet1/0
 description To R2
 ip address 198.20.20.1 255.255.255.252
 negotiation auto
!
interface GigabitEthernet2/0
 no ip address
 shutdown
 negotiation auto
!
router bgp 1239
 bgp router-id 178.20.20.6
 bgp log-neighbor-changes
 neighbor 178.20.20.5 remote-as 2914
 neighbor 178.20.20.5 description To_R6
 neighbor 198.20.20.2 remote-as 23520
 neighbor 198.20.20.2 description To_R2
 !
 address-family ipv4
  no synchronization
  network 19.40.40.0 mask 255.255.255.252
  network 198.20.20.0 mask 255.255.255.252
  aggregate-address 198.20.20.0 255.255.255.0 as-set summary-only
  aggregate-address 19.40.40.0 255.255.255.0 as-set summary-only
  neighbor 178.20.20.5 activate
  neighbor 178.20.20.5 send-community
  neighbor 178.20.20.5 soft-reconfiguration inbound
  neighbor 198.20.20.2 activate
  neighbor 198.20.20.2 send-community
  neighbor 198.20.20.2 soft-reconfiguration inbound
  no auto-summary
 exit-address-family
!
!
!
no ip http server
no ip http secure-server
ip route 19.40.40.0 255.255.255.252 Null0
ip route 198.20.20.0 255.255.255.252 Null0
!
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
 login
!
end
Configuración Router R6

!
! Last configuration change at 23:52:33 UTC Tue Jan 11 2011
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R6
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip source-route
!
!
!
!
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 description To R3
 ip address 178.20.20.1 255.255.255.252
 media-type gbic
 speed 1000
 duplex full
 negotiation auto
!
interface GigabitEthernet1/0
 description To R4
 ip address 178.20.20.5 255.255.255.252
 negotiation auto
!
interface GigabitEthernet2/0
 no ip address
 shutdown
 negotiation auto
!
router bgp 2914
 bgp router-id 178.20.20.1
 bgp log-neighbor-changes
 neighbor 178.20.20.2 remote-as 3549
 neighbor 178.20.20.2 description To R3
 neighbor 178.20.20.6 remote-as 1239
 neighbor 178.20.20.6 description To_R4
 !
 address-family ipv4
  no synchronization
  network 144.60.60.0 mask 255.255.255.252
  network 178.20.20.0 mask 255.255.255.252
  network 219.40.40.0 mask 255.255.255.252
  aggregate-address 219.40.40.0 255.255.255.0 as-set summary-only
  aggregate-address 178.20.20.0 255.255.255.0 as-set summary-only
  aggregate-address 144.60.60.0 255.255.255.0 as-set summary-only
  neighbor 178.20.20.2 activate
  neighbor 178.20.20.2 send-community
  neighbor 178.20.20.2 soft-reconfiguration inbound
  neighbor 178.20.20.2 route-map to-r3 out
  neighbor 178.20.20.6 activate
  neighbor 178.20.20.6 send-community
  neighbor 178.20.20.6 soft-reconfiguration inbound
  neighbor 178.20.20.6 route-map as1239 in
  no auto-summary
 exit-address-family
!
!
ip bgp-community new-format
ip community-list 1 permit 1239:1
ip as-path access-list 1 permit ^1239$
ip as-path access-list 1 permit _23520$
!
no ip http server
no ip http secure-server
ip route 144.60.60.0 255.255.255.252 Null0
ip route 178.20.20.0 255.255.255.252 Null0
ip route 219.40.40.0 255.255.255.252 Null0
!
!
route-map as1239 permit 10
 match as-path 1
 set community 1239:1
!
route-map to-r3 permit 10
 match community 1
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
 login
!
end
Configuración Router R7

! Last configuration change at 18:16:51 UTC Sat Jan 8 2011
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R7
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip source-route
!
!
!
!
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.0.0.1 255.255.255.255
 ip ospf authentication-key 123456
 ip ospf 1 area 0
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 description Tp R1
 ip address 172.17.1.5 255.255.255.252
 ip ospf authentication-key 123456
 ip ospf 1 area 0
 media-type gbic
 speed 1000
 duplex full
 negotiation auto
!
interface GigabitEthernet1/0
 description To R2
 ip address 172.17.1.9 255.255.255.252
 ip ospf authentication-key 123456
 ip ospf 1 area 0
 negotiation auto
!
interface GigabitEthernet2/0
 no ip address
 shutdown
 negotiation auto
!
router ospf 1
 router-id 10.0.0.1
 log-adjacency-changes
 area 0 authentication
!
router bgp 23520
 bgp router-id 10.0.0.1
 bgp cluster-id 400
 bgp log-neighbor-changes
 neighbor RR peer-group
 neighbor RR remote-as 23520
 neighbor RR password 123456
 neighbor RR update-source Loopback0
 neighbor RR version 4
 neighbor 10.0.0.2 peer-group RR
 neighbor 10.0.0.2 description To_R1
 neighbor 10.0.0.3 peer-group RR
 neighbor 10.0.0.3 description To_R2
 !
 address-family ipv4
  no synchronization
  neighbor RR route-reflector-client
  neighbor 10.0.0.2 activate
  neighbor 10.0.0.3 activate
  no auto-summary
 exit-address-family
!
!
!
no ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
 stopbits 1
line vty 0 4
 login
!
end




0 comentarios:

Publicar un comentario

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites