Setup BGP
- Configurar sesiones iBGP y eBGP como muestra la figura. Utilice en iBGP las loopbacks0 para formar sesión en cada AS. Para NLRI dentro de cada AS con sesiones iBGP utilice OSPF.
- R2 debe ser Route-Reflector para R1 y R2, además utilice peer-group.
R1
interface FastEthernet0/0
ip ospf network
point-to-point
ip ospf 1 area
0
interface Loopback0
ip ospf 1 area
0
R2
interface FastEthernet0/0
ip ospf network
point-to-point
ip ospf 1 area
0
interface FastEthernet0/1
ip ospf network
point-to-point
ip ospf 1 area
0
interface Loopback0
ip ospf 1 area
0
R3
interface FastEthernet0/1
ip ospf network
point-to-point
ip ospf 1 area
0
interface Loopback0
ip ospf 1 area
0
R2#show ip ospf neighbor
Neighbor
ID Pri State Dead Time Address Interface
10.3.3.3 0
FULL/ - 00:00:37 10.1.23.3 FastEthernet0/1
10.1.1.1 0
FULL/ - 00:00:37 10.1.12.1 FastEthernet0/0
R1
router bgp 10
no
synchronization
bgp router-id
10.1.1.1
bgp
log-neighbor-changes
neighbor
10.2.2.2 remote-as 10
neighbor
10.2.2.2 update-source Loopback0
neighbor
172.16.14.4 remote-as 20
no auto-summary
R2
router bgp 10
no
synchronization
bgp router-id
10.2.2.2
bgp
log-neighbor-changes
neighbor AS10
peer-group
neighbor AS10
remote-as 10
neighbor AS10
update-source Loopback0
neighbor AS10
route-reflector-client
neighbor
10.1.1.1 peer-group AS10
neighbor
10.3.3.3 peer-group AS10
no auto-summary
R3
router bgp 10
no
synchronization
bgp router-id
10.3.3.3
bgp
log-neighbor-changes
neighbor
10.2.2.2 remote-as 10
neighbor
10.2.2.2 update-source Loopback0
neighbor
172.16.34.4 remote-as 20
neighbor
172.16.36.6 remote-as 30
no auto-summary
R4
interface FastEthernet0/0
ip ospf network
point-to-point
ip ospf 1 area
0
interface Loopback0
ip ospf 1 area
0
R5
interface FastEthernet0/0
ip ospf network
point-to-point
ip ospf 1 area
0
interface Loopback0
ip ospf 1 area
0
R4#sh ip route ospf
20.0.0.0/8 is variably subnetted, 3
subnets, 2 masks
O 20.5.5.5/32 [110/2] via 20.1.45.5,
00:00:00, FastEthernet0/0
R4#ping 20.5.5.5 source
loopback 0
Type
escape sequence to abort.
Sending
5, 100-byte ICMP Echos to 20.5.5.5, timeout is 2 seconds:
Packet
sent with a source address of 20.4.4.4
!!!!!
Success
rate is 100 percent (5/5), round-trip min/avg/max = 28/36/64 ms
R4
router bgp 20
no
synchronization
bgp router-id
20.4.4.4
bgp
log-neighbor-changes
network
20.4.4.4 mask 255.255.255.255
neighbor
20.5.5.5 remote-as 20
neighbor
20.5.5.5 update-source Loopback0
neighbor
172.16.14.1 remote-as 10
neighbor
172.16.34.3 remote-as 10
neighbor
172.16.46.6 remote-as 30
no auto-summary
R5
router bgp 20
no
synchronization
bgp router-id
20.5.5.5
bgp
log-neighbor-changes
neighbor
20.4.4.4 remote-as 20
neighbor
20.4.4.4 update-source Loopback0
neighbor
172.16.56.6 remote-as 30
no auto-summary
R6
router bgp 30
no
synchronization
bgp router-id
30.6.6.6
bgp
log-neighbor-changes
neighbor
172.16.36.3 remote-as 10
neighbor
172.16.46.4 remote-as 20
neighbor
172.16.56.5 remote-as 20
neighbor
192.168.1.7 remote-as 65400
no auto-summary
R7
router bgp 65400
no
synchronization
bgp router-id
100.7.7.7
bgp
log-neighbor-changes
neighbor
192.168.1.6 remote-as 30
no auto-summary
R2#show ip bgp summary
BGP
router identifier 10.2.2.2, local AS number 10
BGP
table version is 1, main routing table version 1
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.1.1 4
10 31 31
1 0 0 00:25:59 0
10.3.3.3 4
10 28 28
1 0 0 00:25:13 0
R6#show ip bgp summary
BGP
router identifier 30.6.6.6, local AS number 30
BGP
table version is 1, main routing table version 1
Neighbor V
AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
172.16.36.3 4
10 9 9
1 0 0 00:06:51 0
172.16.46.4 4
20 9 9
1 0 0 00:06:49 0
172.16.56.5 4
20 9 9
1 0 0 00:06:41 0
192.168.1.7 4 65400 29
29 1 0
0 00:01:22 0
- Publique en BGP las loopbacks0 de los routers que participan en BGP
- R2 y R3 deben publicar la red 23.0.0.0/24
- R4 y R5 deben publicar la red 45.0.0.0/24
R2
router
bgp 10
network 23.0.0.0 mask 255.255.255.0
R3
router
bgp 10
network 23.0.0.0 mask 255.255.255.0
R3#show ip bgp
BGP
table version is 4, local router ID is 10.3.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
*>
23.0.0.0/24 0.0.0.0 0 32768 i
*
i 10.2.2.2 0
100 0 i
R4
router
bgp 20
network 45.0.0.0 mask 255.255.255.0
R5
router
bgp 20
network 45.0.0.0 mask 255.255.255.0
R5#show ip bgp regexp
_$
BGP
table version is 3, local router ID is 20.5.5.5
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
*>
45.0.0.0/24 0.0.0.0 0 32768 i
R1
router
bgp 10
network 10.1.1.1 mask 255.255.255.255
R2
router
bgp 10
network 10.2.2.2 mask 255.255.255.255
R3
router
bgp 10
network 10.3.3.3 mask 255.255.255.255
R4
router
bgp 20
network 20.4.4.4 mask 255.255.255.255
R5
router
bgp 20
network 20.5.5.5 mask 255.255.255.255
R6
router
bgp 30
network 30.6.6.6 mask 255.255.255.255
R7
router
bgp 65400
network 100.7.7.7 mask 255.255.255.255
R2#show ip bgp
BGP
table version is 7, local router ID is 10.2.2.2
Status
codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Network Next Hop Metric LocPrf Weight Path
r>i10.1.1.1/32 10.1.1.1 0 100
0 i
*>
10.2.2.2/32 0.0.0.0 0 32768 i
r>i10.3.3.3/32 10.3.3.3 0 100
0 i
*
i20.4.4.4/32 172.16.14.4 0 100
0 20 i
*
i 172.16.36.6 0 100
0 30 20 i
*
i20.5.5.5/32 172.16.14.4 0 100
0 20 i
*
i 172.16.36.6 0 100
0 30 20 i
*
i23.0.0.0/24 10.3.3.3 0 100
0 i
*> 0.0.0.0 0 32768 i
*
i30.6.6.6/32 172.16.14.4 0
100 0 20 30 i
*
i 172.16.36.6 0 100
0 30 i
*
i45.0.0.0/24 172.16.36.6 0 100
0 30 20 i
*
i 172.16.14.4 0 100
0 20 i
*
i100.7.7.7/32 172.16.14.4 0 100
0 20 30 65400 i
*
i 172.16.36.6 0 100
0 30 65400 i
Antes
de que R2 pueda instalar las actualizaciones sobre cualquier red externa
debemos tener en cuenta que los ASBRs publican las actualizaciones sin
modificar el next-hop. Veamos la siguiente salida. Si observamos por ejemplo la
red 60.0.0.0/24 veremos que R1 y R3 han publicado como next-hop las direcciones
172.16.14.4 y 172.16.36.3. R2 no sabe cómo alcanzar estas direcciones. Que
podemos hacer para que R2 conozca estas direcciones? Redistribuirlas dentro de
IGP, no recomendable o que cada ASBR se haga pasar como próximo salto. Veamos cómo.
R6
router
bgp 30
network 60.0.0.0 mask 255.255.255.0
R2#show ip bgp
BGP
table version is 7, local router ID is 10.2.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
r>i10.1.1.1/32 10.1.1.1 0 100
0 i
*>
10.2.2.2/32 0.0.0.0 0 32768 i
r>i10.3.3.3/32 10.3.3.3 0 100
0 i
*
i20.4.4.4/32 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1 0 100
0 20 i
*
i20.5.5.5/32 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1 0 100
0 20 i
*
i23.0.0.0/24 10.3.3.3 0
100 0 i
*> 0.0.0.0 0 32768 i
*>i30.6.6.6/32 10.3.3.3 0 100
0 30 i
*
i45.0.0.0/24 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1 0
100 0 20 i
*>i60.0.0.0/24 10.3.3.3 0 100
0 30 i
*>i100.7.7.7/32 10.3.3.3 0 100
0 30 65400 i
R1
router
bgp 10
neighbor 10.2.2.2 next-hop-self
R3
router
bgp 10
neighbor 10.2.2.2 next-hop-self
R2#show ip bgp
BGP
table version is 16, local router ID is 10.2.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
r>i10.1.1.1/32 10.1.1.1 0 100
0 i
*>
10.2.2.2/32 0.0.0.0 0 32768 i
r>i10.3.3.3/32 10.3.3.3 0 100
0 i
*>i20.4.4.4/32 10.1.1.1 0 100
0 20 i
*>i20.5.5.5/32 10.1.1.1 0 100
0 20 i
*
i23.0.0.0/24 10.3.3.3 0 100
0 i
*> 0.0.0.0 0 32768 i
*>i30.6.6.6/32 10.3.3.3 0 100
0 30 i
*>i45.0.0.0/24 10.1.1.1 0 100
0 20 i
* i60.0.0.0/24 10.1.1.1 0 100
0 20 30 i
*>i 10.3.3.3
0 100 0 30 i
*>i100.7.7.7/32 10.3.3.3 0 100
0 30 65400 i
WEIGHT
- R4 debe acceder a las redes originadas en AS10 a través de R3. Utilice atributo Weight.
R4#show ip bgp regexp
^10$
BGP
table version is 22, local router ID is 20.4.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
* 10.1.1.1/32 172.16.34.3 0 10 i
*> 172.16.14.1 0 0 10 i
* 10.2.2.2/32 172.16.34.3 0 10 i
*> 172.16.14.1 0 10 i
* 10.3.3.3/32 172.16.34.3 0 0 10 i
*> 172.16.14.1 0 10 i
* 23.0.0.0/24 172.16.34.3 0 0 10 i
*> 172.16.14.1 0 10 i
R4
ip
as-path access-list 5 permit ^10$
route-map
PESO permit 10
match as-path 5
set weight 65535
route-map
PESO permit 20
router
bgp 20
neighbor 172.16.34.3 route-map PESO in
R4#show ip bgp regexp
^10$
BGP
table version is 26, local router ID is 20.4.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
*> 10.1.1.1/32 172.16.34.3 65535 10 i
* 172.16.14.1
0 0 10 i
*> 10.2.2.2/32 172.16.34.3 65535 10 i
* 172.16.14.1 0 10 i
*> 10.3.3.3/32 172.16.34.3 0 65535 10 i
* 172.16.14.1 0 10 i
*> 23.0.0.0/24 172.16.34.3 0 65535 10 i
* 172.16.14.1 0 10 i
R4#traceroute 10.1.1.1
source loopback 0 probe 1
Type
escape sequence to abort.
Tracing
the route to 10.1.1.1
1 172.16.34.3 24 msec
2 10.1.23.2 116 msec
3 10.1.12.1 48 msec
LOCAL_PREFERENCE
- En R5 crear y publicar la red 50.0.0.0/24.
- AS10 debe acceder a esta red a través de R3. Utilizar atributo LP.
R5
interface
Loopback50
ip address 50.0.0.5 255.255.255.0
router
bgp 20
network 50.0.0.0 mask 255.255.255.0
R2#show ip bgp regexp
20$
BGP
table version is 24, local router ID is 10.2.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
*
i20.4.4.4/32 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1
0 100 0 20 i
*
i20.5.5.5/32 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1 0 100
0 20 i
*
i45.0.0.0/24 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1
0 100 0 20 i
*>i50.0.0.0/24 10.1.1.1 0 100
0 20 i
*
i 10.3.3.3
0 100 0 20 i
R3
access-list
1 permit 50.0.0.0
route-map
LP permit 10
match ip address 1
set local-preference 101
route-map
LP permit 20
router
bgp 10
neighbor 172.16.34.4 route-map LP in
R2#show ip bgp regexp
20$
BGP
table version is 25, local router ID is 10.2.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
*
i20.4.4.4/32 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1
0 100 0 20 i
*
i20.5.5.5/32 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1
0 100 0 20 i
*
i45.0.0.0/24 10.3.3.3 0 100
0 20 i
*>i 10.1.1.1
0 100 0 20 i
*>i50.0.0.0/24 10.3.3.3 0 101
0 20 i
R1#show ip bgp regexp
20$
BGP
table version is 25, local router ID is 10.1.1.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
*>
20.4.4.4/32 172.16.14.4 0 0 20 i
*>
20.5.5.5/32 172.16.14.4 0 20 i
*>
45.0.0.0/24 172.16.14.4 0 20 i
*>i50.0.0.0/24 10.3.3.3 0 101
0 20 i
* 172.16.14.4 0 20 i
AS_PATH
- R4 debe crear y publicar la red 40.0.0.0/24.
- R1 debe acceder a la red 40.0.0.0/24 a través de R3. Utilizar atributo AS_PATH
R4
interface
Loopback40
ip address 40.0.0.4 255.255.255.0
router
bgp 20
network 40.0.0.0 mask 255.255.255.0
R1#show ip bgp regexp
20$
BGP
table version is 29, local router ID is 10.1.1.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
*>
20.4.4.4/32 172.16.14.4 0 0 20 i
*>
20.5.5.5/32 172.16.14.4 0 20 i
*
i40.0.0.0/24 10.3.3.3 0 100
0 20 i
*> 172.16.14.4
0 0 20 i
*>
45.0.0.0/24 172.16.14.4 0 20 i
*>i50.0.0.0/24 10.3.3.3 0 101
0 20 i
* 172.16.14.4 0 20 i
R4
access-list
1 permit 40.0.0.0
route-map
AS permit 10
match ip address 1
set as-path prepend 20 20 20 20
route-map
AS permit 20
router
bgp 20
neighbor 172.16.14.1 route-map AS out
R1#show ip bgp regexp
20$
BGP
table version is 31, local router ID is 10.1.1.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
*>
20.4.4.4/32 172.16.14.4 0 0 20 i
*>
20.5.5.5/32 172.16.14.4 0 20 i
*>i40.0.0.0/24 10.3.3.3 0 100
0 20 i
* 172.16.14.4
0 0 20 20 20 20 20 i
*>
45.0.0.0/24 172.16.14.4 0 20 i
*>i50.0.0.0/24 10.3.3.3 0
101 0 20 i
* 172.16.14.4 0 20 i
MED
- R4 y R5 deben publicar la red 45.0.0.0/24.
- R6 debe acceder a la red 45.0.0.0/24 a través de R5. Utilice atributo MED
R4
router
bgp 20
neighbor 20.5.5.5 next-hop-self
R5
router
bgp 20
neighbor 20.4.4.4 next-hop-self
R4
router
bgp 20
network 45.0.0.0 mask 255.255.255.0
R5
router
bgp 20
network 45.0.0.0 mask 255.255.255.0
R6#show ip bgp regexp
20$
BGP
table version is 13, local router ID is 30.6.6.6
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
* 20.4.4.4/32 172.16.36.3 0 10 20 i
*> 172.16.46.4 0 0 20 i
* 172.16.56.5 0 20 i
* 20.5.5.5/32 172.16.36.3 0 10 20 i
*> 172.16.46.4 0 20 i
* 172.16.56.5
0 0 20 i
* 40.0.0.0/24 172.16.36.3 0 10 20 i
*> 172.16.46.4 0 0 20 i
* 172.16.56.5 0 20 i
* 45.0.0.0/24 172.16.36.3 0 10 20 i
*> 172.16.46.4
0 0 20 i
*
172.16.56.5 0 0 20 i
* 50.0.0.0/24 172.16.36.3 0 10 20 i
*> 172.16.46.4 0 20 i
* 172.16.56.5
0 0 20 i
R4
access-list
2 permit 45.0.0.0
route-map
MED permit 10
match ip address 2
set metric 65535
route-map
MED permit 20
router
bgp 20
neighbor 172.16.46.6 route-map MED out
R6#show ip bgp regexp
20$
BGP
table version is 14, local router ID is 30.6.6.6
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
* 20.4.4.4/32 172.16.36.3 0 10 20 i
*> 172.16.46.4
0 0 20 i
* 172.16.56.5 0 20 i
* 20.5.5.5/32 172.16.36.3 0 10 20 i
*> 172.16.46.4 0 20 i
* 172.16.56.5
0 0 20 i
* 40.0.0.0/24 172.16.36.3 0 10 20 i
*> 172.16.46.4
0 0 20 i
* 172.16.56.5 0 20 i
* 45.0.0.0/24 172.16.36.3 0 10 20 i
* 172.16.46.4 65535 0 20 i
*> 172.16.56.5 0 0 20 i
* 50.0.0.0/24 172.16.36.3 0 10 20 i
*> 172.16.46.4 0 20 i
* 172.16.56.5
0 0 20 i
- R7 debe crear y publicar en BGP el rango de redes 100.0.0.0/24 a 100.0.7.0/24. Los demás routers solo deben ver el prefijo sumarizado.
R7
interface
Loopback100
ip address 100.0.1.7 255.255.255.0 secondary
ip address 100.0.2.7 255.255.255.0 secondary
ip address 100.0.3.7 255.255.255.0 secondary
ip address 100.0.4.7 255.255.255.0 secondary
ip address 100.0.5.7 255.255.255.0 secondary
ip address 100.0.6.7 255.255.255.0 secondary
ip address 100.0.7.7 255.255.255.0 secondary
ip address 100.0.0.7 255.255.255.0
R6#show ip bgp regexp
65400$
BGP
table version is 23, local router ID is 30.6.6.6
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.0.0.0/24 192.168.1.7 0 0 65400 i
*>
100.0.1.0/24 192.168.1.7 0 0 65400 i
*>
100.0.2.0/24 192.168.1.7 0 0 65400 i
*>
100.0.3.0/24 192.168.1.7 0 0 65400 i
*>
100.0.4.0/24 192.168.1.7 0 0 65400 i
*>
100.0.5.0/24 192.168.1.7 0 0 65400 i
*>
100.0.6.0/24 192.168.1.7 0 0 65400 i
*>
100.0.7.0/24 192.168.1.7 0 0 65400 i
*>
100.7.7.7/32 192.168.1.7 0 0 65400 i
R7
router bgp 65400
aggregate-address 100.0.0.0 255.255.248.0
R6#show ip bgp regexp
65400$
BGP
table version is 23, local router ID is 30.6.6.6
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.0.0.0/24 192.168.1.7 0 0 65400 i
*>
100.0.0.0/21 192.168.1.7 0 0 65400 i
*>
100.0.1.0/24 192.168.1.7 0 0 65400 i
*>
100.0.2.0/24 192.168.1.7 0 0 65400 i
*>
100.0.3.0/24 192.168.1.7 0 0 65400 i
*>
100.0.4.0/24 192.168.1.7 0 0 65400 i
*>
100.0.5.0/24 192.168.1.7 0 0 65400 i
*>
100.0.6.0/24 192.168.1.7 0 0 65400 i
*>
100.0.7.0/24 192.168.1.7 0 0 65400 i
*>
100.7.7.7/32 192.168.1.7 0 0 65400 i
- Por defecto BGP publica el resumen y las redes específicas, debemos incluir la palabra clave summary-only
R7
router
bgp 65400
aggregate-address 100.0.0.0 255.255.248.0
summary-only
R6#show ip bgp regexp
65400$
BGP
table version is 51, local router ID is 30.6.6.6
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.0.0.0/21 192.168.1.7 0 0 65400 i
*>
100.7.7.7/32 192.168.1.7 0 0 65400 i