Diferència entre revisions de la pàgina «A3. Administració bàsica»

De Wiki IES Marianao. Departament Informàtica
Dreceres ràpides: navegació, cerca
(Etherchannel)
 
(Hi ha 32 revisions intermèdies del mateix usuari que no es mostren)
Línia 1: Línia 1:
torna [[M7_-_Planificació_i_administració_de_xarxes#UF2_.E2.80.93_Administraci.C3.B3_de_dispositius_de_xarxa | M7 - UF2 Administració de dispositius de xarxa]]
+
torna [[ M7 - Planificació i administració de xarxes ]]
  
 +
 +
==  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)
 +
 +
<html><pre><code class="cisco">
 +
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
 +
</code></pre></html>
 +
 +
 +
 +
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
 +
 +
 +
<html><pre><code class="cisco">
 +
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#
 +
</code></pre></html>
 +
 +
 +
A la informació del STP del commutador arrel veurem el missatge  '''This bridge is the root'''
 +
 +
<html><pre><code class="cisco">
 +
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
 +
</code></pre></html>
 +
 +
Si seguim els ports '''root''' dels diferents dispositius veurem l'arbre de cost mínim resultant del STP.
 +
 +
 +
 +
<b>Spanning Tree Song (Radia Perlman)</b>
 +
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.
 +
 +
 +
<html><pre><code class="cisco">
 +
Switch#show mac-address-table          <= legacy
 +
Switch#show mac address-table          <= IOS >= 15
 +
Switch#clear mac address-table
 +
</code></pre></html>
 +
 +
 +
 +
També es poden definir entrades estàtiques, les avantatges són:
 +
 +
* No expiren.
 +
* Milloren la seguretat.
 +
* Permeten connectar un servidor per exemple.
 +
 +
 +
 +
 +
=== 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).
 +
 +
<html><pre><code class="cisco">
 +
Switch(config)# mac-address-table static [mac-address of host] vlan [vlan name] interface FastEthernet [Ethernet number]
 +
</code></pre></html>
 +
 +
 +
Es pot observar que aquestes adreces s'afegeixen indicant '''STATIC'''. No caduquen i es mantenen encara que el dispositiu es reiniciï.
 +
 +
<html><pre><code class="cisco">
 +
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
 +
</code></pre></html>
  
 
== Seguretat ==
 
== Seguretat ==
Línia 8: Línia 179:
  
  
*Establir les adreces estàtiques a la taula MAC (Millora rendiment).
 
 
*Especificat client MAC (segur) per un port determinat, només aquestes es podran connectar a port corresponent.
 
*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
 
*Limitar el nombre de dispositius ''segurs'' per port
*Indicar una acció en cas que es violi el client segur: restringir (drop packets, avis administrador/syslog i incrementa comptador), protegir (drop paquets, no incrementa comtpador) o aturar la interfase (incrementa comtpador)
+
*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)
  
  
<pre>
+
<html><pre><code class="cisco">
Switch(config)# mac-address-table static <mac-address of host> vlan <vlan name> interface FastEthernet <Ethernet number>
 
 
 
 
Switch#show mac-address-table
 
Switch#show mac-address-table
  
Línia 25: Línia 196:
 
Switch(config-if)#switchport mode access  // No troncal
 
Switch(config-if)#switchport mode access  // No troncal
  
Switch(config-if)#switchport port-security ...
+
Switch(config-if)#switchport port-security ?
 +
  mac-address  Secure mac address
 +
  maximum      Max secure addresses
 +
  violation    Security violation mode
 +
  &lt;cr&gt;
 +
 
 +
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
 +
</code></pre></html>
  
Switch#show port-security
+
Algunes comandes de comprovació
 +
 
 +
<html><pre><code class="cisco">
 +
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
 
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
 
Switch#clear port-security all  // Esborra adreces MAC configurades port segur
  
</pre>
+
</code></pre></html>
  
 
Per tornar a activar una interfase desactivada per seguretat (shutdown + no shutdown)
 
Per tornar a activar una interfase desactivada per seguretat (shutdown + no shutdown)
Línia 39: Línia 245:
 
'''Les configuracions mac estàtica i seguretat de port són mútuament exclusives'''
 
'''Les configuracions mac estàtica i seguretat de port són mútuament exclusives'''
  
 +
== Sincronització horària NTP ==
 +
 +
Al servidor del Packet Tracer activar servei NTP (opcionalment amb autenticació)
 +
 +
 +
Configuració per defecte, la hora configurada al maquinari
 +
 +
<html><pre><code class="cisco">
 +
Switch#show clock
 +
*0:3:22.288 UTC Mon Mar 1 1993
 +
 +
Switch#show clock detail
 +
*0:3:23.956 UTC Mon Mar 1 1993
 +
Time source is hardware calendar
 +
 +
 +
Switch#show ntp status ?
 +
  <cr>
 +
Switch#show ntp status
 +
%NTP is not enabled.
 +
</code></pre></html>
 +
 +
 +
Cal establir adreçament IP al commutador
  
=== Nivells de privilegis ===
+
<html><pre><code class="cisco">
 +
Switch(config)#interface vlan 1
 +
Switch(config-if)#ip address 192.168.10.100 255.255.255.0
 +
Switch(config-if)#no shutdown
 +
</code></pre></html>
  
Per defecte
+
Configuració per sincronitzar l'hora amb el servidor
 +
 
 +
<html><pre><code class="cisco">
 +
Switch(config)#ntp ?
 +
  authenticate        Authenticate time sources
 +
  authentication-key  Authentication key for trusted time sources
 +
  master              Act as NTP master clock
 +
  server              Configure NTP server
 +
  trusted-key        Key numbers for trusted time sources
 +
 
 +
Switch(config)#ntp server 192.168.10.10
 +
Switch(config)#exit
 +
</code></pre></html>
 +
 
 +
 
 +
Comprovacions
 +
 
 +
<html><pre><code class="cisco">
 +
Switch#sh clock detail
 +
17:53:6.595 UTC Fri Feb 10 2023
 +
Time source is NTP
 +
 
 +
 
 +
Switch#sh ntp status
 +
Clock is synchronized, stratum 2, reference is 192.168.10.10
 +
nominal freq is 250.0000 Hz, actual freq is 249.9990 Hz, precision is 2**24
 +
reference time is FFFFFFFFE7682499.0000009B (17:53:29.155 UTC Fri Feb 10 2023)
 +
clock offset is 0.00 msec, root delay is 0.00  msec
 +
root dispersion is 21.88 msec, peer dispersion is 0.12 msec.
 +
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is - 0.000001193 s/s system poll interval is 5, last update was 17 sec ago.
 +
 
 +
Switch#sh ntp associations
 +
 
 +
address        ref clock      st  when    poll    reach  delay          offset            disp
 +
*~192.168.10.10 127.127.1.1    1    14      16      377    0.00          0.00              0.12
 +
* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
 +
Switch#
 +
</code></pre></html>
  
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
+
== Bonding - Link Aggregation - EtherChannel - 802.3ad. ==
Current privilege level is 1
 
  
Switch# show privilege
+
http://en.wikipedia.org/wiki/Channel_bonding
Current privilege level is 15
 
  
==  Spanning – Tree ==
+
http://en.wikipedia.org/wiki/Link_aggregation
  
 +
Protocols d'agregació
  
STP (Spanning-Tree Protocol), permet crear topologies lògiques no redundants (sense loops) en topologies físiques redundants.
+
*Port Aggregation Protocol (PAgP) --> Propietari CISCO
 +
*Link Aggregation Control Protocol (LACP) --> Estàndard  IEEE 802.3ad  (IEEE 802.1ax revisió 2014)
  
  
Una topologia redundant, on existeix un o  més cicles, generen '''tormentes de broadcast'''.
+
=== 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
  
*Una xarxa sense redundància té múltiples punts de falla. Per tant és una xarxa '''no confiable'''.
+
* Incrementar la velocitat
*Una xarxa redundant permet recuperar-la en cas de falla utilitzant un camí alternatiu.
+
* 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
  
Per contra la gestió de la redundància també implica l’ús de certs recursos (CPU, ample de banda)
+
[[Fitxer:Gigabit_etherchannel.jpg]]
  
  
Problemes que cal solucionar:
+
Poden treballar en 3 modes (protocols) diferents:
  
* Tormenta de broadcast
+
*Port Aggregation Protocol (PAgP) => protocol propietari de CISCO
* Múltiples còpies de trames unicast
+
*Link Aggregation Control Protocol (LACP) => protocol IEEE 802.3ad
* Taula MAC inestable. Vàries còpies mateixa trama diferents ports.
+
*Mode on => Només Etherchannel
  
  
El protocol STP sobre una xarxa física redundant, desactiva certs ports per obtenir
+
Possibles esquemes:
 +
* single-switch EtherChannel => PAgP. Canal de switch a switch.
 +
* Cross-Stack EtherChannel=> Canal de switch a diferents commutadors dins un stack.
  
* Una topologia lògica sense redundància.
+
'''Single-Switch EtherChannel'''
* Una xarxa amb les rutes més curtes. Basada en els costos acumulatius dels enllaços, segons la velocitat d’aquests.
 
  
 +
[[Fitxer:Single-switch-etherchannel.jpg]]
  
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 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.
+
'''Cross-Stack EtherChannel'''
  
En cas de falla d’un dels ports, automàticament el protocol activa / descativa els ports necessaris.
+
[[Fitxer:Cross-stack-etherchannel.jpg]]
  
Actualment s’ha desenvolupat un nou algoritme ''rapid spanning-tree'' amb un menor temps de convergència.
+
Tots els ports del grup han de funcionar a la '''mateixa velocitat i dúplex'''.
  
Spannig tree s'activa a les xarxes virtuals (VLAN's) no a les interfases físiques. Per defecte està actiu (protocol STP)
+
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 ...).
  
<pre>
+
La interfície lògica s'assigna la MAC del primer dels ports que s'activi.
Switch#show spanning-tree
 
  
Switch(config)#spanning-tree vlan 1 root primary
+
El '''trànsit és balancejat entre els diferents ports''' del grup en funció de les adreces MAC o IP, origen o destí.
  
Switch(config)#spanning-tree mode rapid-pvst
+
En cas de falla d'un port (shutdown) el servei es manté, el trànsit es reparteix entre la resta de ports actius.
  
Switch(config)#spanning-tree mode pvst  // Per defecte
+
Es pot assignar diferents prioritats als ports del grup per ponderar la participació de cadascun al grup (Menor prioritat major participació).
  
Switch(config)#no spanning-tree vlan 1  // Desactivar spanning tree per una vlan
+
=== Configuració ===
</pre>
 
  
 +
https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_53_se/configuration/guide/2960scg/swethchl.html
  
http://www.the-evangelist.info/2010/04/ccnp-switch-8-configuracion-de-spanning-tree/
+
PAgP modes:  
 +
* auto => negociació passiva, rep però no inicia negociacions (redueix l'intercanvi de dades)
 +
* desirable => negociació activa
  
== Bonding - Link Aggregation - 802.3ad. ==
+
LACP modes:
 +
* passive => negociació activa
 +
* active => negociació passiva, rep però no inicia negociacions (redueix l'intercanvi de dades)
  
http://en.wikipedia.org/wiki/Channel_bonding
+
Mode on  => no hi ha negociació, els dos extrems han d'estar en mode on
  
http://en.wikipedia.org/wiki/Link_aggregation
+
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
  
Protocols d'agregació
 
  
*Port Aggregation Protocol (PAgP) --> Propietari CISCO
+
Comandes de configuració
  
*Link Aggregation Control Protocol (LACP) --> Estàndard  IEEE 802.1ax / 802.3ad
+
<html><pre><code class="cisco">
 +
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
 +
  ...
  
=== Etherchannel ===
+
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
 +
</code></pre></html>
  
Els enllaços agregats s'anomenen Fast EtherChannel (FEC) or Gigabit EtherChannel (GEC)
 
  
http://www.cisco.com/en/US/docs/switches/lan/catalyst2950/software/release/12.1_19_ea1/configuration/guide/swethchl.html
+
Comandes de verificació
http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_25_see/configuration/guide/swethchl.html
+
<html><pre><code class="cisco">
 +
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>
  
Modes Etherchannel:
 
  
* LACP :Active / Passive  en funció si inicia negociació o no  (IEEE 802.1ax)
+
Switch#sh interfaces etherchannel
* PAgP
+
----
** Auto / Desirable  en funció si inicia negociació o no   (Propietary de CISCO)
+
FastEthernet0/1:
** on : Els dos canals han d'estar en aquest mode
+
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.
  
Switch# configure terminal
+
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
  
Switch(config)# interface range gigabitethernet 1/1-2
+
Age of the port in the current state:  00d:00h:08m:24s
  
Switch(config-if-range)# channel-group 5 mode {active | passive | auto | desirable }
+
----
 +
FastEthernet0/2:
 +
...
  
Switch(config-if-range)# channel-protocol { lacp | pagp }
 
  
Switch(config-if-range)# end
+
Switch#sh interfaces port-channel 2/status
 +
</code></pre></html>
  
Switch# show interface etherchannel
 
  
Switch# show etherchannel
+
== Nivells de privilegis ==
  
Switch#show etherchannel summary
+
Per defecte
  
Load Balance:
+
EXEC (mode usuari) nivell 1
* Per MAC origen (default): Diferents origens van per diferents ports. Mateix origen pel mateix port
+
EXEC privilegiat i configuracions específiques nivell 15
* Per MAC destí: Diferents destins van per diferents ports. Mateix destí pel mateix port
 
  
Switch(config)# port-channel load-balance src-mac
+
No és habitual però es podrien canviar els nivells de seguretat de les configuracions específiques (Per defecte 15)
  
Switch#show etherchannel load-balance
+
<html><pre><code class="cisco">
 +
Switch> show privilege
 +
Current privilege level is 1
  
Switch# show etherchannel
+
Switch# show privilege
 +
Current privilege level is 15
 +
</code></pre></html>
  
 
== Mirrored / Spanned Ports ==
 
== Mirrored / Spanned Ports ==
Línia 167: Línia 478:
 
http://en.wikipedia.org/wiki/Port_mirroring
 
http://en.wikipedia.org/wiki/Port_mirroring
  
 +
https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_40_se/configuration/guide/scg/swspan.pdf
 +
 +
 +
* source => element monitoritzat
 +
* destination => element que monitoritza
 +
 +
Es pot monitoritzar el trànsit per un port, una vlan (VSPAN) o un port remot (RSPAN)
 +
 +
 +
<html><pre><code class="cisco">
 +
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
 +
</code></pre></html>
 +
 +
 +
També es pot indicar quin trànsit cal monitoritzar: entrada, sortida o ambdos
 +
 +
 +
<html><pre><code class="cisco">
 +
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
 +
  &lt;cr&gt;
 +
</code></pre></html>
 +
 +
 +
Per verificar la configuració
 +
 +
<html><pre><code class="cisco">
 +
Switch#show monitor ?
 +
  detail  SPAN details
 +
  session  SPAN session information and configuration
 +
  |        Output Modifiers
 +
  &lt;cr&gt;
 +
</code></pre></html>
  
 
== Preu? ==
 
== Preu? ==
  
 
http://www.cisco.com/web/ES/solutions/smb/products/routers_switches/catalyst_2960_series_switches/index.html#~models
 
http://www.cisco.com/web/ES/solutions/smb/products/routers_switches/catalyst_2960_series_switches/index.html#~models

Revisió de 02:58, 21 ago 2024

torna M7 - Planificació i administració de xarxes


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.



Switch#show mac-address-table          <= legacy
Switch#show mac address-table          <= IOS >= 15
Switch#clear mac address-table


També es poden definir entrades estàtiques, les avantatges són:

  • No expiren.
  • Milloren la seguretat.
  • Permeten connectar un servidor per exemple.



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

Sincronització horària NTP

Al servidor del Packet Tracer activar servei NTP (opcionalment amb autenticació)


Configuració per defecte, la hora configurada al maquinari


Switch#show clock 
*0:3:22.288 UTC Mon Mar 1 1993

Switch#show clock detail 
*0:3:23.956 UTC Mon Mar 1 1993
Time source is hardware calendar


Switch#show ntp status ?
  
Switch#show ntp status 
%NTP is not enabled.


Cal establir adreçament IP al commutador


Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.10.100 255.255.255.0
Switch(config-if)#no shutdown 

Configuració per sincronitzar l'hora amb el servidor


Switch(config)#ntp ?
  authenticate        Authenticate time sources
  authentication-key  Authentication key for trusted time sources
  master              Act as NTP master clock
  server              Configure NTP server
  trusted-key         Key numbers for trusted time sources

Switch(config)#ntp server 192.168.10.10 
Switch(config)#exit


Comprovacions


Switch#sh clock detail 
17:53:6.595 UTC Fri Feb 10 2023
Time source is NTP


Switch#sh ntp status 
Clock is synchronized, stratum 2, reference is 192.168.10.10
nominal freq is 250.0000 Hz, actual freq is 249.9990 Hz, precision is 2**24
reference time is FFFFFFFFE7682499.0000009B (17:53:29.155 UTC Fri Feb 10 2023)
clock offset is 0.00 msec, root delay is 0.00  msec
root dispersion is 21.88 msec, peer dispersion is 0.12 msec.
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is - 0.000001193 s/s system poll interval is 5, last update was 17 sec ago.

Switch#sh ntp associations 

address         ref clock       st   when     poll    reach  delay          offset            disp
*~192.168.10.10 127.127.1.1     1    14       16      377    0.00           0.00              0.12
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
Switch#


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

Gigabit etherchannel.jpg


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

Single-switch-etherchannel.jpg


Cross-Stack EtherChannel

Cross-stack-etherchannel.jpg

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ó

https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_53_se/configuration/guide/2960scg/swethchl.html

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
  


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


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

Mirrored / Spanned Ports

http://en.wikipedia.org/wiki/Port_mirroring

https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_40_se/configuration/guide/scg/swspan.pdf


  • 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>

Preu?

http://www.cisco.com/web/ES/solutions/smb/products/routers_switches/catalyst_2960_series_switches/index.html#~models