Il sera abordé :
- la configuration de VLAN
- l’affectation de ports (nommées interfaces) à un VLAN
- l’activation ou la désactivation des ports (interfaces)
- L’agrégation de liens ou port channel
I Visualiser la configuration VLAN
Pour visualiser les VLAN configurés il faut utiliser la commande « show vlan » :
Switch_01#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Ainsi on remarque que la VLAN n°1 contient par défaut tous les ports du switch.
Un port est nommé Fa0/1, FA0/2, etc… FA pour FastEthernet et 0/1, 0/2 … pour l’emplacement physique du port.
Ainsi ce swicth possède :
- 24 ports Ethernet
- 2 ports en Giga Ethernet
Et pour avoir un état des ports général : show interfaces status
Switch_01#show interfaces status
Port Name Status Vlan Duplex Speed Type
Fa0/1 connected 1 auto auto 10/100BaseTX
Fa0/2 connected 1 auto auto 10/100BaseTX
Fa0/3 notconnect 1 auto auto 10/100BaseTX
Fa0/4 notconnect 1 auto auto 10/100BaseTX
Fa0/5 notconnect 1 auto auto 10/100BaseTX
Fa0/6 notconnect 1 auto auto 10/100BaseTX
Fa0/7 notconnect 1 auto auto 10/100BaseTX
Fa0/8 notconnect 1 auto auto 10/100BaseTX
Fa0/9 notconnect 1 auto auto 10/100BaseTX
Fa0/10 notconnect 1 auto auto 10/100BaseTX
Fa0/11 notconnect 1 auto auto 10/100BaseTX
Fa0/12 notconnect 1 auto auto 10/100BaseTX
Fa0/13 notconnect 1 auto auto 10/100BaseTX
Fa0/14 notconnect 1 auto auto 10/100BaseTX
Fa0/15 notconnect 1 auto auto 10/100BaseTX
Fa0/16 notconnect 1 auto auto 10/100BaseTX
Fa0/17 notconnect 1 auto auto 10/100BaseTX
Fa0/18 notconnect 1 auto auto 10/100BaseTX
Fa0/19 notconnect 1 auto auto 10/100BaseTX
Fa0/20 notconnect 1 auto auto 10/100BaseTX
Fa0/21 notconnect 1 auto auto 10/100BaseTX
Fa0/22 notconnect 1 auto auto 10/100BaseTX
Fa0/23 notconnect 1 auto auto 10/100BaseTX
Fa0/24 notconnect 1 auto auto 10/100BaseTX
Gig0/1 connected 1 auto auto 10/100BaseTX
Gig0/2 connected 1 auto auto 10/100BaseTX
Donc en première conclusion : le switch est utilisable sans configuration particulière. Tous les ports sont dans le VLAN 1 et communique entre eux.
II Première configuration
Afin de maitriser la sécurité de son switch nous allons :
- désactiver tous les ports ;
- créer un vlan dédié au PC de travail qui se nommera « clients ». Ensuite nous y affecterons 2 ports ;
- créer un vlan de « stockage » autre que le VLAN 1.
II.1 blocage des ports
Blocage d’un port :
Switch_01>enable
Switch_01#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch_01(config)#interface fastEthernet 0/1
Switch_01(config-if)#
A ce stade nous sommes dans le mode de configuration d’un port (ici le port FA0/1)
Les commandes disponibles sont les suivantes :
Switch_01(config-if)#?
cdp Global CDP configuration subcommands
channel-group Etherchannel/port bundling configuration
channel-protocol Select the channel protocol (LACP, PAgP)
description Interface specific description
duplex Configure duplex operation.
exit Exit from interface configuration mode
ip Interface Internet Protocol config commands
lldp LLDP interface subcommands
mdix Set Media Dependent Interface with Crossover
mls mls interface commands
no Negate a command or set its defaults
shutdown Shutdown the selected interface
spanning-tree Spanning Tree Subsystem
speed Configure speed operation.
storm-control storm configuration
switchport Set switching mode characteristics
tx-ring-limit Configure PA level transmit ring limit
Pour ne plus rendre utilisable le port FA0/1 on utilisera la commande « shutdown » :
Switch_01(config-if)#shutdown
Switch_01(config-if)#end
Vérification :
Switch_01#show interfaces status
Port Name Status Vlan Duplex Speed Type
Fa0/1 disabled 1 auto auto 10/100BaseTX
Fa0/2 connected 1 auto auto 10/100BaseTX
Fa0/3 notconnect 1 auto auto 10/100BaseTX
Fa0/4 notconnect 1 auto auto 10/100BaseTX
Fa0/5 notconnect 1 auto auto 10/100BaseTX
Fa0/6 notconnect 1 auto auto 10/100BaseTX
Fa0/7 notconnect 1 auto auto 10/100BaseTX
...
Le port FA01 est bien désactivé. Le PC branché dessus ne peux plus communiquer.
Pour pouvoir bloquer tous les ports en une seule fois il faudra utiliser la commande « range »
Switch_01#conf t
Switch_01(config)# interface range FastEthernet 0/1 - 24
Switch_01(config-if-range)#
A ce stade tous les ports de FA0/1 à FA0/24 ont été sélectionnés. Nous allons maintenant les désactiver :
Switch_01(config-if-range)#shutdown
Vérification :
Switch_01# show interfaces status
Port Name Status Vlan Duplex Speed Type
Fa0/1 disabled 1 auto auto 10/100BaseTX
Fa0/2 disabled 1 auto auto 10/100BaseTX
Fa0/3 disabled 1 auto auto 10/100BaseTX
Fa0/4 disabled 1 auto auto 10/100BaseTX
Fa0/5 disabled 1 auto auto 10/100BaseTX
Fa0/6 disabled 1 auto auto 10/100BaseTX
Fa0/7 disabled 1 auto auto 10/100BaseTX
Fa0/8 disabled 1 auto auto 10/100BaseTX
Fa0/9 disabled 1 auto auto 10/100BaseTX
Fa0/10 disabled 1 auto auto 10/100BaseTX
...
A ce stade tous les ports FastEthernet ne sont plus utilisables.
II.2 Affection de 2 ports à un VLAN spécifique
Avant d’affecter un port à un VLAN, il faut le créer. Il portera le numéro (id) 20 et on le nommera « clients »
Switch_01#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch_01(config)#vlan 20
Switch_01(config-vlan)#name "Clients"
Switch_01(config-vlan)#end
Vérification : show vlan brief
Switch_01# show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
20 Clients active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Le VLAN 20 est bien créé.
Nous allons maintenant associé les 2 premiers ports au VLAN 20.
Switch_01#configure terminal
Switch_01(config)#interface range fastEthernet 0/1 - 2
Switch_01(config-if-range)#switchport ?
access Set access mode characteristics of the interface
mode Set trunking mode of the interface
nonegotiate Device will not engage in negotiation protocol on this
interface
port-security Security related command
priority Set appliance 802.1p priority
protected Configure an interface to be a protected port
trunk Set trunking characteristics of the interface
voice Voice appliance attributes
Switch_01(config-if-range)#switchport access vlan 20
Switch_01(config-if-range)#end
Switch_01#
A ce stade les ports sont dans le VLAN 20 mais non utilisables :
Switch_01#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
20 Clients active Fa0/1, Fa0/2
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Switch_01#show interfaces status
Port Name Status Vlan Duplex Speed Type
Fa0/1 disabled 20 auto auto 10/100BaseTX
Fa0/2 disabled 20 auto auto 10/100BaseTX
Fa0/3 disabled 1 auto auto 10/100BaseTX
Fa0/4 disabled 1 auto auto 10/100BaseTX
...
Il ne reste plus qu’à activer les 2 ports :
Switch_01#conf t
Switch_01(config)#interface range FastEthernet 0/1 -2
Switch_01(config-if-range)#end
Après vérification :
Switch_01#show interfaces status
Port Name Status Vlan Duplex Speed Type
Fa0/1 connected 20 auto auto 10/100BaseTX
Fa0/2 connected 20 auto auto 10/100BaseTX
Fa0/3 disabled 1 auto auto 10/100BaseTX
Fa0/4 disabled 1 auto auto 10/100BaseTX
Fa0/5 disabled 1 auto auto 10/100BaseTX
A ce stade tous les ports sont bloqués sauf 2 qui sont dans le VLAN 20.
II.3 Affection des autres ports à un autre VLAN
Maintenant nous allons créer un VLAN 30 nommé inactifs et nous y associerons les ports FA non utilisés.
Switch_01#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch_01(config)#vlan 30
Switch_01(config-vlan)#name "inactifs"
Switch_01(config-vlan)#exit
Switch_01(config)#interface range fastEthernet 0/3 -24
Switch_01(config-if-range)#switchport access vlan 30
Switch_01(config-if-range)#exit
Switch_01(config)#exit
Switch_01#
Vérification :
Switch_01#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Gig0/1, Gig0/2
20 Clients active Fa0/1, Fa0/2
30 inactifs active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Switch_01#
Au final nous avons :
- tous les ports non utilisés qui sont bloqués et rangés dans le VLAN 30, nommé « inactifs »
- Les ports branchés associés au VLAN « clients » et qui sont activés.
Il reste les ports Gigabit à gérer.
III L’agrégation de liens ou port-channel
Cela permet d’utiliser plusieurs ports ou câbles réseaux qui seront vu comme un seul. C’est utilisé soit pour augmenter la bande passante soit dans le cadre de le redondance en cas de panne (coupure câble).
Dans notre cas nous allons utiliser 2 switchs :
- switch_01
- switch_02
Les ports Gig0/1 et Gig0/2 du switch_01 seront connectés respectivement sur les mêmes port du switch_02
Enfin une fois l’agrégation réalisée, elle devra supporter le mode « trunk » pour permettre la communication des vlans entre les 2 switchs
III.1 Création de l’agrégation
Les étapes sont les suivantes :
- sélection des ports : ici ce sera les 2 ports en gigabit
- création d’un channel group « 1 » et définition du type de fonctionnement (mode active)
- définition du protocole à utiliser (LACP)
Ce qui donne :
Switch_01#conf t
Switch_01(config)#interface range gigabitEthernet 0/1 -2
Switch_01(config-if-range)#channel-group 1 mode active
Switch_01(config-if-range)#
Creating a port-channel interface Port-channel 1
Switch_01(config-if-range)#channel-protocol lacp
Switch_01(config-if-range)#exit
A faire sur l’autre switch.
III.2 Définition du trunk sur le « port channel 1 »
L’agrégation est faite sur les 2 swicths. Il faut maintenant faire passer les vlan. C’est au niveau de l’interface « port-channel 1 » que cela va se faire.
Switch_01(config)#interface port-channel 1
Switch_01(config-if)#switchport mode trunk
Switch_01(config-if)#no shutdown
Switch_01(config-if)#exit
A faire sur le Switch_02
III.3 Vérification
En listant les vlan, on s’apercoit que les ports gigabits ont disparu du Vlan 1 :
Switch_01#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active
20 Clients active Fa0/1, Fa0/2
30 inactifs active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Pour voir la liste des groupes il faut lancer la commande suivante :
Switch_02#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------
1 Po1(SU) LACP Gig0/1(P) Gig0/2(P)
On remarque qu’il y une agréation de liens sur les 2 ports gigabits.
La commande suivante permet d’obtenir plus de détails :
Switch_01#show etherchannel port-channel
Channel-group listing:
----------------------
Group: 1
----------
Port-channels in the group:
---------------------------
Port-channel: Po1 (Primary Aggregator)
------------
Age of the Port-channel = 00d:00h:23m:42s
Logical slot/port = 2/1 Number of ports = 2
GC = 0x00000000 HotStandBy port = null
Port state = Port-channel
Protocol = LACP
Port Security = Disabled
Ports in the Port-channel:
Index Load Port EC state No of bits
------+------+------+------------------+-----------
0 00 Gig0/2 Active 0
0 00 Gig0/1 Active 0
Time since last port bundled: 00d:00h:14m:01s Gig0/1