Configurar i Posar en Marxa
els Switchos Principals
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.
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.
| VLAN | Nom | Xarxa | Gateway (Router) | Rang PCs |
|---|---|---|---|---|
| 99 | Administrador | 192.168.99.0/24 | 192.168.99.1 | Nativa — sense PCs |
| 101 | Recursos-Humans | 192.168.101.0/24 | 192.168.101.1 | .2 – .254 |
| 102 | Internacional | 192.168.102.0/24 | 192.168.102.1 | .2 – .254 |
| 103 | Trabajadors-interns | 192.168.103.0/24 | 192.168.103.1 | .2 – .254 |
| 104 | Trabajadors-externs | 192.168.104.0/24 | 192.168.104.1 | .2 – .254 |
| Switch | Port | Mode | VLAN | Funció |
|---|---|---|---|---|
| Switch0-Central | Fa0/1 | Trunk | 99,101-104 | → Router |
| Switch0-Central | Fa0/2–4 | Trunk | 99,101-104 | → Sw1, Sw2, Sw3 |
| Switch0-Central | Fa0/5 | Access | 104 | PC Trabajadors-externs |
| Switch0-Central | Fa0/6 | Access | 103 | PC Trabajadors-interns |
| Switch_1 | Fa0/1 | Trunk | 99,101-104 | → SW-Core |
| Switch_1 | Fa0/2 | Access | 101 | PC Recursos-Humans |
| Switch_1 | Fa0/3 | Access | 102 | PC Internacional |
| Switch_1 | Fa0/4 | Access | 103 | PC Trabajadors-interns |
| Switch_2 | Fa0/1 | Trunk | 99,101-104 | → SW-Core |
| Switch_2 | Fa0/2 | Access | 102 | PC Internacional |
| Switch_2 | Fa0/3 | Access | 101 | PC Recursos-Humans |
| Switch_2 | Fa0/4 | Access | 104 | PC Trabajadors-externs |
| Switch_3 | Fa0/1 | Trunk | 99,101-104 | → SW-Core |
| Switch_3 | Fa0/2 | Access | 104 | PC Trabajadors-externs |
| Switch_3 | Fa0/3 | Access | 101 | PC Recursos-Humans |
| Switch_3 | Fa0/4 | Access | 102 | PC Internacional |
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 !
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
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
| Prova | Origen | Destí | TTL | Resultat |
|---|---|---|---|---|
| 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.
