From f1fbdeb288a69d6f9914f8338733c72e652aedcd Mon Sep 17 00:00:00 2001 From: COLIN Cyril Date: Fri, 25 Oct 2019 10:44:49 +0200 Subject: [PATCH] archivage initial --- .gitignore | 1 + VM1-6/Vagrantfile | 33 ++++++++++++++++++++++++ VM1-6/config.sls | 66 +++++++++++++++++++++++++++++++++++++++++++++++ VM1-6/top.sls | 5 ++++ VM1/Vagrantfile | 33 ++++++++++++++++++++++++ VM1/config.sls | 49 +++++++++++++++++++++++++++++++++++ VM1/top.sls | 5 ++++ VM2-6/Vagrantfile | 33 ++++++++++++++++++++++++ VM2-6/config.sls | 46 +++++++++++++++++++++++++++++++++ VM2-6/top.sls | 5 ++++ VM2/Vagrantfile | 33 ++++++++++++++++++++++++ VM2/config.sls | 50 +++++++++++++++++++++++++++++++++++ VM2/top.sls | 5 ++++ VM3-6/Vagrantfile | 33 ++++++++++++++++++++++++ VM3-6/config.sls | 61 +++++++++++++++++++++++++++++++++++++++++++ VM3-6/top.sls | 5 ++++ VM3/Vagrantfile | 33 ++++++++++++++++++++++++ VM3/config.sls | 50 +++++++++++++++++++++++++++++++++++ VM3/top.sls | 5 ++++ compte_rendu.txt | 5 ++++ partage/config.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++ 21 files changed, 618 insertions(+) create mode 100644 .gitignore create mode 100644 VM1-6/Vagrantfile create mode 100644 VM1-6/config.sls create mode 100644 VM1-6/top.sls create mode 100644 VM1/Vagrantfile create mode 100644 VM1/config.sls create mode 100644 VM1/top.sls create mode 100644 VM2-6/Vagrantfile create mode 100644 VM2-6/config.sls create mode 100644 VM2-6/top.sls create mode 100644 VM2/Vagrantfile create mode 100644 VM2/config.sls create mode 100644 VM2/top.sls create mode 100644 VM3-6/Vagrantfile create mode 100644 VM3-6/config.sls create mode 100644 VM3-6/top.sls create mode 100644 VM3/Vagrantfile create mode 100644 VM3/config.sls create mode 100644 VM3/top.sls create mode 100644 compte_rendu.txt create mode 100755 partage/config.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a977916 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vagrant/ diff --git a/VM1-6/Vagrantfile b/VM1-6/Vagrantfile new file mode 100644 index 0000000..3451f76 --- /dev/null +++ b/VM1-6/Vagrantfile @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + +##### Vos Configurations + config.vm.box = "vm1-6" + + # Ajout d'une interface réseau (privée) + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN3" + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN1-6" + + +##### NE PAS MODIFIER CETTE PARTIE + config.vm.hostname = File.basename(Dir.getwd) + +### Dossiers partagés + config.vm.synced_folder ".", "/vagrant", owner: "m1reseaux" + config.vm.synced_folder "../partage", "/mnt/partage", create: true, owner: "m1reseaux" + + + config.vm.provider "virtualbox" do |vb| + # Commenter pour s'exécuter sans GUI + vb.gui = true + + vb.customize ["modifyvm", :id, "--memory", "768"] + end + +end diff --git a/VM1-6/config.sls b/VM1-6/config.sls new file mode 100644 index 0000000..1c7fbfd --- /dev/null +++ b/VM1-6/config.sls @@ -0,0 +1,66 @@ +# Configuration eth1 +# RAPPEL: eth0 est à vagrant, ne pas y toucher + +## Désactivation de network-manager +NetworkManager: + service: + - dead + - enable: False + +## Suppression de la passerelle par défaut +ip route del default: + cmd: + - run + +##Configuration de VM1 +eth1: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.156 + - netmask: 28 + +eth2: + network.managed: + - enabled: True + - type: eth + - proto: none + - enable_ipv4: false + - ipv6proto: static + - enable_ipv6: true + - ipv6_autoconf: no + - ipv6ipaddr: fc00:1234:1::16 + - ipv6netmask: 64 + +net.ipv6.conf.all.forwarding: + sysctl: + - present + - value: 1 + +## Configuration de la route vers LAN2 via VM2 +routes: + network.routes: + - name: eth1 + - routes: + - name: LAN1 + ipaddr: 172.16.2.128/28 + gateway: 172.16.2.151 + + - name: eth1-2 + - routes: + - name: LAN2 + ipaddr: 172.16.2.160/28 + gateway: 172.16.2.151 + + - name: eth1-3 + - routes: + - name: LAN4 + ipaddr: 172.16.2.176/28 + gateway: 172.16.2.151 + + - name: eth2 + - routes: + - name: LAN2-6 + ipv6ipaddr: fc00:1234:2::/64 + gateway: fc00:1234:1::26 diff --git a/VM1-6/top.sls b/VM1-6/top.sls new file mode 100644 index 0000000..331b688 --- /dev/null +++ b/VM1-6/top.sls @@ -0,0 +1,5 @@ +base: + '*': + - config + + diff --git a/VM1/Vagrantfile b/VM1/Vagrantfile new file mode 100644 index 0000000..3b1deb7 --- /dev/null +++ b/VM1/Vagrantfile @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + +##### Vos Configurations + config.vm.box = "vm1" + + # Ajout d'une interface réseau (privée) + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN1" + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN3" + + +##### NE PAS MODIFIER CETTE PARTIE + config.vm.hostname = File.basename(Dir.getwd) + +### Dossiers partagés + config.vm.synced_folder ".", "/vagrant", owner: "m1reseaux" + config.vm.synced_folder "../partage", "/mnt/partage", create: true, owner: "m1reseaux" + + + config.vm.provider "virtualbox" do |vb| + # Commenter pour s'exécuter sans GUI + vb.gui = true + + vb.customize ["modifyvm", :id, "--memory", "768"] + end + +end diff --git a/VM1/config.sls b/VM1/config.sls new file mode 100644 index 0000000..703ff23 --- /dev/null +++ b/VM1/config.sls @@ -0,0 +1,49 @@ +# Configuration eth1 +# RAPPEL: eth0 est à vagrant, ne pas y toucher + +## Désactivation de network-manager +NetworkManager: + service: + - dead + - enable: False + +## Suppression de la passerelle par défaut +ip route del default: + cmd: + - run + +##Configuration de VM1 +eth1: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.131 + - netmask: 28 + +eth2: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.151 + - netmask: 28 + +net.ipv4.ip_forward: + sysctl: + - present + - value: 1 + +## Configuration de la route vers LAN2 via VM2 +routes: + network.routes: + - name: eth1 + - routes: + - name: LAN2 + ipaddr: 172.16.2.160/28 + gateway: 172.16.2.132 + - name: eth1-2 + - routes: + - name: LAN4 + ipaddr: 172.16.2.176/28 + gateway: 172.16.2.132 diff --git a/VM1/top.sls b/VM1/top.sls new file mode 100644 index 0000000..331b688 --- /dev/null +++ b/VM1/top.sls @@ -0,0 +1,5 @@ +base: + '*': + - config + + diff --git a/VM2-6/Vagrantfile b/VM2-6/Vagrantfile new file mode 100644 index 0000000..71c0499 --- /dev/null +++ b/VM2-6/Vagrantfile @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + +##### Vos Configurations + config.vm.box = "vm2-6" + + # Ajout d'une interface réseau (privée) + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN1-6" + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN2-6" + + +##### NE PAS MODIFIER CETTE PARTIE + config.vm.hostname = File.basename(Dir.getwd) + +### Dossiers partagés + config.vm.synced_folder ".", "/vagrant", owner: "m1reseaux" + config.vm.synced_folder "../partage", "/mnt/partage", create: true, owner: "m1reseaux" + + + config.vm.provider "virtualbox" do |vb| + # Commenter pour s'exécuter sans GUI + vb.gui = true + + vb.customize ["modifyvm", :id, "--memory", "768"] + end + +end diff --git a/VM2-6/config.sls b/VM2-6/config.sls new file mode 100644 index 0000000..a844d2a --- /dev/null +++ b/VM2-6/config.sls @@ -0,0 +1,46 @@ +# Configuration eth1 et eth2 +# RAPPEL: eth0 est à vagrant, ne pas y toucher + +## Désactivation de network-manager +NetworkManager: + service: + - dead + - enable: False + +## Suppression de la passerelle par défaut +ip route del default: + cmd: + - run + +## Configuration de VM2 +eth1: + network.managed: + - enabled: True + - type: eth + - proto: none + - enable_ipv4: false + - ipv6proto: static + - enable_ipv6: true + - ipv6_autoconf: no + - ipv6ipaddr: fc00:1234:1::26 + - ipv6netmask: 64 + +eth2: + network.managed: + - enabled: True + - type: eth + - proto: none + - enable_ipv4: false + - ipv6proto: static + - enable_ipv6: true + - ipv6_autoconf: no + - ipv6ipaddr: fc00:1234:2::26 + - ipv6netmask: 64 + +## No need to add routes + +## But enable ipv6 forwarding +net.ipv6.conf.all.forwarding: + sysctl: + - present + - value: 1 diff --git a/VM2-6/top.sls b/VM2-6/top.sls new file mode 100644 index 0000000..331b688 --- /dev/null +++ b/VM2-6/top.sls @@ -0,0 +1,5 @@ +base: + '*': + - config + + diff --git a/VM2/Vagrantfile b/VM2/Vagrantfile new file mode 100644 index 0000000..cc2f4e4 --- /dev/null +++ b/VM2/Vagrantfile @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + +##### Vos Configurations + config.vm.box = "vm2" + + # Ajout d'une interface réseau (privée) + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN1" + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN2" + + +##### NE PAS MODIFIER CETTE PARTIE + config.vm.hostname = File.basename(Dir.getwd) + +### Dossiers partagés + config.vm.synced_folder ".", "/vagrant", owner: "m1reseaux" + config.vm.synced_folder "../partage", "/mnt/partage", create: true, owner: "m1reseaux" + + + config.vm.provider "virtualbox" do |vb| + # Commenter pour s'exécuter sans GUI + vb.gui = true + + vb.customize ["modifyvm", :id, "--memory", "768"] + end + +end diff --git a/VM2/config.sls b/VM2/config.sls new file mode 100644 index 0000000..ca1820d --- /dev/null +++ b/VM2/config.sls @@ -0,0 +1,50 @@ +# Configuration eth1 et eth2 +# RAPPEL: eth0 est à vagrant, ne pas y toucher + +## Désactivation de network-manager +NetworkManager: + service: + - dead + - enable: False + +## Suppression de la passerelle par défaut +ip route del default: + cmd: + - run + +## Configuration de VM2 +eth1: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.132 + - netmask: 28 + +eth2: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.162 + - netmask: 28 + +## But enable ipv4 forwarding +net.ipv4.ip_forward: + sysctl: + - present + - value: 1 + +routes: + network.routes: + - name: eth1 + - routes: + - name: LAN3 + ipaddr: 172.16.2.144/28 + gateway: 172.16.2.131 + + - name: eth2 + - routes: + - name: LAN4 + ipaddr: 172.16.2.176/28 + gateway: 172.16.2.163 diff --git a/VM2/top.sls b/VM2/top.sls new file mode 100644 index 0000000..331b688 --- /dev/null +++ b/VM2/top.sls @@ -0,0 +1,5 @@ +base: + '*': + - config + + diff --git a/VM3-6/Vagrantfile b/VM3-6/Vagrantfile new file mode 100644 index 0000000..806afd1 --- /dev/null +++ b/VM3-6/Vagrantfile @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + +##### Vos Configurations + config.vm.box = "vm3-6" + + # Ajout d'une interface réseau (privée) + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN2-6" + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN4" + + +##### NE PAS MODIFIER CETTE PARTIE + config.vm.hostname = File.basename(Dir.getwd) + +### Dossiers partagés + config.vm.synced_folder ".", "/vagrant", owner: "m1reseaux" + config.vm.synced_folder "../partage", "/mnt/partage", create: true, owner: "m1reseaux" + + + config.vm.provider "virtualbox" do |vb| + # Commenter pour s'exécuter sans GUI + vb.gui = true + + vb.customize ["modifyvm", :id, "--memory", "768"] + end + +end diff --git a/VM3-6/config.sls b/VM3-6/config.sls new file mode 100644 index 0000000..43565a3 --- /dev/null +++ b/VM3-6/config.sls @@ -0,0 +1,61 @@ +# Configuration eth1 +# RAPPEL: eth0 est à vagrant, ne pas y toucher + +## Désactivation de network-manager +NetworkManager: + service: + - dead + - enable: False + +## Suppression de la passerelle par défaut +ip route del default: + cmd: + - run + +## Configuration de VM3 +eth1: + network.managed: + - enabled: True + - type: eth + - proto: none + - enable_ipv4: false + - ipv6proto: static + - enable_ipv6: true + - ipv6_autoconf: no + - ipv6ipaddr: fc00:1234:2::36 + - ipv6netmask: 64 + +eth2: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.186 + - netmask: 28 + +## Configuration de la route vers LAN1 via VM2 +routes: + network.routes: + - name: eth2 + - routes: + - name: LAN1 + ipaddr: 172.16.2.128/28 + gateway: 172.16.2.183 + + - name: eth2-2 + - routes: + - name: LAN2 + ipaddr: 172.16.2.160/28 + gateway: 172.16.2.183 + + - name: eth2-3 + - routes: + - name: LAN3 + ipaddr: 172.16.2.144/28 + gateway: 172.16.2.183 + + - name: eth1 + - routes: + - name: LAN1-6 + ipv6ipaddr: fc00:1234:1::/64 + gateway: fc00:1234:2::26 diff --git a/VM3-6/top.sls b/VM3-6/top.sls new file mode 100644 index 0000000..331b688 --- /dev/null +++ b/VM3-6/top.sls @@ -0,0 +1,5 @@ +base: + '*': + - config + + diff --git a/VM3/Vagrantfile b/VM3/Vagrantfile new file mode 100644 index 0000000..f83c2eb --- /dev/null +++ b/VM3/Vagrantfile @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + +##### Vos Configurations + config.vm.box = "vm3" + + # Ajout d'une interface réseau (privée) + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN2" + config.vm.network "private_network", ip:"0.0.0.0", auto_config: false, virtualbox__intnet: "LAN4" + + +##### NE PAS MODIFIER CETTE PARTIE + config.vm.hostname = File.basename(Dir.getwd) + +### Dossiers partagés + config.vm.synced_folder ".", "/vagrant", owner: "m1reseaux" + config.vm.synced_folder "../partage", "/mnt/partage", create: true, owner: "m1reseaux" + + + config.vm.provider "virtualbox" do |vb| + # Commenter pour s'exécuter sans GUI + vb.gui = true + + vb.customize ["modifyvm", :id, "--memory", "768"] + end + +end diff --git a/VM3/config.sls b/VM3/config.sls new file mode 100644 index 0000000..30829e8 --- /dev/null +++ b/VM3/config.sls @@ -0,0 +1,50 @@ +# Configuration eth1 +# RAPPEL: eth0 est à vagrant, ne pas y toucher + +## Désactivation de network-manager +NetworkManager: + service: + - dead + - enable: False + +## Suppression de la passerelle par défaut +ip route del default: + cmd: + - run + +## Configuration de VM3 +eth1: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.163 + - netmask: 28 + +eth2: + network.managed: + - enabled: True + - type: eth + - proto: none + - ipaddr: 172.16.2.183 + - netmask: 28 + +net.ipv4.ip_forward: + sysctl: + - present + - value: 1 + +## Configuration de la route vers LAN1 via VM2 +routes: + network.routes: + - name: eth1 + - routes: + - name: LAN1 + ipaddr: 172.16.2.128/28 + gateway: 172.16.2.162 + + - name: eth1-2 + - routes: + - name: LAN3 + ipaddr: 172.16.2.144/28 + gateway: 172.16.2.162 diff --git a/VM3/top.sls b/VM3/top.sls new file mode 100644 index 0000000..331b688 --- /dev/null +++ b/VM3/top.sls @@ -0,0 +1,5 @@ +base: + '*': + - config + + diff --git a/compte_rendu.txt b/compte_rendu.txt new file mode 100644 index 0000000..1dc1c39 --- /dev/null +++ b/compte_rendu.txt @@ -0,0 +1,5 @@ +2.2.3. La capture est vide car c’est notre propre adresse ip et le + noyau nous renvoie le paquet sans le faire passer par + l’interface. + +2.2.4. On voit cette fois les requêtes echo qui n’aboutissent pas. diff --git a/partage/config.sh b/partage/config.sh new file mode 100755 index 0000000..381da5b --- /dev/null +++ b/partage/config.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +if [ $(id -u) != 0 ]; then + setxkbmap fr bepo -option ctrl:nocaps + xset r rate 200 30 + exit 0 +fi + +sysctl -w net.ipv4.ip_forward=1 +sysctl -w net.ipv6.conf.all.forwarding=1 + +lan1=172.16.2.128/28 +lan2=172.16.2.160/28 +lan3=172.16.2.144/28 +lan4=172.16.2.176/28 +lan1_6=fc00:1234:1::/64 +lan2_6=fc00:1234:2::/64 + +case $(hostname) in + vm1) + ip address add 172.16.2.131/28 dev eth1 + ip address add 172.16.2.151/28 dev eth2 + ip route add $lan2 via 172.16.2.132 + ip route add $lan4 via 172.16.2.132 + ;; + vm2) + ip address add 172.16.2.132/28 dev eth1 + ip address add 172.16.2.162/28 dev eth2 + ip route add $lan3 via 172.16.2.131 + ip route add $lan4 via 172.16.2.163 + ;; + vm3) + ip address add 172.16.2.163/28 dev eth1 + ip address add 172.16.2.183/28 dev eth2 + ip route add $lan1 via 172.16.2.162 + ip route add $lan3 via 172.16.2.162 + ;; + vm1-6) + ip address add 172.16.2.156/28 dev eth1 + ip address add fc00:1234:1::16/64 dev eth2 + ip route add $lan2_6 via fc00:1234:1::26 + ip route add $lan1 via 172.16.2.151 + ip route add $lan2 via 172.16.2.151 + ip route add $lan4 via 172.16.2.151 + ;; + vm2-6) + ip address add fc00:1234:1::26/64 dev eth1 + ip address add fc00:1234:2::26/64 dev eth2 + ;; + vm3-6) + ip address add fc00:1234:2::26/64 dev eth1 + ip address add 172.16.2.186/28 dev eth2 + ip route add $lan1_6 via fc00:1234:2::26 + ip route add $lan1 via 172.16.2.183 + ip route add $lan2 via 172.16.2.183 + ip route add $lan3 via 172.16.2.183 + ;; + *) + echo "Nom d’hôte non reconu." + exit 1 + ;; +esac