A3. Administració bàsica
torna M7 - UF2 Administració de dispositius de xarxa
Contingut
Spanning – Tree
STP (Spanning-Tree Protocol), permet crear topologies lògiques no redundants (sense loops) en topologies físiques redundants.
Una topologia redundant, on existeix un o més cicles, generen tempestes de broadcast.
- Una xarxa sense redundància té múltiples punts de falla. Per tant és una xarxa no confiable.
- Una xarxa redundant permet recuperar-la en cas de falla utilitzant un camí alternatiu.
Per contra la gestió de la redundància també implica l’ús de certs recursos (CPU, ample de banda)
Problemes que cal solucionar:
- Tempestes de broadcast
- Múltiples còpies de trames unicast
- Taula MAC inestable. Vàries còpies mateixa trama diferents ports.
El protocol STP sobre una xarxa física redundant, desactiva certs ports per obtenir
- Una topologia lògica sense redundància.
- Una xarxa amb les rutes més curtes. Basada en els costos acumulatius dels enllaços, segons la velocitat d’aquests.
Els commutadors es comuniquen entre ells i decideixen quin serà el Root (Arrel de l'arbre de la topologia sense redundàncies). L'elecció és basa en el identificador de Pont (Bridge ID = Prioritat + adreça MAC). El que té el BID més baix serà el root, tot i que també es pot forçar a un dels commutadors.
Així cada Switch té ports actius i port bloquejats.
En cas de falla d’un dels ports, automàticament el protocol activa / descativa els ports necessaris.
Actualment s’ha desenvolupat un nou algoritme rapid spanning-tree amb un menor temps de convergència.
Spannig tree s'activa a les xarxes virtuals (VLAN's) no a les interfases físiques. Per defecte està actiu (protocol STP)
Switch#show spanning-tree Switch(config)#spanning-tree vlan 1 root primary Switch(config)#spanning-tree mode rapid-pvst Switch(config)#spanning-tree mode pvst // Per defecte Switch(config)#no spanning-tree vlan 1 // Desactivar spanning tree per una vlan
Amb l'STP actiu els commutadors estan constantment comunicant-se. Primerament escolleixen el commutador arrel i després monitoritzen possibles canvis a la topologia per prendre les mesures oportunes.
El protocol assigna a cada port dels commutadors diferents rols i un cost en funció de la velocitat d'aquests (major velocitat menor cost).
- Designat: ports normals
- Arrel: màxim un per commutador, és el port cap al commutador arrel
- Alternatiu (Estat bloquejat)
Per exemple
- Ports FastEthernet tenen cost 19
- Ports GigaEthernet tenen cost 4
Switch#sh spanning-tree VLAN0001 Spanning tree enabled protocol rstp Root ID Priority 32769 Address 0001.4220.C76D Cost 8 Port 25(GigabitEthernet0/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0006.2AD7.45C3 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/1 Desg FWD 19 128.1 P2p Gi0/1 Root FWD 4 128.25 P2p Gi0/2 Altn BLK 4 128.26 P2p Switch#
A la informació del STP del commutador arrel veurem el missatge This bridge is the root
Switch#sh spanning-tree VLAN0001 Spanning tree enabled protocol rstp Root ID Priority 32769 Address 0001.4220.C76D This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0001.4220.C76D Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Gi0/1 Desg FWD 4 128.25 P2p Gi0/2 Desg FWD 4 128.26 P2p Fa0/1 Desg FWD 19 128.1 P2p
Si seguim els ports root dels diferents dispositius veurem l'arbre de cost mínim resultant del STP.
Spanning Tree Song (Radia Perlman) https://www.youtube.com/watch?v=iE_AbM8ZykI
http://www.the-evangelist.info/2010/04/ccnp-switch-8-configuracion-de-spanning-tree/
Gestió Taula d'adreces del switch
El commutador manté una taula amb la relació d'adreces MAC detectades a cadascun del seus ports per segmentar el tràfec de la xarxa. La taula d’adreces MAC es gestiona dinàmicament, les entrades caduquen als 300 segons.
També es poden definir entrades estàtiques, les avantatges són:
- No expiren.
- Milloren la seguretat.
- Permeten connectar un servidor per exemple.
Switch>show mac-address-table Switch#clear mac- mac-address-table
Configuració estàtica taula MAC
Consisteix en establir les adreces estàtiques a la taula MAC (Millora rendiment, el temps de convergència del dispositiu).
Switch(config)# mac-address-table static <mac-address of host> vlan <vlan name> interface FastEthernet <Ethernet number>
Es pot observar que aquestes adreces s'afegeixen indicant STATIC. No caduquen i es mantenen encara que el dispositiu es reiniciï.
SW1#sh mac-a Mac Address Table ------------------------------------------- Vlan Mac Address Type Ports ---- ----------- -------- ----- 1 0001.0001.0001 STATIC Fa0/24 1 0001.64cd.ac19 DYNAMIC Gig0/1 1 0010.0010.0010 STATIC Gig0/1
Seguretat
L’accés físic a una xarxa pot suposar un problema de seguretat, qualsevol persona que pot connectar un ordinador a un Switch hi té accés. Per això es poden implementar alguns sistemes de seguretat per port.
- Especificat client MAC (segur) per un port determinat, només aquestes es podran connectar a port corresponent.
- Limitar el nombre de dispositius segurs per port
- Indicar una acció en cas que es violi el client segur:
- restrict restringir (drop packets, avis administrador/syslog i incrementa comptador)
- protect protegir (drop paquets, no incrementa comptador)
- shutdown aturar la interfase (incrementa comptador)
Switch#show mac-address-table Switch#clear mac-address-table Switch(config)#interface FastEthernet 0/1 Switch(config-if)#switchport mode access // No troncal Switch(config-if)#switchport port-security ? mac-address Secure mac address maximum Max secure addresses violation Security violation mode <cr> Switch(config-if)#switchport port-security mac-address ? H.H.H 48 bit mac address sticky Configure dynamic secure addresses as sticky Switch(config-if)#switchport port-security mac-address 0001.0001.0001 Switch(config-if)#switchport port-security maximum 1 Switch(config-if)#switchport port-security violation restrict Switch(config-if)#switchport port-security // ACTIVAR SEGURETAT
Algunes comandes de comprovació
Switch#show port-security Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security Action (Count) (Count) (Count) -------------------------------------------------------------------- Fa0/24 2 2 0 Shutdown ---------------------------------------------------------------------- Switch#show port-security interface fastEthernet 0/2 Port Security : Enabled Port Status : Secure-up Violation Mode : Shutdown Aging Time : 0 mins Aging Type : Absolute SecureStatic Address Aging : Disabled Maximum MAC Addresses : 2 Total MAC Addresses : 2 Configured MAC Addresses : 1 Sticky MAC Addresses : 1 Last Source Address:Vlan : 0010.1183.1E19:1 Security Violation Count : 0 Switch#clear port-security all // Esborra adreces MAC configurades port segur
Per tornar a activar una interfase desactivada per seguretat (shutdown + no shutdown)
Les configuracions mac estàtica i seguretat de port són mútuament exclusives
Nivells de privilegis
Per defecte
EXEC (mode usuari) nivell 1 EXEC privilegiat i configuracions específiques nivell 15
No és habitual però es podrien canviar els nivells de seguretat de les configuracions específiques (Per defecte 15)
Switch> show privilege Current privilege level is 1
Switch# show privilege Current privilege level is 15
Bonding - Link Aggregation - EtherChannel - 802.3ad.
http://en.wikipedia.org/wiki/Channel_bonding
http://en.wikipedia.org/wiki/Link_aggregation
Protocols d'agregació
- Port Aggregation Protocol (PAgP) --> Propietari CISCO
- Link Aggregation Control Protocol (LACP) --> Estàndard IEEE 802.3ad (IEEE 802.1ax revisió 2014)
Etherchannel
Consisteix en l'agregació d'enllaços que actuen com una unitat ( channel-group ). Conjunt d'enllaços agrupats perquè funcionin com un únic enllaç lògic ( port-channel logical interface ) amb les prestacions acumulades de tots ells, permet
- Incrementar la velocitat
- Millorar la tolerància a falles
Fins a 8 ports Ethernet actius per cada grup (LACP permet fins a 16, de 9 a 16 es mantenen inactius) Fins a 6 grups ( channel-group ) per commutador
Poden treballar en 3 modes (protocols) diferents:
- Port Aggregation Protocol (PAgP) => protocol propietari de CISCO
- Link Aggregation Control Protocol (LACP) => protocol IEEE 802.3ad
- Mode on => Només Etherchannel
Possibles esquemes:
- single-switch EtherChannel => PAgP. Canal de switch a switch.
- Cross-Stack EtherChannel=> Canal de switch a diferents commutadors dins un stack.
Single-Switch EtherChannel
Cross-Stack EtherChannel
Tots els ports del grup han de funcionar a la mateixa velocitat i dúplex.
Des del moment que es crear la nova interfície lògica (port-channel), totes les configuracions s'han d'aplicar en aquesta en comptes de fer-ho als ports individuals que la componen (Spanning Tree, VLAN, 802.1q ...).
La interfície lògica s'assigna la MAC del primer dels ports que s'activi.
El trànsit és balancejat entre els diferents ports del grup en funció de les adreces MAC o IP, origen o destí.
En cas de falla d'un port (shutdown) el servei es manté, el trànsit es reparteix entre la resta de ports actius.
Es pot assignar diferents prioritats als ports del grup per ponderar la participació de cadascun al grup (Menor prioritat major participació).
Configuració
PAgP modes:
- auto => negociació passiva, rep però no inicia negociacions (redueix l'intercanvi de dades)
- desirable => negociació activa
LACP modes:
- passive => negociació activa
- active => negociació passiva, rep però no inicia negociacions (redueix l'intercanvi de dades)
Mode on => no hi ha negociació, els dos extrems han d'estar en mode on
Per tant les possibles combinacions de configuracions dels modes a cada extrem de l'enllaç agregat són:
- Mode actiu a Mode actiu (Ambdós usant el mateix protocol)
- Mode passiu a Mode actiu (Ambdós usant el mateix protocol)
- Mode On a Mode On
Comandes de configuració
Switch(config)#interface range fastEthernet 0/1-8 Switch(config-if-range)#channel-group 1 mode desirable Switch(config-if-range)#channel-protocol pagp Switch(config)#interface port-channel 1 Switch(config-if)#? arp Set arp type (arpa, probe, snap) or timeout bandwidth Set bandwidth informational parameter ... Switch(config)#port-channel load-balance ? dst-ip Dst IP Addr dst-mac Dst Mac Addr => dades destinades a hosts diferents per ports diferents, dades destinades al mateix host pel mateix port src-dst-ip Src XOR Dst IP Addr src-dst-mac Src XOR Dst Mac Addr src-ip Src IP Addr src-mac Src Mac Addr => dades de hosts diferents per ports diferents, dades del mateix host pel mateix port
Comandes de verificació
Switch#show etherchannel ? load-balance Load-balance/frame-distribution scheme among ports in port-channel port-channel Port-channel information summary One-line summary per channel-group <cr> Switch#sh interfaces etherchannel ---- FastEthernet0/1: Port state = 1 Channel group = 1 Mode = Desirable-S1 Gcchange = 0 Port-channel = Po1 GC = 0x00000000 Pseudo port-channel = Po1 Port index = 0 Load = 0x00 Protocol = PAgP Flags: S - Device is sending Slow hello. C - Device is in Consistent state. A - Device is in Auto mode. P - Device learns on physical port. d - PAgP is down. Timers: H - Hello timer is running. Q - Quit timer is running. S - Switching timer is running. I - Interface timer is running. Local information: Hello Partner PAgP Learning Group Port Flags State Timers Interval Count Priority Method Ifindex Fa0/1 d U1/S1 H30s 1 0 128 Any 0 Age of the port in the current state: 00d:00h:08m:24s ---- FastEthernet0/2: ... Switch#sh interfaces port-channel 2/status
Mirrored / Spanned Ports
http://en.wikipedia.org/wiki/Port_mirroring
- source => element monitoritzat
- destination => element que monitoritza
Es pot monitoritzar el trànsit per un port, una vlan (VSPAN) o un port remot (RSPAN)
Switch(config)#monitor session 1 source ? interface SPAN source or destination interface remote RSPAN vlan SPAN source or destination VLAN Switch(config)#monitor session 1 destination ? interface SPAN source or destination interface remote RSPAN Switch(config)#monitor session 1 source interface fastEthernet 0/1 Switch(config)#monitor session 1 destination interface fastEthernet 0/2
També es pot indicar quin trànsit cal monitoritzar: entrada, sortida o ambdos
Switch(config)#monitor session 1 source interface fastEthernet 0/1 ? , comma - hyphen both SPAN copies both egress and ingress traffic rx SPAN copies only ingress traffic tx SPAN copies only egress traffic <cr>
Per verificar la configuració
Switch#show monitor ? detail SPAN details session SPAN session information and configuration | Output Modifiers <cr>