vlanciscohp
MDstable
NoteSnippetChecklistPlaybook
Configuration VLANs
Créer et configurer des VLANs sur switches Cisco et HP/Aruba
snippetintermediate 2025-05-10 3 min read
vlanciscohparubaswitchingtrunkaccess802.1q
Concepts
VLAN Virtual LAN segmentation logique dun rseau physique802 standard de tagging VLAN sur les trames EthernetTypes de portsAccess port appartenant UN seul VLAN postes imprimantesTrunk transporte PLUSIEURS VLANs inter-switch, vers routeurHybrid mix access trunk Huawei HPNative VLAN VLAN non tagg sur un trunk dfaut VLAN 1
Cisco IOS
Créer des VLANs
cisco
Variables
{{VLAN_ID}}
{{SERVICE}}
! Mode configuration globaleconf t! Créer le VLANvlan {{VLAN_ID}}name {{SERVICE}}! Plusieurs VLANs d'un coupvlan 10,20,30,100! Vérifiershow vlan briefshow vlan id {{VLAN_ID}}
Port Access
cisco
Variables
{{VLAN_ID}}
conf tinterface FastEthernet0/1switchport mode accessswitchport access vlan {{VLAN_ID}}spanning-tree portfast ! Pour les postes clientsno shutdown! En masse sur une plage d'interfacesinterface range FastEthernet0/1-12switchport mode accessswitchport access vlan {{VLAN_ID}}spanning-tree portfast
Port Trunk
cisco
conf tinterface GigabitEthernet0/1switchport mode trunkswitchport trunk encapsulation dot1q ! sur les anciens IOSswitchport trunk allowed vlan 10,20,30,100 ! VLANs autorisésswitchport trunk native vlan 999 ! Native VLAN (pas le VLAN 1 !)no shutdown! Ajouter un VLAN à un trunk existantswitchport trunk allowed vlan add 40! Voir les trunksshow interfaces trunk
Router-on-a-stick (routage inter-VLAN)
cisco
! Sur le routeur — sous-interfacesconf tinterface GigabitEthernet0/0no shutdowninterface GigabitEthernet0/0.10encapsulation dot1Q 10ip address 192.168.10.1 255.255.255.0interface GigabitEthernet0/0.20encapsulation dot1Q 20ip address 192.168.20.1 255.255.255.0interface GigabitEthernet0/0.100encapsulation dot1Q 100ip address 10.0.100.1 255.255.255.0
SVI — Switch Virtual Interface (Layer 3 switch)
cisco
conf tip routing ! activer le routage sur le switch L3! Créer les SVIsinterface Vlan10ip address 192.168.10.1 255.255.255.0no shutdowninterface Vlan20ip address 192.168.20.1 255.255.255.0no shutdown
HP / Aruba (ProCurve / AOS-CX)
HP ProCurve
bash
Variables
{{VLAN_ID}}
{{SERVICE}}
{{INTERFACE}}
# Créer et nommer un VLANvlan {{VLAN_ID}}name {{SERVICE}}exit# Port accessinterface {{INTERFACE}}untagged vlan {{VLAN_ID}}exit# Port trunkinterface {{INTERFACE}}tagged vlan 102030exit# Vérifiershow vlanshow interfaces {{INTERFACE}}
Aruba AOS-CX
bash
Variables
{{VLAN_ID}}
{{SERVICE}}
{{INTERFACE}}
# Créer le VLANvlan {{VLAN_ID}}name {{SERVICE}}# Port accessinterface {{INTERFACE}}no routingvlan access {{VLAN_ID}}# Port trunkinterface {{INTERFACE}}no routingvlan trunk allowed 102030vlan trunk native {{VLAN_ID}}# Vérifiershow vlanshow interfaces {{INTERFACE}} trunk
Sécurité VLAN
cisco
! VLAN Hopping — protéger le native VLANinterface range GigabitEthernet0/1-24switchport nonegotiate ! désactiver DTP! Désactiver les ports inutilisésinterface range FastEthernet0/13-24switchport mode accessswitchport access vlan 999 ! VLAN de quarantaineshutdown! Private VLAN (isolation au sein d'un VLAN)vlan 100private-vlan isolated! Port securityinterface FastEthernet0/1switchport port-security maximum 2switchport port-security violation restrictswitchport port-security mac-address sticky
Vérifications et debug
cisco
Variables
{{VLAN_ID}}
show vlan briefshow interfaces statusshow interfaces trunkshow mac address-table vlan {{VLAN_ID}}show spanning-tree vlan {{VLAN_ID}}debug sw-vlan vtp events
💡 Tip —
Ne jamais laisser le VLAN 1 comme native VLAN sur les trunks — risque de VLAN hopping. Créer un VLAN dédié (ex: 999) pour le native et pour les ports inutilisés. Désactiver DTP (switchport nonegotiate) sur tous les ports edge.
OPS·BRAIN v1.027 notes · Networklocal