Commandes Switchs Cisco

Commandes de Base

enable # Passer en mode privilégié
configure terminal # Passer en mode configuration
show running-config # Afficher la configuration active
show startup-config # Afficher la configuration sauvegardée
copy running-config startup-config # Sauvegarder la configuration
reload # Redémarrer le switch

Gestion des VLANs

vlan 10 # Créer un VLAN
name SALES # Nommer le VLAN
show vlan brief # Afficher les VLANs
interface vlan 10 # Configurer l'interface VLAN
ip address 192.168.10.1 255.255.255.0 # Configurer l'IP du VLAN

Configuration des Ports

interface fastethernet 0/1 # Sélectionner un port
switchport mode access # Mode access
switchport mode trunk # Mode trunk
switchport access vlan 10 # Assigner un VLAN en mode access
switchport trunk allowed vlan 10,20,30 # VLANs autorisés en trunk

Port Security

switchport port-security # Activer port security
switchport port-security maximum 2 # Max 2 adresses MAC
switchport port-security violation shutdown # Action en cas de violation
switchport port-security mac-address sticky # Apprentissage automatique

Spanning Tree

spanning-tree mode rapid-pvst # Mode RSTP
spanning-tree vlan 10 root primary # Définir comme root primary
spanning-tree vlan 10 root secondary # Définir comme root secondary
spanning-tree vlan 10 priority 4096 # Définir la priorité

EtherChannel

interface port-channel 1 # Créer un port-channel
channel-group 1 mode active # LACP actif
channel-group 1 mode desirable # PAgP désirable
show etherchannel summary # Voir les EtherChannels

VTP (VLAN Trunking Protocol)

vtp mode server # Mode serveur
vtp mode client # Mode client
vtp mode transparent # Mode transparent
vtp domain NOM_DOMAINE # Définir le domaine VTP
vtp password MOT_DE_PASSE # Définir le mot de passe

Commandes de Dépannage

show interfaces status # État des interfaces
show mac address-table # Table d'adresses MAC
show spanning-tree # État du spanning tree
show vtp status # État VTP
show etherchannel summary # État des EtherChannels
show interfaces trunk # État des trunks

Commandes de Sécurité

service password-encryption # Chiffrer les mots de passe
enable secret MOT_DE_PASSE # Définir le mot de passe enable
username admin privilege 15 secret MOT_DE_PASSE # Créer un utilisateur
line console 0 # Configuration console
login local # Authentification locale
line vty 0 4 # Configuration VTY
transport input ssh # Autoriser uniquement SSH