Routing estático, OSPF y routing inter-VLAN
El routing es el proceso de encontrar el mejor camino para enviar paquetes entre diferentes redes.
Las rutas estáticas se configuran manualmente y no cambian automáticamente.
! Configuración básica del router
Router> enable
Router# configure terminal
Router(config)# hostname R1
! Configurar interfaces
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip address 10.0.0.1 255.255.255.252
R1(config-if)# no shutdown
R1(config-if)# exit
! Configurar rutas estáticas
R1(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
R1(config)# ip route 192.168.3.0 255.255.255.0 10.0.0.2
! Ruta por defecto
R1(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.2
| Tipo | Sintaxis | Uso |
|---|---|---|
| Next-hop | ip route network mask next-hop-ip |
Especifica IP del siguiente router |
| Exit Interface | ip route network mask exit-interface |
Especifica interfaz de salida |
| Floating Static | ip route network mask next-hop AD |
Ruta de respaldo con AD alta |
OSPF es un protocolo de routing dinámico que utiliza el algoritmo Dijkstra para encontrar la ruta más corta.
! Habilitar OSPF
R1(config)# router ospf 1
! Configurar Router ID
R1(config-router)# router-id 1.1.1.1
! Anunciar redes en OSPF
R1(config-router)# network 192.168.1.0 0.0.0.255 area 0
R1(config-router)# network 10.0.0.0 0.0.0.3 area 0
! Configurar interfaces pasivas
R1(config-router)# passive-interface gigabitethernet 0/0
! Configurar autenticación (opcional)
R1(config-router)# area 0 authentication message-digest
R1(config-router)# exit
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip ospf message-digest-key 1 md5 ospfpass
R1(config-if)# exit
Permite comunicación entre diferentes VLANs usando un router o switch Layer 3.
! Configurar subinterfaces en el router
R1(config)# interface gigabitethernet 0/0
R1(config-if)# no ip address
R1(config-if)# no shutdown
R1(config-if)# exit
! Subinterfaz para VLAN 10
R1(config)# interface gigabitethernet 0/0.10
R1(config-subif)# encapsulation dot1Q 10
R1(config-subif)# ip address 192.168.10.1 255.255.255.0
R1(config-subif)# exit
! Subinterfaz para VLAN 20
R1(config)# interface gigabitethernet 0/0.20
R1(config-subif)# encapsulation dot1Q 20
R1(config-subif)# ip address 192.168.20.1 255.255.255.0
R1(config-subif)# exit
! Subinterfaz para VLAN 30
R1(config)# interface gigabitethernet 0/0.30
R1(config-subif)# encapsulation dot1Q 30
R1(config-subif)# ip address 192.168.30.1 255.255.255.0
R1(config-subif)# exit
! Habilitar routing en switch Layer 3
Switch(config)# ip routing
! Configurar SVIs
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface vlan 20
Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
! Configurar puerto routed
Switch(config)# interface gigabitethernet 0/1
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.0.0.1 255.255.255.252
Switch(config-if)# no shutdown
Switch(config-if)# exit
| Comando | Descripción |
|---|---|
show ip route |
Tabla de routing completa |
show ip route static |
Solo rutas estáticas |
show ip route ospf |
Solo rutas OSPF |
show ip ospf neighbor |
Vecinos OSPF |
show ip ospf database |
Base de datos OSPF |
show ip ospf interface |
Interfaces OSPF |
ping / traceroute |
Verificar conectividad |
¿Cuál es la distancia administrativa de una ruta estática?
¿Qué comando configura una subinterfaz para VLAN 50?
show ip route
show ip ospf neighbor
router ospf 1
network x.x.x.x w.w.w.w area 0