# GNS3

# INSTALLATION GNS3/VM

# Installation de GNS3 sur WINDOWS

### Prérequis

- Avoir Windows d'installé.
- Avoir activé la virtualisation du processeur dans le Bios.
- 4GB de RAM
- Processeur avec au moins 2 cœurs (logique)
- 1 GB de stockage

### Installation du software

- Télécharger le software sur [Lien vers la page de téléchargement](https://www.gns3.com/software/download).
- Il faudra vous créer un compte ou s'authentifier  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/image.png)
- Une fois l'installateur téléchargé il vous faudra l’exécuter <p class="callout info">Sur windows11 il se peut qu'une popup vous informe d'un danger potentiel -&gt; éxecutez l'installateur quand même.</p>
    
    <p class="callout info">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/YZhimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/YZhimage.png)  
    </p>
    
    <p class="callout info">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/QD8image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/QD8image.png)</p>
- Sélectinnez les bonnes options  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/q4Rimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/q4Rimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/hdPimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/hdPimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/XzLimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/XzLimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/bBuimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/bBuimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/LIbimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/LIbimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/zBkimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/zBkimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/449image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/449image.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/Rv8image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/Rv8image.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/ghnimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/ghnimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/1UAimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/1UAimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/HK1image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/HK1image.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/l8eimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/l8eimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/WUvimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/WUvimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/V9kimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/V9kimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/lv0image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/lv0image.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/pA1image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/pA1image.png)
- Voila GNS3 est installé  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/Tr7image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/Tr7image.png)
- Comme vous pouvez le constater à ce stade vous ne pouvez pas utiliser tout les routeur.

### Problème rencontré

<p class="callout warning">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/3uWimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/3uWimage.png)</p>

<p class="callout warning">Si vous avez cette erreur alors autoriser GNS3 sur le Pare-feu Windows[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/6t9image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/6t9image.png)</p>

<p class="callout warning">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/B4Oimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/B4Oimage.png)</p>

<p class="callout warning">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/Mz3image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/Mz3image.png)</p>

<p class="callout warning">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/nG7image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/nG7image.png)  
Après un redémarrage de GNS3 tout rentrera dans l'ordre.  
**PS: Pensez aussi à faire les mises à jours Windows.**  
</p>

# Installation de GNS3 VM sur WINDOWS

#### Prérequis

- Avoir un logiciel de virtualisation (Virtualbox ou VmWare Workstation)
- 2 processeur
- 4 GB de RAM pour la VM
- 35 GB de stockage

#### Installation

- Télécharger la bonne version de vm [GNS3 vm](https://gns3.com/software/download-vm) (Selectionner la bonne version)  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/dVNimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/dVNimage.png)
- Aller dans votre dossier de téléchargement et dézipper l'archive.
- Importez le .ova  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/7Xdimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/7Xdimage.png)
- Attendez l'import
- Une fois importée, démarrée la Vm et accédez à la console pour y récupérer l'IP affichée  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/6cgimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/6cgimage.png)
- Démarrer GNS3 et allez dans les paramètres pour y paramétrer GNS3 VM  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/3Ldimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/3Ldimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/Pjzimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/Pjzimage.png)
- Si tout c'est bien passé vous devriez voire apparaître le serveur local et la VM en vert  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/hVkimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/hVkimage.png)

# AJOUT DE TEMPLATE

# Ajout template Debian

---

#### PREREQUIS

- Avoir GNS3 et GNS3VM d'installé
- Avoir une connection internet

---

#### AJOUT DU TEMPLATE

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/image.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/image.png)

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/Eraimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/Eraimage.png)

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/V6Vimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/V6Vimage.png)

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/Nk2image.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/Nk2image.png)

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/16aimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/16aimage.png)  
Une fois télécharger on pourra alors l'ajouter

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/M0Vimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/M0Vimage.png)  
Attendre la fin de l'import et terminer

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/zjVimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/zjVimage.png)

---

#### PREMIER DEMARRAGE

1. Faire le shcéma suivant  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2024-01/scaled-1680-/5n8image.png)](https://book.techoops.fr/uploads/images/gallery/2024-01/5n8image.png)
2. Paramétrer le VPC avec pour ip 192.168.1.1/30
3. Paramétrage du serveur DEBIAN 
    1. L'authentification se fait avec l'utilistateur debian et le mot de passe debian
    2. Passer de l'utilisateur debian a root  
        `sudo -i`
    3. Pour le moment pas de réseau, il va falloir le paramétrer.  
        Il faut modifier le fichier `/etc/network/interfaces` et y mettre l'IP désirée:  
        ```bash
        # Static config for ens4
        auto ens4
        iface ens4 inet static
                address 192.168.1.2
                netmask 255.255.255.252
        #       gateway 192.168.1.1
        #       dns-nameservers 192.168.1.1
        
        ```
    4. Monter la carte réseau:  
        ` ifup ens4`
    5. Le serveur a maintenant une IP  
        ```bash
        root@debian:~# ip a |grep ens4
        2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
            inet 192.168.1.2/30 brd 192.168.1.3 scope global ens4
        ```
4. Test avec un pinc du vpc à la Debian12

<p class="callout success">Le serveur Debian est paramétrer au niveau du réseau !!</p>

# AJOUT DE TEMPLATE SUR GNS3 VM

#### Prérequis

- Avoir installé GNS3
- Avoir installé GNS3 VM
- Avoir des les ISOs dont vous avez besoins
- Pour Cisco avoir le script de génération de licence

#### Ajout d'un template

- Ajoutez un template  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/3gVimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/3gVimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/zJfimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/zJfimage.png)
- Mettez à jour la registry  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/wLLimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/wLLimage.png)
- Sélectionnez le template qu'il vous faut  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/V2gimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/V2gimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/7Smimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/7Smimage.png)
- Il se peut que votre version ne soit pas la bonne dans ce cas créée la nouvelle version  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/m42image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/m42image.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/G5qimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/G5qimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/3vJimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/3vJimage.png)
- Importez l'image  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/yciimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/yciimage.png)
    
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/Ohcimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/Ohcimage.png)
- Installez l'image  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/HTXimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/HTXimage.png)
- A cette étape vous ne pourrez pas démarrer le routeur car vous n'avez pas la license  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/uqlimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/uqlimage.png)

#### Ajout de la licence Cisco

- Connectez-vous au serveur en sftp via la console CMD 
    - L'Ip pour la connexion à la VM GNS3 est disponible depuis la console de la VM
    - Déplacez vous dans le répertoire contenant le script python
    - ```bash
        sftp gns3@192.168.95.128
        ```
- Envoyez le fichier sur la VM  
    ```powershell
    C:\Users\kvega\Documents>sftp gns3@192.168.95.128
    The authenticity of host '192.168.95.128 (192.168.95.128)' can't be established.
    ED25519 key fingerprint is SHA256:L6yg+SeXGwPI6JsYFu4q4uNLRRisd100BdY/gJAGJNw.
    This key is not known by any other names
    Are you sure you want to continue connecting (yes/no/[fingerprint])?
    Warning: Permanently added '192.168.95.128' (ED25519) to the list of known hosts.
    gns3@192.168.95.128's password:
    Connected to 192.168.95.128.
    sftp> put CiscoIOUKeygen3f.py
    Uploading CiscoIOUKeygen3f.py to /home/gns3/CiscoIOUKeygen3f.py
    CiscoIOUKeygen3f.py
    ```
- Se connecter à la Vm en ssh   
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/4wgimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/4wgimage.png)
- Exécutez le script  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/Sqyimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/Sqyimage.png)
- Le retour du script nous indique de mettre un bloc d'instruction dans un fichier .iourc 
    - Copiez le bloc
    - ajouter le dans le fichier .iourc  
        [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/GELimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/GELimage.png)
        
        [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/pMbimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/pMbimage.png)
    - Faites CTRL+x pour quitter le fichier
- Tentez de démarrer le router ajouté  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/O49image.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/O49image.png)
    
    <p class="callout success">[![image.png](https://book.techoops.fr/uploads/images/gallery/2023-11/scaled-1680-/cXBimage.png)](https://book.techoops.fr/uploads/images/gallery/2023-11/cXBimage.png)  
    Le Routeur est bien démarré !!  
    </p>

# MISE EN PLACE DU NAT (accés internet)

#### <span style="text-decoration: underline;">Prérequis</span>:

*Il faut avoir L'application GNS3 installée et la VM aussi.  
A l'heure actuelle les version que j'utilise pour ce TP sont:*

- *GNS3 SERVER = <span style="color: #000000;">2.2.49</span>*
- *<span style="color: #000000;">GNS3 VM = 2.2.49</span>*
- *<span style="color: #000000;">Avoir le template Debian sur la[ VM GNS3](https://book.techoops.fr/books/gns3/page/ajout-template-debian "Template Debian sur GNS3")</span>*
- *<span style="color: #000000;">Avoir un template Cisco iou L3 sur la [VM GNS3](https://book.techoops.fr/books/gns3/page/ajout-de-template-sur-gns3-vm "Ajout template cisco sur GNS3 VM")</span>*

#### <span style="text-decoration: underline;"><span style="color: rgb(0, 0, 0); text-decoration: underline;">Schéma à mettre en place pour ce tutoriel:</span></span>

[![image.png](https://book.techoops.fr/uploads/images/gallery/2024-09/scaled-1680-/image.png)](https://book.techoops.fr/uploads/images/gallery/2024-09/image.png)

#### <span style="text-decoration: underline;">Paramétrage de Debian pour l'accès à internet:</span>

1. S'assurer que la machine est bien démarrée
2. Se connecter sur la machine en telnet (Double clic sur la machine)  
    L'utilisateur est debian et le mot de passe debian aussi  
    [![image.png](https://book.techoops.fr/uploads/images/gallery/2024-09/scaled-1680-/pryimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-09/pryimage.png)
3. Passer en mode superutilisateur  
    ```bash
    debian@debian:~$ sudo -i
    root@debian:~#
    ```
4. On va maintenant paramétrer le réseau de la machine en dhcp 
    1. Editer le fichier de configuration  
        ```bash
        root@debian:~# nano /etc/network/interfaces
        ```
    2. Décommenter les lignes suivantes (Comprendre supprimer les # en début de ligne): 
        1. Avant:  
            [![image.png](https://book.techoops.fr/uploads/images/gallery/2024-09/scaled-1680-/gvbimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-09/gvbimage.png)
        2. Après:  
            [![image.png](https://book.techoops.fr/uploads/images/gallery/2024-09/scaled-1680-/fLlimage.png)](https://book.techoops.fr/uploads/images/gallery/2024-09/fLlimage.png)
        3. Enregistrer et quiter
    3. Redémarrer le service réseau  
        ```bash
        root@debian:~# systemctl restart networking.service
        ```
    4. Vérifier que la machine à bien reçu une adresse IP:  
        ```bash
        root@debian:~# ip a |grep ens4
        2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
            inet 192.168.122.130/24 brd 192.168.122.255 scope global dynamic ens4
        ```
        
        La machine a bien reçu une adresse IP.
    5. Tester la connexion à internet  
        ```bash
        root@debian:~# ping -c 4 8.8.8.8
        PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
        64 bytes from 8.8.8.8: icmp_seq=1 ttl=127 time=19.6 ms
        64 bytes from 8.8.8.8: icmp_seq=2 ttl=127 time=20.0 ms
        64 bytes from 8.8.8.8: icmp_seq=3 ttl=127 time=22.7 ms
        64 bytes from 8.8.8.8: icmp_seq=4 ttl=127 time=21.0 ms
        
        --- 8.8.8.8 ping statistics ---
        4 packets transmitted, 4 received, 0% packet loss, time 3034ms
        rtt min/avg/max/mdev = 19.610/20.799/22.652/1.180 ms
        root@debian:~# ping -c 4 google.fr
        PING google.fr (172.217.20.195) 56(84) bytes of data.
        64 bytes from par10s50-in-f3.1e100.net (172.217.20.195): icmp_seq=1 ttl=127 time=19.7 ms
        64 bytes from par10s50-in-f3.1e100.net (172.217.20.195): icmp_seq=2 ttl=127 time=20.0 ms
        64 bytes from par10s50-in-f3.1e100.net (172.217.20.195): icmp_seq=3 ttl=127 time=19.6 ms
        64 bytes from par10s50-in-f3.1e100.net (172.217.20.195): icmp_seq=4 ttl=127 time=20.5 ms
        
        --- google.fr ping statistics ---
        4 packets transmitted, 4 received, 0% packet loss, time 3030ms
        rtt min/avg/max/mdev = 19.564/19.923/20.513/0.369 ms
        root@debian:~#
        
        ```
        
        <p class="callout success align-center">Le PING passe bien vers internet le NAT est donc fontionnel  
        </p>

#### <span style="text-decoration: underline;">Paramétrage d'un routeur CISCO pour l'accès à internet:</span>

1. S'assurer que la machine est bien démarrée
2. Passer en mode configuration  
    ```bash
    R1#configure terminal
    Enter configuration commands, one per line.  End with CNTL/Z.
    R1(config)#
    ```
3. Paramétrer le réseau de la carte Ethernet brancher sur le NAT pour moi c'est la Ethernet 0/0  
    ```bash
    R1(config)#interface ethernet 0/0
    R1(config-if)#
    ```
4. Configurer l'interface en mode dhcp  
    ```bash
    R1(config-if)#ip address dhcp
    ```
5. Si vous n'avez rien fait l'interface doit être down  
    ```bash
    R1(config-if)#do show ip int brief | include ^Ethernet0/0
    Ethernet0/0                unassigned      YES manual administratively down down
    ```
6. Allumer l'interface  
    ```bash
    R1(config-if)#no sh
    R1(config-if)#
    *Sep  8 11:27:26.101: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
    *Sep  8 11:27:27.118: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
    R1(config-if)#
    *Sep  8 11:27:40.176: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/0 assigned DHCP address 192.168.122.118, mask 255.255.255.0, hostname R1
    ```
    
    On vois que l'interface Ethernet 0/0 a reçu une adresse IP sur la dernière ligne
7. Tester la connectivité  
    ```bash
    R1(config-if)#do ping 8.8.8.8
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
    .!!!!
    Success rate is 80 percent (4/5), round-trip min/avg/max = 18/20/24 ms
    ```
8. Enregistrer la configuration  
    ```bash
    R1(config-if)#do write memory
    Warning: Attempting to overwrite an NVRAM configuration previously written
    by a different version of the system image.
    Overwrite the previous NVRAM configuration?[confirm]
    Building configuration...
    [OK]
    ```