Configuración completa de red LAN con VLANs y switch management
Trabajas para una empresa mediana que necesita implementar una red LAN segmentada. La empresa tiene tres departamentos y requiere:
! Entrar en modo de configuración
Switch> enable
Switch# configure terminal
! Configurar hostname
Switch(config)# hostname SW-EMPRESA
! Configurar contraseña de enable
SW-EMPRESA(config)# enable secret AdminPass123
! Configurar banner de mensaje
SW-EMPRESA(config)# banner motd "Acceso autorizado solamente"
! Configurar consola
SW-EMPRESA(config)# line console 0
SW-EMPRESA(config-line)# password ConsolePass123
SW-EMPRESA(config-line)# login
SW-EMPRESA(config-line)# logging synchronous
SW-EMPRESA(config-line)# exit
! Crear VLAN 10
SW-EMPRESA(config)# vlan 10
SW-EMPRESA(config-vlan)# name VENTAS
SW-EMPRESA(config-vlan)# exit
! Crear VLAN 20
SW-EMPRESA(config)# vlan 20
SW-EMPRESA(config-vlan)# name CONTABILIDAD
SW-EMPRESA(config-vlan)# exit
! Crear VLAN 30
SW-EMPRESA(config)# vlan 30
SW-EMPRESA(config-vlan)# name IT
SW-EMPRESA(config-vlan)# exit
! Crear VLAN de gestión
SW-EMPRESA(config)# vlan 99
SW-EMPRESA(config-vlan)# name GESTION
SW-EMPRESA(config-vlan)# exit
! Configurar puertos de VENTAS
SW-EMPRESA(config)# interface range fastethernet 0/1-10
SW-EMPRESA(config-if-range)# switchport mode access
SW-EMPRESA(config-if-range)# switchport access vlan 10
SW-EMPRESA(config-if-range)# spanning-tree portfast
SW-EMPRESA(config-if-range)# exit
! Configurar puertos de CONTABILIDAD
SW-EMPRESA(config)# interface range fastethernet 0/11-20
SW-EMPRESA(config-if-range)# switchport mode access
SW-EMPRESA(config-if-range)# switchport access vlan 20
SW-EMPRESA(config-if-range)# spanning-tree portfast
SW-EMPRESA(config-if-range)# exit
! Configurar puertos de IT
SW-EMPRESA(config)# interface range fastethernet 0/21-23
SW-EMPRESA(config-if-range)# switchport mode access
SW-EMPRESA(config-if-range)# switchport access vlan 30
SW-EMPRESA(config-if-range)# spanning-tree portfast
SW-EMPRESA(config-if-range)# exit
! Configurar puerto trunk al router
SW-EMPRESA(config)# interface fastethernet 0/24
SW-EMPRESA(config-if)# switchport mode trunk
SW-EMPRESA(config-if)# switchport trunk native vlan 99
SW-EMPRESA(config-if)# switchport trunk allowed vlan 10,20,30,99
SW-EMPRESA(config-if)# exit
! Port security en puertos de VENTAS
SW-EMPRESA(config)# interface range fastethernet 0/1-10
SW-EMPRESA(config-if-range)# switchport port-security
SW-EMPRESA(config-if-range)# switchport port-security maximum 2
SW-EMPRESA(config-if-range)# switchport port-security mac-address sticky
SW-EMPRESA(config-if-range)# switchport port-security violation restrict
SW-EMPRESA(config-if-range)# exit
! Port security en puertos de CONTABILIDAD (más restrictivo)
SW-EMPRESA(config)# interface range fastethernet 0/11-20
SW-EMPRESA(config-if-range)# switchport port-security
SW-EMPRESA(config-if-range)# switchport port-security maximum 1
SW-EMPRESA(config-if-range)# switchport port-security mac-address sticky
SW-EMPRESA(config-if-range)# switchport port-security violation shutdown
SW-EMPRESA(config-if-range)# exit
! Configurar IP de gestión
SW-EMPRESA(config)# interface vlan 99
SW-EMPRESA(config-if)# ip address 192.168.1.10 255.255.255.0
SW-EMPRESA(config-if)# no shutdown
SW-EMPRESA(config-if)# exit
! Gateway por defecto
SW-EMPRESA(config)# ip default-gateway 192.168.1.1
! Configurar acceso SSH
SW-EMPRESA(config)# ip domain-name empresa.local
SW-EMPRESA(config)# crypto key generate rsa general-keys modulus 1024
SW-EMPRESA(config)# username admin privilege 15 secret AdminSSH123
SW-EMPRESA(config)# line vty 0 15
SW-EMPRESA(config-line)# transport input ssh
SW-EMPRESA(config-line)# login local
SW-EMPRESA(config-line)# exit
! Guardar configuración
SW-EMPRESA(config)# exit
SW-EMPRESA# write memory
Utiliza estos comandos para verificar que la configuración sea correcta:
| Comando | Qué Verificar |
|---|---|
show vlan brief |
VLANs creadas y puertos asignados |
show interfaces status |
Estado de puertos y VLAN asignada |
show interfaces trunk |
Configuración de puerto trunk |
show port-security |
Estado de seguridad de puertos |
show ip interface brief |
IP de gestión configurada |
show running-config |
Configuración completa actual |
! Resetear puerto en err-disabled
SW-EMPRESA(config)# interface fastethernet 0/X
SW-EMPRESA(config-if)# shutdown
SW-EMPRESA(config-if)# no shutdown
! Ver detalles de port security
SW-EMPRESA# show port-security interface fastethernet 0/X
! Ver tabla de MACs
SW-EMPRESA# show mac address-table dynamic
! Limpiar tabla de MACs
SW-EMPRESA# clear mac address-table dynamic
Marca cada elemento como completado:
Guarda la configuración frecuentemente con write memory