# Cisco - Port mirroring

<table id="bkmrk-difficult%C3%A9%2A-%3Cdescrip" style="border-collapse: collapse; width: 100%; height: 46.8px; border-width: 1px; border-style: hidden;"><colgroup><col style="width: 20%;"></col><col style="width: 80%;"></col></colgroup><tbody><tr style="height: 46.8px;"><td style="height: 46.8px; border: 1px groove rgb(52,73,94);">[![intermédiaire.png](https://docs.labs404.fr/uploads/images/gallery/2026-07/scaled-1680-/4fDintermediaire-png.png)](https://docs.labs404.fr/uploads/images/gallery/2026-07/scaled-1680-/4fDintermediaire-png.png)</td><td style="height: 46.8px; border-width: 1px; background-color: rgb(236,202,250); vertical-align: top;">Difficulté : Intermédiaire

Notions : connexion ssh, console, CLI, Putty, wireshark.

</td></tr></tbody></table>

---

### <span style="color: rgb(52, 73, 94);">**<span style="text-decoration: underline;">I. Introduction</span>**</span>

**<span style="color: rgb(23,43,77); font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 16px; font-style: normal; font-weight: 400; letter-spacing: -0.08px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline; float: none;">Cette procédure à pour but d’expliquer comment mettre en place un mirroring de port. Cela peut être utile à des fins de diagnostic.</span>**

<p class="callout info">**<span style="color: rgb(23,43,77); font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 16px; font-style: normal; font-weight: 400; letter-spacing: -0.08px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline; float: none;">Télécharger putty : [Download PuTTY - Latest](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html "Download PuTTY - Latest")</span>**</p>

<p class="callout info">**<span style="color: rgb(23,43,77); font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 16px; font-style: normal; font-weight: 400; letter-spacing: -0.08px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline; float: none;">Télécharger wireshark : [Download Wireshark](https://www.wireshark.org/download.html)</span>**</p>

---

### **<span style="text-decoration: underline;"><span style="color: rgb(52, 73, 94); text-decoration: underline;">II. Paramétrage en CLI</span>  
</span>**

####   


#### **<span style="color: rgb(35, 111, 161);">2.1 Création du port mirrorring</span>** 

<p class="callout danger">**Prérequis** : un pc avec putty et un câble console.</p>

<p class="callout info">**Plus d'informations** : [Cisco - Se connecter au port console](https://docs.labs404.fr/books/reseau-Vdy/page/cisco-se-connecter-au-port-console "Cisco - Se connecter au port console")</p>

<p class="callout warning">**Attention** : utiliser un port libre pour la destination du mirrorring car celui-ci va perdre sa configuration.</p>

Se connecter au switch en SSH ou en console.

Entrer les commandes suivantes :

```
Configure terminal
Monitor session <id> source <interface|vlan> <GE|lagg> <number> <tx|rx|both>
monitor session <id> destination interface GE <number>
```

*Exemple1 : mirrorer le trafic entrant et sortant du port 21 (source) sur le port 23 (destination) dans la session 1.*

- monitor session 1 source interface GE 21 both
- monitor session 1 destination interface GE 23

*Exemple2 : mirrorer le traffic entrant sur le vlan 10 (source) sur le port 23 (destination) dans la session 1.*

- monitor session 1 source vlan 10 rx
- monitor session 1 destination interface GE 23

#### <span style="color: rgb(35, 111, 161);">**2.2 Utilisation du port mirrorring**</span>

Connecter un PC équipé de Wireshark sur le port de destination (dans l’exemple, le 23).

Lancer Wireshark et effectuer l’analyse.

<p class="callout info">**Plus d'informations** : [Wireshark - Installation et utilisation](https://docs.labs404.fr/books/11-logiciels/page/wireshark-installation-et-utilisation "Wireshark - Installation et utilisation")</p>

Pour voir les sessions actives :

```
show monitor session
```

#### <span style="color: rgb(35, 111, 161);">**2.3 Terminer le port mirrorring**</span>

Pour mettre fin à la session de port mirrorring, utiliser les commandes suivantes :

```
configure terminal
no monitor session <id> source <interface|vlan> <GE|lagg> <number> <tx|rx|both>
no monitor session <id> destination interface GE <number>
```

*Exemple1 : cesser de mirrorer le trafic entrant et sortant du port 21 (source) sur le port 23 (destination) dans la session 1.*

- no monitor session 1 source interface GE 21 both
- no monitor session 1 destination interface GE 23

*Exemple2 : cesser de mirrorer le traffic entrant sur le vlan 10 (source) sur le port 23 (destination) dans la session 1.*

- no monitor session 1 source vlan 10 rx
- no monitor session 1 destination interface GE 23