lunes, 9 de septiembre de 2013

OSPF con un solo area


Este artículo forma parte de una serie de varios artículos que tratan los distintos tipos de routing en IPV4 e IPV6 para CCNA R&S, para ir al índice del curso tienes este link:



OSPF:

Si se me permite tener un protocolo de routing favorito, ese sin duda es OSPF,¿Por qué? , ni idea, pero siempre me ha gustado. En este artículo no pretendo entrar en toda la teoría sobre OSPF, que es mucha, y muy importante conocerla, simplemente vamos a entrar a configurar OSPF con un único área, pero vamos a entender lo que hacemos por medio de comandos show.


Configuración:


La configuración de OSPF, al igual que la de otros protocolos es bastante sencilla, lo complicado es entender, y predecir el comportamiento.


R(config)#router ospf <Numero de Proceso>
R2(config-router)#network <red> <mascara_wildcard> area <numero_area>
Numero de proceso: Puedes poner el número que te venga en gana, NO tiene poque coincidir entre los routers, simplemente es un número para identificar al proceso de OSPF, existe simplemente porque puedes configurar varios OSPF en el mismo router ;) .

Red y mascara de wildcard: Es la red por la que queremos hablar ospf, esto significa que si ponemos una ip cualquiera y una máscara de wilcard 0.0.0.0(equivalente a red /32) solo hablaremos por esa intefaz. En cambio si ponemos 0.0.0.0 255.255.255.255(equivalente 0.0.0.0/0) hablaríamos OSPF por todas las intefaces del router. A mí me gusta usar siempre 0.0.0.0 como wildcard porque me gusta controlar completamente porque interfaz hablo routing.

Numero de área: Debe coincidir, acostúmbrate a usar 0 por un tema de diseño que se verá en otro capítulo.


Si en un link ambos extremos tienen configurado ospf debería aparecer algo como esto:


*Mar 1 00:32:50.783: %OSPF-5-ADJCHG: Process 4, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done

Tus routers se han hecho amigos, se irán de copas juntos, y a partir de ahora intercambiarán información de routing :-D.


Ejemplo:



Dada la siguiente topología vamos a configurar OSPF, todos los routers además tendran una loopback que tendrá como direccion ip el numero de router en todos los octetos, por lo que el router R1 tendra como loopback 1.1.1.1.


R1:

interface Loopback1
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.13.1 255.255.255.0
!
!
router ospf 1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 192.168.12.1 0.0.0.0 area 0
network 192.168.13.1 0.0.0.0 area 0
!

R2:

interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.24.2 255.255.255.0
!
interface FastEthernet1/0
ip address 192.168.23.2 255.255.255.0
!
!
router ospf 2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 192.168.12.2 0.0.0.0 area 0
network 192.168.23.2 0.0.0.0 area 0
network 192.168.24.2 0.0.0.0 area 0


R3:

interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.34.3 255.255.255.0
!
interface FastEthernet1/0
ip address 192.168.13.3 255.255.255.0
!
!
router ospf 3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 192.168.13.3 0.0.0.0 area 0
network 192.168.23.3 0.0.0.0 area 0
network 192.168.34.3 0.0.0.0 area 0



R4:

interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.24.4 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.34.4 255.255.255.0
!
!
router ospf 4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 192.168.24.4 0.0.0.0 area 0
network 192.168.34.4 0.0.0.0 area 0


Vamos a ver los vecinos:

Desde R1 podemos ver que tenemos dos vecinos, los cuales se identifican con el router ID, que por defecto es la ip de loopback más alta de cada router. Pero debajo de Address podemos ver cuál es la IP de la que me he hecho vecino.

R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/DR 00:00:35 192.168.13.3 FastEthernet0/1
2.2.2.2 1 FULL/DR 00:00:38 192.168.12.2 FastEthernet0/0

Tabla de routing de cada dispositivo:

Si te fijas bien puedes ver que las rutas aprendidas automáticamente por OSPF aparecen con una O delante, en lugar de la S de cuando configurábamos rutas estáticas. Además se puede ver 110/X , 110 es la distancia administrativa, y el valor de detrás de la barra es la métrica.

R1#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/0
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback1
C 192.168.13.0/24 is directly connected, FastEthernet0/1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 192.168.12.2, 00:04:35, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 192.168.13.3, 00:04:35, FastEthernet0/1
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/3] via 192.168.13.3, 00:04:36, FastEthernet0/1
                [110/3] via 192.168.12.2, 00:04:36, FastEthernet0/0
O 192.168.24.0/24 [110/2] via 192.168.12.2, 00:04:36, FastEthernet0/0
O 192.168.23.0/24 [110/2] via 192.168.13.3, 00:04:36, FastEthernet0/1
                               [110/2] via 192.168.12.2, 00:04:36, FastEthernet0/0
O 192.168.34.0/24 [110/2] via 192.168.13.3, 00:04:37, FastEthernet0/1



R2#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/0
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 192.168.12.1, 00:05:14, FastEthernet0/0
O 192.168.13.0/24 [110/2] via 192.168.23.3, 00:05:14, FastEthernet1/0
                               [110/2] via 192.168.12.1, 00:05:14, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 192.168.23.3, 00:05:14, FastEthernet1/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 192.168.24.4, 00:05:16, FastEthernet0/1
C 192.168.24.0/24 is directly connected, FastEthernet0/1
C 192.168.23.0/24 is directly connected, FastEthernet1/0
O 192.168.34.0/24 [110/2] via 192.168.24.4, 00:05:16, FastEthernet0/1
                               [110/2] via 192.168.23.3, 00:05:16, FastEthernet1/0



R3#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
O 192.168.12.0/24 [110/2] via 192.168.23.2, 00:05:46, FastEthernet0/0
                               [110/2] via 192.168.13.1, 00:05:46, FastEthernet1/0
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 192.168.13.1, 00:05:46, FastEthernet1/0
C 192.168.13.0/24 is directly connected, FastEthernet1/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 192.168.23.2, 00:05:46, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 192.168.34.4, 00:05:48, FastEthernet0/1
O 192.168.24.0/24 [110/2] via 192.168.34.4, 00:05:48, FastEthernet0/1
                               [110/2] via 192.168.23.2, 00:05:48, FastEthernet0/0
C 192.168.23.0/24 is directly connected, FastEthernet0/0
C 192.168.34.0/24 is directly connected, FastEthernet0/1


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

O 192.168.12.0/24 [110/2] via 192.168.24.2, 00:06:10, FastEthernet0/0
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/3] via 192.168.34.3, 00:06:10, FastEthernet0/1
[110/3] via 192.168.24.2, 00:06:10, FastEthernet0/0
O 192.168.13.0/24 [110/2] via 192.168.34.3, 00:06:10, FastEthernet0/1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 192.168.24.2, 00:06:10, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 192.168.34.3, 00:06:11, FastEthernet0/1
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
C 192.168.24.0/24 is directly connected, FastEthernet0/0
O 192.168.23.0/24 [110/2] via 192.168.34.3, 00:06:11, FastEthernet0/1
                               [110/2] via 192.168.24.2, 00:06:11, FastEthernet0/0
C 192.168.34.0/24 is directly connected, FastEthernet0/1





Verificar nuestro proceso de OSPF:


R1#show ip ospf
Routing Process "ospf 1" with ID 1.1.1.1
Start time: 00:35:03.448, Time elapsed: 00:07:17.844
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 3 (1 loopback)
Area has no authentication
SPF algorithm last executed 00:06:38.096 ago
SPF algorithm executed 4 times
Area ranges are
Number of LSA 9. Checksum Sum 0x046A21
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0



Como se puede ver aparece nuestro router ID, a que area pertenecemos, y cuantas interfaces “hablan” OSPF.


Base de datos:

Si te has estudiado la teoría de CCNA sabrás que OSPF es un protocolo de routing basado en estado de enlace, y por tanto tiene una base de datos con todos los routers, que interfaces tienen y demás. Si quieres curiosear un poco aquí te dejo un pequeño snapshot.


R1#show ip ospf database

OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 441 0x80000004 0x0059CA 3
2.2.2.2 2.2.2.2 449 0x80000007 0x00B434 4
3.3.3.3 3.3.3.3 442 0x80000007 0x00556C 4
4.4.4.4 4.4.4.4 598 0x80000004 0x00B007 3
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.12.2 2.2.2.2 449 0x80000001 0x008F1F
192.168.13.3 3.3.3.3 442 0x80000001 0x007E26
192.168.23.2 2.2.2.2 649 0x80000001 0x007A21
192.168.24.2 2.2.2.2 603 0x80000001 0x00A1F4
192.168.34.3 3.3.3.3 603 0x80000001 0x002D56


Conectividad y alta disponibilidad:


A continuación lo que voy a hacer es lanzar un ping desde la loopback de R1 a la loopback de R4, voy a tirar uno de los caminos que me lleva a esa loopback, y vamos a ver que pasa.

R1# ping 4.4.4.4 source loop 1 rep 1000
Type escape sequence to abort.
Sending 1000, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!
*Mar 1 01:23:58.711: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!

Success rate is 99 percent (997/1000), round-trip min/avg/max = 16/40/76 ms



Como se puede ver se pierden tres paquetes únicamente, el solito se adapta a la topología, y cuando ve que uno de los caminos está muerto lo saca de la tabla de rutas.





No hay comentarios:

Publicar un comentario