diff --git a/.gitignore b/.gitignore index d596d99..0c7c0a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store documentation/assets/images/diagrams/.$VXLAN.drawio.bkp +clab-vxlan-evpn-l2/* +containerlab/.lab_definition.yml.bak diff --git a/README.md b/README.md index c569f62..c27a712 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ # Projet d'Automatisation VXLAN EVPN -Ce projet vise à automatiser la création et la gestion d'un laboratoire de test VXLAN EVPN en utilisant ContainerLab, Arista cEOS, Cisco N9Kv, et Netbox. L'automatisation est réalisée principalement grâce à Ansible et des scripts Python. +Ce projet vise à automatiser la création et la gestion d'un laboratoire de test VXLAN EVPN en utilisant ContainerLab, Arista cEOS, Cisco N9Kv, et Netbox. L'automatisation est réalisée principalement grâce à Ansible et des scripts Python. + +🖋️ **_NOTE_**: L'environnement utilisé est un Debian 12 : + +```bash +No LSB modules are available. +Distributor ID: Debian +Description: Debian GNU/Linux 12 (bookworm) +Release: 12 +Codename: bookworm +``` ## Table des matières @@ -14,9 +24,9 @@ Ce projet vise à automatiser la création et la gestion d'un laboratoire de tes ## Pré-requis -- Docker & ContainerLab installés. -- Images pour Arista cEOS et Cisco N9Kv téléchargées. -- Python 3.x avec les bibliothèques nécessaires (voir `requirements.txt`). +- Docker, ContainerLab et Ansible installés. +- Images pour Arista cEOS, Cisco N9Kv et Linux Alpine téléchargées. +- Python 3.11 avec les bibliothèques nécessaires (voir `requirements.txt`). ## Installation @@ -46,7 +56,7 @@ Ce projet vise à automatiser la création et la gestion d'un laboratoire de tes 1. **Mise en place du lab** : ```bash - ansible-playbook ansible/playbooks/setup_containerlab.yml + sudo containerlab deploy --topo containerlab/lab_definition.yml ``` 2. **Configurer Netbox** : diff --git a/containerlab/hosts/h1_interfaces b/containerlab/hosts/h1_interfaces new file mode 100644 index 0000000..588f9a7 --- /dev/null +++ b/containerlab/hosts/h1_interfaces @@ -0,0 +1,7 @@ +auto lo +iface lo inet loopback + +auto eth1 +iface eth1 inet static + address 10.100.100.1 + netmask 255.255.255.0 \ No newline at end of file diff --git a/containerlab/hosts/h2_interfaces b/containerlab/hosts/h2_interfaces new file mode 100644 index 0000000..5883945 --- /dev/null +++ b/containerlab/hosts/h2_interfaces @@ -0,0 +1,7 @@ +auto lo +iface lo inet loopback + +auto eth1 +iface eth1 inet static + address 10.100.100.2 + netmask 255.255.255.0 \ No newline at end of file diff --git a/containerlab/hosts/h3_interfaces b/containerlab/hosts/h3_interfaces new file mode 100644 index 0000000..0c7cf0d --- /dev/null +++ b/containerlab/hosts/h3_interfaces @@ -0,0 +1,7 @@ +auto lo +iface lo inet loopback + +auto eth1 +iface eth1 inet static + address 10.100.100.3 + netmask 255.255.255.0 \ No newline at end of file diff --git a/containerlab/hosts/h4_interfaces b/containerlab/hosts/h4_interfaces new file mode 100644 index 0000000..c5cd580 --- /dev/null +++ b/containerlab/hosts/h4_interfaces @@ -0,0 +1,7 @@ +auto lo +iface lo inet loopback + +auto eth1 +iface eth1 inet static + address 10.100.100.4 + netmask 255.255.255.0 \ No newline at end of file diff --git a/containerlab/lab_definition.yml b/containerlab/lab_definition.yml new file mode 100644 index 0000000..8f0af0d --- /dev/null +++ b/containerlab/lab_definition.yml @@ -0,0 +1,64 @@ +name: vxlan-evpn-l2 +topology: + nodes: + spine1: + kind: ceos + image: ceos:4.30.1F + mgmt-ipv4: 172.20.20.101 + spine2: + kind: ceos + image: ceos:4.30.1F + mgmt-ipv4: 172.20.20.102 + leaf1: + kind: ceos + image: ceos:4.30.1F + mgmt-ipv4: 172.20.20.11 + leaf2: + kind: vr-n9kv + image: vrnetlab/vr-n9kv:9.3.9 + mgmt-ipv4: 172.20.20.12 + leaf3: + kind: vr-n9kv + image: vrnetlab/vr-n9kv:9.3.9 + mgmt-ipv4: 172.20.20.13 + leaf4: + kind: ceos + image: ceos:4.30.1F + mgmt-ipv4: 172.20.20.14 + host1: + kind: linux + image: alpine:latest + binds: + - hosts/h1_interfaces:/etc/network/interfaces + mgmt-ipv4: 172.20.20.21 + host2: + kind: linux + image: alpine:latest + binds: + - hosts/h2_interfaces:/etc/network/interfaces + mgmt-ipv4: 172.20.20.22 + host3: + kind: linux + image: alpine:latest + binds: + - hosts/h3_interfaces:/etc/network/interfaces + mgmt-ipv4: 172.20.20.23 + host4: + kind: linux + image: alpine:latest + binds: + - hosts/h4_interfaces:/etc/network/interfaces + mgmt-ipv4: 172.20.20.24 + links: + - endpoints: ["leaf1:eth1", "spine1:eth1"] + - endpoints: ["leaf1:eth2", "spine2:eth1"] + - endpoints: ["leaf2:eth1", "spine1:eth2"] + - endpoints: ["leaf2:eth2", "spine2:eth2"] + - endpoints: ["leaf3:eth1", "spine1:eth3"] + - endpoints: ["leaf3:eth2", "spine2:eth3"] + - endpoints: ["leaf4:eth1", "spine1:eth4"] + - endpoints: ["leaf4:eth2", "spine2:eth4"] + - endpoints: ["leaf1:eth3", "host1:eth1"] + - endpoints: ["leaf2:eth3", "host2:eth1"] + - endpoints: ["leaf3:eth3", "host3:eth1"] + - endpoints: ["leaf4:eth3", "host4:eth1"] diff --git a/documentation/INSTALLATION.md b/documentation/INSTALLATION.md new file mode 100644 index 0000000..cfac4f4 --- /dev/null +++ b/documentation/INSTALLATION.md @@ -0,0 +1,66 @@ +## Table des matières + +1. [Installation de ContainerLab](#installation-de-containerlab) +2. [Installation de vrnetlab](#installation-de-vrnetlab) +3. [Installation de Docker](#installation-de-docker) + +## Installation de ContainerLab + +Containerlab peut être installé à l'aide du script d'installation qui détecte le type de système d'exploitation et installe le paquetage approprié : + +```bash +# télécharger et installer la dernière version (peut nécessiter sudo) +bash -c "$(curl -sL https://get.containerlab.dev)" + +# avec wget +bash -c "$(wget -qO - https://get.containerlab.dev)" +``` + +## Installation de vrnetlab + +Vrnetlab place une VM normale dans un conteneur et la rend exécutable comme s'il s'agissait d'une image de conteneur. +Pour ce faire, vrnetlab fournit un ensemble de scripts qui construisent l'image du conteneur à partir d'un disque VM fourni par l'utilisateur. + +```bash +# mise à jour et installation des dépendances +sudo apt update +sudo apt -y install python3-bs4 sshpass make +sudo apt -y install git + +# se déplacer dans /opt et cloner le projet +sudo cd /opt && sudo git clone https://github.com/hellt/vrnetlab + +# optionnel : modification des droits du répertoire +sudo chown -R $USER:$USER vrnetlab +``` + +## Installation de docker + +Il s'agit de moteur de conteneurisation utilisé par ContainerLab + +```bash +# Mise à jour et installation des dépendances +sudo apt-get update +sudo apt-get install ca-certificates curl gnupg + +# Ajout de la clef GPG +sudo install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +sudo chmod a+r /etc/apt/keyrings/docker.gpg + +# Ajout du dépôt +echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# Mise à jour et installation +sudo apt-get update +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +``` + +## Sources +- [InsContainerLab](https://containerlab.dev/install/) +- [vrnetlab](https://containerlab.dev/manual/vrnetlab/#vrnetlab) +- [BiranLinkLetter](https://www.brianlinkletter.com/2019/03/vrnetlab-emulate-networks-using-kvm-and-docker/) +- [Docker Engine for Debian](https://docs.docker.com/engine/install/debian/) \ No newline at end of file diff --git a/documentation/assets/images/diagrams/VXLAN.drawio b/documentation/assets/images/diagrams/VXLAN.drawio index 410c89a..8165943 100644 --- a/documentation/assets/images/diagrams/VXLAN.drawio +++ b/documentation/assets/images/diagrams/VXLAN.drawio @@ -1,142 +1,142 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file