Configurar i Posar en Marxa els Switchos Principals
SMX · LAN Party · Repte 1.3

Configurar i Posar en Marxa
els Switchos Principals

Cisco Packet Tracer Cisco 2960-24TT + Router 2811 IEEE 802.1Q · PVST+ Router-on-a-Stick
VLAN 802.1Q Trunk STP PVST PortFast Router-on-a-Stick Native VLAN 99 Seguretat de port
01 Justificació Tècnica
L’objectiu d’aquesta tasca és configurar i posar en marxa els switchos principals d’una xarxa local per a una LAN Party, garantint que tots els participants puguin comunicar-se correctament independentment del switch al qual estiguin connectats físicament. Per aconseguir-ho, hem implementat una arquitectura basada en VLANs per segmentar el trànsit, trunks 802.1Q per transportar múltiples VLANs entre switches, i la tècnica Router-on-a-Stick per permetre la comunicació entre VLANs a través d’un únic router. Tot el procés ha estat simulat i verificat amb Cisco Packet Tracer, usant switches Cisco 2960-24TT i un router Cisco 2811.
Context del repte

En el marc de la LAN Party del mòdul SMX, hem configurat una xarxa commutada de nivell 2 amb encaminament inter-VLAN mitjançant la tècnica Router-on-a-Stick. L’objectiu era permetre que qualsevol participant connectat a qualsevol switch d’accés pogués comunicar-se amb altres participants de la mateixa VLAN independentment del switch al qual estigués connectat físicament. Hem distribuït participants de diferents VLANs en cada switch d’accés, reflectint un escenari real de LAN Party on els jugadors s’asseuen on troben lloc.

Decisions tècniques justificades
🔀

Segmentació per VLANs

Hem creat cinc VLANs diferenciades: la VLAN 99 com a nativa i d’administració, i les VLANs 101, 102, 103 i 104 per als participants de cada grup. Aquesta segmentació redueix els dominis de broadcast, millora el rendiment de la xarxa i aporta seguretat perquè cada grup de participants no pot accedir directament al trànsit dels altres grups sense passar pel router.

🌿

Native VLAN 99 — no la VLAN 1 per defecte

Hem canviat la native VLAN de la VLAN 1 (per defecte) a la VLAN 99. La VLAN 1 és la més vulnerable als atacs de tipus VLAN hopping i és una pràctica de seguretat estàndard no usar-la com a native VLAN en entorns de producció. Usar la VLAN 99 dedicada exclusivament al trànsit natiu dels trunks minimitza el risc d’atacs de segmentació.

🔗

Ports trunk amb VLANs permeses explícites

Tots els ports trunk entre switches porten únicament les VLANs necessàries (99, 101, 102, 103, 104) en lloc de permetre el pas de totes les VLANs per defecte (1–1005). Això redueix el trànsit innecessari i evita que VLANs no configurades puguin travessar la xarxa, millorant la seguretat i el rendiment global del sistema.

STP PVST+ amb PortFast als ports d’accés

Hem activat el mode Per-VLAN Spanning Tree Plus (PVST+) per tenir una instància STP independent per a cada VLAN, permetent una convergència més eficient. Als ports d’accés on connectem els PCs hem activat PortFast, que elimina els 30 segons d’espera de STP i permet que els dispositius finals obtinguin connectivitat immediatament en connectar el cable — vital en una LAN Party on els participants connecten i desconnecten freqüentment.

🌐

Router-on-a-Stick per a l’encaminament inter-VLAN

Hem configurat el router 2811 amb subinterfícies lògiques (Fa0/0.1 a Fa0/0.5) per encaminar el trànsit entre VLANs. Cada subinterfície actua com a gateway per a la seva VLAN corresponent, usant l’encapsulament 802.1Q. Aquesta arquitectura permet la comunicació entre participants de VLANs diferents passant per un únic router, sense necessitat d’un switch multicapa (capa 3).

🔒

Seguretat d’accés als dispositius

Hem configurat contrasenyes encriptades (enable secret amb hash MD5) i contrasenyes de consola i VTY a tots els switches i al router. Hem afegit un banner MOTD d’advertència d’accés restringit a cada dispositiu. La comanda no ip domain-lookup evita retards innecessaris quan s’introdueix un comandament incorrecte, cosa especialment important durant la gestió en directe d’una LAN Party. La VLAN 1 de gestió ha estat desactivada per seguretat.

📡

Distribució de VLANs dispersa per switch

En lloc d’assignar una única VLAN per switch, hem distribuït participants de diferents VLANs en cada switch d’accés. Això reflecteix un escenari real de LAN Party on els participants s’asseuen on troben lloc, independentment de la seva VLAN. El trànsit de cada VLAN viatja etiquetat pels trunks fins al router, que fa l’encaminament inter-VLAN quan cal.

02 Topologia de Xarxa
Topologia de xarxa LAN Party
// Topologia lògica — Router 2811 + Switch0-Central (SW-Core) + Switch1, Switch2, Switch3 d’accés + PCs amb VLANs disperses
Esquema d’adreces IP
VLANNomXarxaGateway (Router)Rang PCs
99Administrador192.168.99.0/24192.168.99.1Nativa — sense PCs
101Recursos-Humans192.168.101.0/24192.168.101.1.2 – .254
102Internacional192.168.102.0/24192.168.102.1.2 – .254
103Trabajadors-interns192.168.103.0/24192.168.103.1.2 – .254
104Trabajadors-externs192.168.104.0/24192.168.104.1.2 – .254
Distribució de ports per switch
SwitchPortModeVLANFunció
Switch0-CentralFa0/1Trunk99,101-104→ Router
Switch0-CentralFa0/2–4Trunk99,101-104→ Sw1, Sw2, Sw3
Switch0-CentralFa0/5Access104PC Trabajadors-externs
Switch0-CentralFa0/6Access103PC Trabajadors-interns
Switch_1Fa0/1Trunk99,101-104→ SW-Core
Switch_1Fa0/2Access101PC Recursos-Humans
Switch_1Fa0/3Access102PC Internacional
Switch_1Fa0/4Access103PC Trabajadors-interns
Switch_2Fa0/1Trunk99,101-104→ SW-Core
Switch_2Fa0/2Access102PC Internacional
Switch_2Fa0/3Access101PC Recursos-Humans
Switch_2Fa0/4Access104PC Trabajadors-externs
Switch_3Fa0/1Trunk99,101-104→ SW-Core
Switch_3Fa0/2Access104PC Trabajadors-externs
Switch_3Fa0/3Access101PC Recursos-Humans
Switch_3Fa0/4Access102PC Internacional
03 Router1 — Router-on-a-Stick
Funcionament: El router 2811 rep tot el trànsit inter-VLAN per la interfície física Fa0/0 i l’encamina a través de les subinterfícies lògiques. Cada subinterfície identifica la VLAN gràcies a l’etiqueta 802.1Q i actua com a gateway per als dispositius d’aquella VLAN.
show ip interface brief Router1
// show ip interface brief — totes les subinterfícies up/up amb les IPs de gateway de cada VLAN
show running-config — Router1
Router1#show running-config
!
version 15.1
hostname Router1
no ip domain-lookup
enable secret 5 $1$mERr$5.a6P4JqbNiMX01usIfka/
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 no shutdown
!
interface FastEthernet0/0.1
 encapsulation dot1Q 101
 ip address 192.168.101.1 255.255.255.0
!
interface FastEthernet0/0.2
 encapsulation dot1Q 102
 ip address 192.168.102.1 255.255.255.0
!
interface FastEthernet0/0.3
 encapsulation dot1Q 103
 ip address 192.168.103.1 255.255.255.0
!
interface FastEthernet0/0.4
 encapsulation dot1Q 104
 ip address 192.168.104.1 255.255.255.0
!
interface FastEthernet0/0.5
 encapsulation dot1Q 99
 ip address 192.168.99.1 255.255.255.0
!
banner motd ^C ACCES RESTRINGIT - ROUTER PRINCIPAL ^C
!
line con 0
 password class123
 login
!
line vty 0 4
 password class123
 login
!
04 Configuració de VLANs — Switches
Nota: Tots els switches coneixen les cinc VLANs (99, 101, 102, 103, 104) amb els mateixos noms, garantint la coherència de la base de dades VLAN a tota la xarxa commutada.
show vlan brief Switch0-Central
// show vlan brief — Switch0-Central
show vlan brief Switch_1
// show vlan brief — Switch_1
show vlan brief Switch_2
// show vlan brief — Switch_2
show vlan brief Switch_3
// show vlan brief — Switch_3
05 Configuració de Trunks 802.1Q
Verificació: Tots els ports trunk estan en mode trunking amb encapsulament 802.1q, native VLAN 99 i únicament les VLANs necessàries permeses (99, 101-104). Cap VLAN no desitjada travessa els trunks.
show interfaces trunk Switch0-Central
// show interfaces trunk — Switch0-Central · Fa0/1–4 en mode trunking · Native VLAN 99
show interfaces trunk Switch_1
// show interfaces trunk — Switch_1
show interfaces trunk Switch_2
// show interfaces trunk — Switch_2
show interfaces trunk Switch_3
// show interfaces trunk — Switch_3
06 Configuració Completa dels Switches
show running-config — Switch0-Central
Switch0-Central#show running-config
!
version 15.0
hostname Switch0-Central
enable secret 5 $1$mERr$J.OiROrT9LehkGan4G.cc1
no ip domain-lookup
spanning-tree mode pvst
!
interface FastEthernet0/1
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/2
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/3
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/4
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/5
 switchport access vlan 104
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/6
 switchport access vlan 103
 switchport mode access
 spanning-tree portfast
!
interface Vlan1
 no ip address
 shutdown
!
banner motd ^C ACCES RESTRINGIT - SWITCH CENTRAL ^C
!
line con 0
 password cisco0
 login
!
line vty 0 15
 password cisco0
 login
show running-config — Switch_1
Switch_1#show running-config
!
version 15.0
hostname Switch_1
enable secret 5 $1$mERr$UoSyTJlbm/P2Fq3rnQCA.0
no ip domain-lookup
spanning-tree mode pvst
!
interface FastEthernet0/1
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/2
 switchport access vlan 101
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/3
 switchport access vlan 102
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/4
 switchport access vlan 103
 switchport mode access
 spanning-tree portfast
!
interface Vlan1
 no ip address
 shutdown
!
banner motd ^C ACCES RESTRINGIT - SWITCH 1 ^C
!
line con 0
 password cisco1
 login
!
line vty 0 15
 password cisco1
 login
show running-config — Switch_2
Switch_2#show running-config
!
version 15.0
hostname Switch_2
enable secret 5 $1$mERr$z1GGWQZQBigC4zybJgR2m/
no ip domain-lookup
spanning-tree mode pvst
!
interface FastEthernet0/1
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/2
 switchport access vlan 102
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/3
 switchport access vlan 101
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/4
 switchport access vlan 104
 switchport mode access
 spanning-tree portfast
!
interface Vlan1
 no ip address
 shutdown
!
banner motd ^C ACCES RESTRINGIT - SWITCH 2 ^C
!
line con 0
 password cisco2
 login
!
line vty 0 15
 password cisco2
 login
show running-config — Switch_3
Switch_3#show running-config
!
version 15.0
hostname Switch_3
enable secret 5 $1$mERr$2wjc.t7UoQgH0224nEUpC1
no ip domain-lookup
spanning-tree mode pvst
!
interface FastEthernet0/1
 switchport trunk native vlan 99
 switchport trunk allowed vlan 99,101-104
 switchport mode trunk
!
interface FastEthernet0/2
 switchport access vlan 104
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/3
 switchport access vlan 101
 switchport mode access
 spanning-tree portfast
!
interface FastEthernet0/4
 switchport access vlan 102
 switchport mode access
 spanning-tree portfast
!
interface Vlan1
 no ip address
 shutdown
!
banner motd ^C ACCES RESTRINGIT - SWITCH 3 ^C
!
line con 0
 password cisco3
 login
!
line vty 0 15
 password cisco3
 login
07 Spanning Tree Protocol (PVST+)
Root Bridge: Switch_2 és el Root Bridge de totes les VLANs (MAC 0001.6326.2718, valor més baix). Switch0-Central i Switch_3 utilitzen Fa0/1 com a port arrel. Tots els ports estan en estat Forwarding — no hi ha ports bloquejats ja que la topologia és en estrella sense bucles físics.
show spanning-tree — Switch0-Central
VLAN0099  Root: 0001.6326.2718 Cost 19 Port Fa0/3
  Fa0/4 Desg FWD  Fa0/1 Desg FWD
  Fa0/2 Desg FWD  Fa0/3 Root FWD

VLAN0101  Root: 0001.6326.2718 Cost 19 Port Fa0/3
  Fa0/4 Desg FWD  Fa0/1 Desg FWD
  Fa0/2 Desg FWD  Fa0/3 Root FWD

VLAN0102  Root: 0001.6326.2718 Cost 19 Port Fa0/3
  Fa0/4 Desg FWD  Fa0/1 Desg FWD
  Fa0/2 Desg FWD  Fa0/3 Root FWD

VLAN0103  Root: 0001.6326.2718 Cost 19 Port Fa0/3
  Fa0/4 Desg FWD  Fa0/6 Desg FWD
  Fa0/1 Desg FWD  Fa0/2 Desg FWD  Fa0/3 Root FWD

VLAN0104  Root: 0001.6326.2718 Cost 19 Port Fa0/3
  Fa0/4 Desg FWD  Fa0/5 Desg FWD
  Fa0/1 Desg FWD  Fa0/2 Desg FWD  Fa0/3 Root FWD
show spanning-tree — Switch_1
VLAN0099  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD

VLAN0101  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD  Fa0/2 Desg FWD

VLAN0102  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD  Fa0/3 Desg FWD

VLAN0103  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD  Fa0/4 Desg FWD

VLAN0104  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD
show spanning-tree — Switch_2 (Root Bridge)
VLAN0099  THIS BRIDGE IS THE ROOT
  Fa0/1 Desg FWD

VLAN0101  THIS BRIDGE IS THE ROOT
  Fa0/1 Desg FWD  Fa0/3 Desg FWD

VLAN0102  THIS BRIDGE IS THE ROOT
  Fa0/2 Desg FWD  Fa0/1 Desg FWD

VLAN0103  THIS BRIDGE IS THE ROOT
  Fa0/1 Desg FWD

VLAN0104  THIS BRIDGE IS THE ROOT
  Fa0/1 Desg FWD  Fa0/4 Desg FWD
show spanning-tree — Switch_3
VLAN0099  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD

VLAN0101  Root: 0001.6326.2718 Cost 38
  Fa0/3 Desg FWD  Fa0/1 Root FWD

VLAN0102  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD  Fa0/4 Desg FWD

VLAN0103  Root: 0001.6326.2718 Cost 38
  Fa0/1 Root FWD

VLAN0104  Root: 0001.6326.2718 Cost 38
  Fa0/2 Desg FWD  Fa0/1 Root FWD
08 Verificació de Connectivitat
Resultat: 4 paquets enviats · 4 paquets rebuts · 0% pèrdua en ambdues proves. La xarxa funciona correctament tant per a la comunicació dins de la mateixa VLAN com per a l’encaminament entre VLANs a través del router.
Ping mateixa VLAN 102
// Ping mateixa VLAN 102 · PC3 (192.168.102.2) → PC8 (192.168.102.3) · TTL=128
Ping VLAN diferent 102 → 101
// Ping inter-VLAN · PC8 (192.168.102.3) → PC4 (192.168.101.2) · Passa pel Router1 · TTL=127
Interpretació dels resultats
ProvaOrigenDestíTTLResultat
Mateixa VLAN (intra-VLAN) 192.168.102.2 192.168.102.3 128 ✓ 0% pèrdua
VLAN diferent (inter-VLAN) 192.168.102.3 192.168.101.2 127 ✓ 0% pèrdua

El TTL=127 (en lloc de 128) al ping inter-VLAN confirma que el paquet ha passat per un router (el Router1), que decrementa el TTL en 1 per cada salt. Això demostra que l’encaminament inter-VLAN funciona correctament a través de la tècnica Router-on-a-Stick.

TOP
🤖 Assistent d'Araceli Saldaña
Hola! 👋 Soc l'assistent virtual de l'Araceli Saldaña.
Pregunta'm qualsevol cosa sobre el seu portafolis SMX! 😊