diff --git a/TP_BD/fichiereponsetp2.sql b/TP_BD/fichiereponsetp2.sql index 9bcf124..1910ea3 100644 --- a/TP_BD/fichiereponsetp2.sql +++ b/TP_BD/fichiereponsetp2.sql @@ -12,3 +12,4 @@ BEGIN SELECT p.prix_unitaire*lc.p_quantite into v_prix_total FROM Produit p, Ligne_commande lc WHERE p.id=p_produit_id INSERT INTO Ligne_commande values (seq_t.NEXT, p_commande_id, p_produit_id, p_quantite,v_prix_total) +END; diff --git a/TP_BD/fichiereponsetp3.sql b/TP_BD/fichiereponsetp3.sql new file mode 100644 index 0000000..8b99229 --- /dev/null +++ b/TP_BD/fichiereponsetp3.sql @@ -0,0 +1,26 @@ +--sqlplus "val@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=lorien.arda.lan)(Port=1521))(CONNECT_DATA=(SID=ORCLIUT)))" + +1. CREATE OR REPLACE PROCEDURE sp_DateDernierAchat(Nom_Produit VARCHAR) +IS +v_date_recent DATE; +BEGIN +Select MAX(date_achat) INTO v_date_recent FROM Commande c JOIN ligne_commande lc ON c.id=lc.commande_id JOIN Produit p ON lc.produit_id=p.id where p.nom_produit=Nom_Produit; +DBMS_OUTPUT.PUT_LINE('le produit '||Nom_Produit||' a pour dernière '||v_date_recent); +END sp_DateDernierAchat; + +2. ALTER TABLE Produit add quantite_en_stock number DEFAULT 10; + +3. CREATE OR REPLACE TRIGGER trg_GestionStock +BEFORE INSERT +ON ligne_commande lc +FOR EACH ROW +v_quantite number; +BEGIN +SELECT quantite_en_stock into v_quantite from Produit p where p.id=ligne_commande.produit +IF:new.quantite<=v_quantite +UDAPTE Produit p +p_commande_id +SET +--WHEN (new.quatite<=quantite_en_stock) + + diff --git a/TP_DEV3.2/Genericite/Exodeux.class b/TP_DEV3.2/Genericite/Exodeux.class index c10581d..da810b5 100644 Binary files a/TP_DEV3.2/Genericite/Exodeux.class and b/TP_DEV3.2/Genericite/Exodeux.class differ diff --git a/TP_DEV3.2/Genericite/Exodeux.java b/TP_DEV3.2/Genericite/Exodeux.java index a1ff7e0..176f71b 100644 --- a/TP_DEV3.2/Genericite/Exodeux.java +++ b/TP_DEV3.2/Genericite/Exodeux.java @@ -10,7 +10,7 @@ public static void main (String[] args) { AfficherTouslesArgs(args); AfficherLes5erArgs(args); trierEtAfficherNaturel(args); -trierEtAffiicherSansCasse(args); +trierEtAffiicher(args); } @@ -54,14 +54,14 @@ System.out.println("Tri naturel" + NaturelTriage); } -public static void trierEtAffiicherSansCasse(String[] args){ +public static void trierEtAffiicher(String[] args){ String[] copyArgument = Arrays.copyOf(args, args.length); -Arrays.sort(copyArgument,String::compareToIgnoreCase); // Comparator.nullsLast(String::compareToIgnoreCase); +Arrays.sort(copyArgument,Comparator.nullsLast(String::compareTo)); //Comparator.nullsLast(String::compareTo); String::compareToIgnoreCase String Sanscassetriernickelchrome = Arrays.toString(copyArgument); -System.out.println("Tri sans casse naturel : "+ sanscassetriernickelchrome); +System.out.println("Tri sans casse naturel : "+ Sanscassetriernickelchrome); diff --git a/TP_DEV3.2/Repertoires.java b/TP_DEV3.2/Repertoires.java new file mode 100644 index 0000000..f99e301 --- /dev/null +++ b/TP_DEV3.2/Repertoires.java @@ -0,0 +1,73 @@ +import java.io.File; +import java.util.ArrayList; +import java.util.List; + + +public class Repertoires { + + +String name; +List children = new ArrayList<>(); + +public Node(String name){ + + this.name=name; + +} + +public addChild(Node child){ + +children.add(child); + +} + +public afficher(String nom){ + + System.out.println(nom+name); + + for(Node c : children){ + + c.print(nom+""); + + } + + +} +public static Node build(File f){ + +Node n = new Node(file.getName()); +File[] list = f.listFiles(); +if(list!=null){ + +for(File child : list){ + + n.addChild(build(child)); +} + +} + +return n; + + + +} + + +public static void main(String[] args) { + +File fichier = New File(args[0]); +Node tree = build(Dictionnaire); + +tree.afficher(""); + + + + + +} + + + + + +} \ No newline at end of file diff --git a/TP_DEV4.1/TP1/Ex1/Exo1S2.js b/TP_DEV4.1/TP1/Ex1/Exo1S2.js new file mode 100644 index 0000000..ee509c9 --- /dev/null +++ b/TP_DEV4.1/TP1/Ex1/Exo1S2.js @@ -0,0 +1,70 @@ +'use strict'; + +let customers = [ + { + 'id': 1, + 'f_name': 'Abby', + 'l_name': 'Thomas', + 'gender': 'M', + 'married': true, + 'age': 32, + 'expense': 500, + 'purchased': ['Shampoo', 'Toys', 'Book'] + }, + { + 'id': 2, + 'f_name': 'Jerry', + 'l_name': 'Tom', + 'gender': 'M', + 'married': true, + 'age': 64, + 'expense': 100, + 'purchased': ['Stick', 'Blade'] + }, + { + 'id': 3, + 'f_name': 'Dianna', + 'l_name': 'Cherry', + 'gender': 'F', + 'married': true, + 'age': 22, + 'expense': 1500, + 'purchased': ['Lipstik', 'Nail Polish', 'Bag', 'Book'] + }, + { + 'id': 4, + 'f_name': 'Dev', + 'l_name': 'Currian', + 'gender': 'M', + 'married': true, + 'age': 82, + 'expense': 90, + 'purchased': ['Book'] + }, + { + 'id': 5, + 'f_name': 'Maria', + 'l_name': 'Gomes', + 'gender': 'F', + 'married': false, + 'age': 7, + 'expense': 300, + 'purchased': ['Toys'] + }, + { + 'id': 6, + 'f_name': 'Homer', + 'l_name': 'Simpson', + 'gender': 'M', + 'married': true, + 'age': 39, + 'expense': 500, + 'purchased': ['Book'] + } +]; + +console.log("donnée"); +console.table(customers); + +const table_seniors = customers.filter(customer=>customers.age>=60); +console.log("Donnée seniors :",table_seniors); \ No newline at end of file diff --git a/TP_DEV4.1/TP1/Ex1/index.html b/TP_DEV4.1/TP1/Ex1/index.html new file mode 100644 index 0000000..87d0c52 --- /dev/null +++ b/TP_DEV4.1/TP1/Ex1/index.html @@ -0,0 +1,13 @@ + + + + + + + Index.html + + + +

This ia my first page.

+ + \ No newline at end of file diff --git a/TP_DEV4.1/TP2MVC/controller.js b/TP_DEV4.1/TP2MVC/controller.js new file mode 100644 index 0000000..c837fa1 --- /dev/null +++ b/TP_DEV4.1/TP2MVC/controller.js @@ -0,0 +1,64 @@ +class Controller { + constructor(model, view) { + + this.model = model; + this.view = view; + this.filter = "all"; + + /** Abonnements à la vue **/ + + this.view.bindAddTodo(this.addTodo.bind(this)); + this.view.bindDeleteTodo(this.deleteTodo.bind(this)); + this.view.bindToggleTodo(this.toggleTodo.bind(this)); + this.view.bindEditTodo(this.editTodo.bind(this)); + + /** filtrages par url **/ + + this.routes = ['all','active','done']; + + /** Routage **/ + window.addEventListener("load",this.routeChanged.bind(this)); + window.addEventListener("hashchange",this.routeChanged.bind(this)); + } + + + routeChanged(){ + let route = window.location.hash.replace(/^#\//,''); + this.filter = this.routes.find( r => r === route) || 'all'; + this.filterTodoList(); + } + + + + + filterTodoList () { + let todos = this.model.getTodos(this.filter) + this.view.renderTodoList(todos) + this.view.setFilterTabs(this.filter) + } + + addTodo(text) { + this.model.add(text) + this.filterTodoList() + } + + deleteTodo(id) { + this.model.delete(parseInt(id)) + this.filterTodoList() + } + + toggleTodo(id) { + this.model.toggle(parseInt(id)) + this.filterTodoList() + } + + editTodo(id, text) { + this.model.edit(parseInt(id),text) + this.filterTodoList() + } +} + +const model = new Model() +const view = new View() +const app = new Controller(model, view) + diff --git a/TP_DEV4.1/TP2MVC/index.html b/TP_DEV4.1/TP2MVC/index.html new file mode 100644 index 0000000..a652640 --- /dev/null +++ b/TP_DEV4.1/TP2MVC/index.html @@ -0,0 +1,53 @@ + + + + + + + + Todo + + + + + + + +
+

To Do List

+
+ +
+
+
+
+
+ + +
+
+ + + + + + + 0/50 characters +
+
+
+ +
    +
    +
    + + + + + + + + diff --git a/TP_DEV4.1/TP2MVC/model.js b/TP_DEV4.1/TP2MVC/model.js new file mode 100644 index 0000000..cde92cc --- /dev/null +++ b/TP_DEV4.1/TP2MVC/model.js @@ -0,0 +1,48 @@ +class Model { + constructor() { + this.todos = JSON.parse(localStorage.getItem('todos')) || [] + } + + #commit(todos) { + localStorage.setItem('todos', JSON.stringify(todos)) + } + + getTodos(filter){ + if (filter === "active") + return this.todos.filter(todo => !todo.done) + if (filter === "done") + return this.todos.filter(todo => todo.done) + + return this.todos + } + + add(todoText) { + const todo = { + id: this.todos.length > 0 ? this.todos[this.todos.length - 1].id + 1 : 1, + text: todoText, + done : false, + } + this.todos.push(todo) + this.#commit(this.todos) + } + + edit(id, updatedText) { + this.todos = this.todos.map(todo => + todo.id === id ? { id: todo.id, text: updatedText, done: todo.done} : todo + ) + this.#commit(this.todos) + } + + delete(id) { + this.todos = this.todos.filter(todo => todo.id !== id) + this.#commit(this.todos) + } + + toggle(id) { + this.todos = this.todos.map(todo => + todo.id === id ? { id: todo.id, text: todo.text, done: !todo.done } : todo + ) + this.#commit(this.todos) + } +} + diff --git a/TP_DEV4.1/TP2MVC/style.css b/TP_DEV4.1/TP2MVC/style.css new file mode 100644 index 0000000..a2185a4 --- /dev/null +++ b/TP_DEV4.1/TP2MVC/style.css @@ -0,0 +1,63 @@ +:focus-visible {outline:none;} + +.is-active { + color : #8EB901; +} + +#add_form > div { + display : flex; + justify-content:space-between; +} + +.todo { + display : flex; + align-items: center; +} +.todo checkbox,.todo i { + flex-grow : 0; + flex-shrink : 0; + flex-basis : auto; +} +.todo span { + flex-grow : 1; + flex-shrink : 1; + flex-basis : auto; +} + + +.todolist { + padding-left: 0; +} + +.todolist li { + list-style: none; + padding: var(--pico-form-element-spacing-vertical) 0; + display: flex; + justify-content: space-between; + align-items: center; +} +#todos_filter { + display:flex; + justify-content : center; +} + +#todos_filter a { + margin:1em; +} + +.todolist i { + cursor: pointer; +} + +.todolist li:not(:last-child) { + border-bottom: 1.5px solid var(--pico-form-element-border-color); +} + +.todolist > li > label:has(input:checked) { + text-decoration: line-through; +} + +footer { + text-align: center; +} + diff --git a/TP_DEV4.1/TP2MVC/todo.png b/TP_DEV4.1/TP2MVC/todo.png new file mode 100644 index 0000000..26a6585 Binary files /dev/null and b/TP_DEV4.1/TP2MVC/todo.png differ diff --git a/TP_DEV4.1/TP2MVC/view.js b/TP_DEV4.1/TP2MVC/view.js new file mode 100644 index 0000000..e2e6c56 --- /dev/null +++ b/TP_DEV4.1/TP2MVC/view.js @@ -0,0 +1,100 @@ +class View { + charLimit = 70; + + constructor() { + this.form = document.querySelector("#add_form") + this.input = document.querySelector("#input_todo") + this.list = document.querySelector("#todos_list") + this.tabs = document.querySelectorAll("#add_form span a") + this.loader = document.querySelector("#loader") + this.count = document.querySelector("#count") + + + this.input.addEventListener("input", (e) => { + if (e.target.value.length >= this.charLimit) { + e.target.value = e.target.value.substring(0,this.charLimit); + } + count.textContent = e.target.value.length; + }); + count.nextSibling.textContent = `/${this.charLimit} characters` + } + + #getTodo() { + return this.input.value + } + + #resetInput() { + this.input.value = '' + count.textContent = 0 + } + + #createNewTodoElement(todo){ + let li = document.createElement("li") + li.classList.add("todo"); + li.dataset.id = todo.id; + + let label = document.createElement("label"); + + let checkbox = document.createElement("input"); + + checkbox.type = "checkbox"; + checkbox.checked = todo.done; + + let span = document.createElement("span"); + + span.textContent = todo.text; + + let trash = document.createElement("i"); + trash.classList.add("fas","fa-trash"); + label.append(checkbox, span); + label.append(label, trash); + return li + } + + + setFilterTabs(filter){ + this.tabs.forEach( tab => { + if (filter === tab.id) + tab.classList.add("is-active") + else + tab.classList.remove("is-active") + }) + } + + renderTodoList(todos) { + let list = new DocumentFragment() + for (let todo of todos){ + list.appendChild(this.#createNewTodoElement(todo)) + } + this.list.replaceChildren(list) + } + + + + + /** Abonnements événements **/ + + bindAddTodo(handler) { + this.form.addEventListener("submit", (e=>{ + e.preventDefault() + let text = this.#getTodo() + handler(text) + this.#resetInput() + })) + } + + + bindDeleteTodo(handler) { + this.form.addEventListener("click", (e=>{ + + let id = li.dataset. + } + + bindEditTodo(handler) { + // TODO + } + + bindToggleTodo(handler) { + // TODO + } +} diff --git a/TP_DEV4.2/Dockerfile b/TP_DEV4.2/Dockerfile new file mode 100644 index 0000000..1a180ab --- /dev/null +++ b/TP_DEV4.2/Dockerfile @@ -0,0 +1,9 @@ +FROM gcc:14 + +WORKDIR /app + +COPY main.c . + +RUN gcc main.c -o app + +CMD ["./app"] diff --git a/TP_DEV4.2/main.c b/TP_DEV4.2/main.c new file mode 100644 index 0000000..8d10266 --- /dev/null +++ b/TP_DEV4.2/main.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello depuis un container Docker (C)!\n"); + return 0; +} diff --git a/TP_SCR3.2/TP01/tp01-reponse.txt b/TP_SCR3.2/TP01/tp01-reponse.txt index 14abd3a..0f6da22 100644 --- a/TP_SCR3.2/TP01/tp01-reponse.txt +++ b/TP_SCR3.2/TP01/tp01-reponse.txt @@ -4,4 +4,603 @@ TP01 1. 1) Dans le host on doit ajouté une regle chain iptables -2) iptables -t nat(pour router) -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254(pour dire que c'est uen adresse son reseau qui le ping) \ No newline at end of file +2) iptables -t nat(pour router) -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254(pour dire que c'est uen adresse son reseau qui le ping) + +FICHIER one-gateway.imn : "node n0 { + type pc + network-config { + hostname pc2-1 + ! + interface eth0 + mac address 42:00:aa:00:00:04 + ip address 172.16.2.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {144 120} + labelcoords {144 151} + interface-peer {eth0 n3} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.2.1/24 dev eth0 + ip -6 addr add ::1/128 dev lo0 + ip addr add 172.16.2.1/24 dev eth0 + ip route add default via 172.16.2.254 + + } + } + } + custom-selected default +} + +node n2 { + type host + network-config { + hostname host1 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 172.16.2.254/24 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 172.16.1.254/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {336 336} + labelcoords {336 372} + interface-peer {eth0 n1} + interface-peer {eth1 n3} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.254/24 dev eth0 + ip addr add 172.16.2.254/24 dev eth1 + ip -6 addr add ::1/128 dev lo0 + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n4 { + type pc + network-config { + hostname pc2-2 + ! + interface eth0 + mac address 42:00:aa:00:00:05 + ip address 172.16.2.2/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {384 48} + labelcoords {384 79} + interface-peer {eth0 n3} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.2.2/24 dev eth0 + ip -6 addr add ::1/128 dev lo0 + ip addr add 172.16.2.2/24 dev eth0 + ip route add default via 172.16.2.254 + + + } + } + } + custom-selected default +} + +node n5 { + type pc + network-config { + hostname pc1-1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 172.16.1.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 172.16.2.0/24 172.16.1.254 + ! + } + canvas c0 + iconcoords {48 528} + labelcoords {48 559} + interface-peer {eth0 n1} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.1/24 dev eth0 + ip -6 addr add ::1/128 dev lo0 + ip addr add 172.16.1.1/24 dev eth0 + ip route add default via 172.16.1.254 + ip route append 172.16.2.0/24 via 172.16.1.254 + + } + } + } + custom-selected default +} + +node n6 { + type pc + network-config { + hostname pc1-2 + ! + interface eth0 + mac address 42:00:aa:00:00:01 + ip address 172.16.1.2/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 172.16.2.0/24 172.16.1.254 + ! + } + canvas c0 + iconcoords {240 504} + labelcoords {240 535} + interface-peer {eth0 n1} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.2/24 dev eth0 + ip -6 addr add ::1/128 dev lo0 + ip addr add 172.16.1.2/24 dev eth0 + ip route add default via 172.16.1.254 + ip route append 172.16.2.0/24 via 172.16.1.254 + + } + } + } + custom-selected default +} + +node n1 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {48 360} + labelcoords {48 383} + interface-peer {e0 n5} + interface-peer {e1 n6} + interface-peer {e2 n2} +} + +node n3 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {360 192} + labelcoords {360 215} + interface-peer {e0 n2} + interface-peer {e1 n0} + interface-peer {e2 n4} +} + +link l0 { + nodes {n5 n1} + bandwidth 0 +} + +link l1 { + nodes {n6 n1} + bandwidth 0 +} + +link l2 { + nodes {n2 n1} + bandwidth 0 +} + +link l3 { + nodes {n2 n3} + bandwidth 0 +} + +link l4 { + nodes {n0 n3} + bandwidth 0 +} + +link l5 { + nodes {n4 n3} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + +" + +FICHIER two-gateway.imn : "node n0 { + type pc + network-config { + hostname pc2-1 + ! + interface eth0 + mac address 42:00:aa:00:00:04 + ip address 172.16.2.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 172.16.2.252 + ! + } + canvas c0 + iconcoords {408 552} + labelcoords {408 583} + interface-peer {eth0 n3} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.2.1/24 dev eth0 + ip -6 addr add ::1/128 dev lo0 + ip addr add 172.16.2.1/24 dev eth0 + ip route add default via 172.16.2.254 + + } + } + } + custom-selected default +} + +node n2 { + type host + network-config { + hostname host1 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 172.16.2.254/24 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 172.16.1.254/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {216 24} + labelcoords {216 60} + interface-peer {eth0 n1} + interface-peer {eth1 n3} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.254/24 dev eth0 + ip addr add 172.16.2.254/24 dev eth1 + ip -6 addr add ::1/128 dev lo0 + iptables -t filter -A FORWARD -d 172.16.3.0/24 -j DROP + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254 + ip route add 0.0.0.0/0 via 172.16.2.252 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n5 { + type pc + network-config { + hostname pc1-1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 172.16.1.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 172.16.1.254 + ! + } + canvas c0 + iconcoords {48 528} + labelcoords {48 559} + interface-peer {eth0 n1} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.1/24 dev eth0 + ip -6 addr add ::1/128 dev lo0 + ip addr add 172.16.1.1/24 dev eth0 + ip route add default via 172.16.1.254 + ip route append 172.16.2.0/24 via 172.16.1.254 + + } + } + } + custom-selected default +} + +node n1 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {48 288} + labelcoords {54 309} + interface-peer {e0 n5} + interface-peer {e2 n2} +} + +node n3 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {408 312} + labelcoords {408 335} + interface-peer {e0 n2} + interface-peer {e1 n0} + interface-peer {e3 n7} +} + +node n7 { + type host + network-config { + hostname host2 + ! + interface eth2 + mac address 42:00:aa:00:00:0b + ip address 10.0.0.250/8 + ! + interface eth0 + mac address 42:00:aa:00:00:06 + ip address 172.16.2.252/24 + ! + interface eth1 + mac address 42:00:aa:00:00:09 + ip address 172.16.3.251/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {744 288} + labelcoords {744 324} + interface-peer {eth0 n3} + interface-peer {eth1 n10} + interface-peer {eth2 n11} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.2.252/24 dev eth0 + ip addr add 172.16.3.251/24 dev eth1 + ip addr add 10.0.0.250/8 dev eth2 + + ip -6 addr add ::1/128 dev lo0 + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.3.251 + iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 10.0.0.250 + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n8 { + type pc + network-config { + hostname pc3-1 + ! + interface eth0 + mac address 42:00:aa:00:00:07 + ip address 172.16.3.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {672 24} + labelcoords {672 55} + interface-peer {eth0 n10} +} + +node n10 { + type lanswitch + network-config { + hostname switch3 + ! + } + canvas c0 + iconcoords {840 168} + labelcoords {890 202} + interface-peer {e0 n8} + interface-peer {e2 n7} +} + +node n11 { + type router + model quagga + network-config { + hostname WideNet + ! + interface eth0 + mac address 42:00:aa:00:00:0a + ip address 10.0.0.1/8 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {816 552} + labelcoords {816 577} + interface-peer {eth0 n7} +} + +link l0 { + nodes {n5 n1} + bandwidth 0 +} + +link l2 { + nodes {n2 n1} + bandwidth 0 +} + +link l3 { + nodes {n2 n3} + bandwidth 0 +} + +link l4 { + nodes {n0 n3} + bandwidth 0 +} + +link l6 { + nodes {n7 n3} + bandwidth 0 +} + +link l7 { + nodes {n10 n8} + bandwidth 0 +} + +link l9 { + nodes {n7 n10} + bandwidth 0 +} + +link l10 { + nodes {n11 n7} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + +" \ No newline at end of file diff --git a/TP_SCR3.2/TP02/with-routers.imn b/TP_SCR3.2/TP02/with-routers.imn index 444c700..9a92630 100644 --- a/TP_SCR3.2/TP02/with-routers.imn +++ b/TP_SCR3.2/TP02/with-routers.imn @@ -35,7 +35,7 @@ node n1 { ip address 127.0.0.1/8 ipv6 address ::1/128 ! - ip route 0.0.0.0/0 172.16.2.0 + ip route 0.0.0.0/0 172.16.2.254 ! } canvas c0 @@ -222,7 +222,7 @@ node n9 { ip address 127.0.0.1/8 ipv6 address ::1/128 ! - ip route 37.37.36.0/22 37.37.37.254 + ip route 0.0.0.0/0 37.37.37.254 ! } canvas c0 @@ -260,6 +260,8 @@ node n10 { ip address 127.0.0.1/8 ipv6 address ::1/128 ! + ip route 45.45.45.0/21 45.45.45.254 + ! } auto_default_routes enabled canvas c0 @@ -282,6 +284,8 @@ node n11 { ip address 127.0.0.1/8 ipv6 address ::1/128 ! + ip route 45.45.45.0/21 45.45.45.254 + ! } auto_default_routes enabled canvas c0 diff --git a/TP_SCR3.2/TP02/yolou-3-tp02.imn b/TP_SCR3.2/TP02/yolou-3-tp02.imn new file mode 100644 index 0000000..0b6d0fd --- /dev/null +++ b/TP_SCR3.2/TP02/yolou-3-tp02.imn @@ -0,0 +1,549 @@ +node n0 { + type host + network-config { + hostname GW1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 172.16.1.253/24 + ! + interface eth1 + mac address 42:00:aa:00:00:01 + ip address 172.16.2.253/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {312 216} + labelcoords {339 144} + interface-peer {eth0 n3} + interface-peer {eth1 n2} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.253/24 dev eth0 + ip addr add 172.16.2.253/24 dev eth1 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.2.0/24 via 172.16.2.253 + ip route add 172.16.1.0/24 via 172.16.1.253 + ip route add 0.0.0.0/0 via 172.16.2.253 + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.253 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n1 { + type host + network-config { + hostname GW2 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 172.16.3.254/24 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 172.16.2.254/24 + ! + interface eth2 + mac address 42:00:aa:00:00:04 + ip address 45.45.45.254/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + ! + ! + } + canvas c0 + iconcoords {672 336} + labelcoords {639 379} + interface-peer {eth0 n2} + interface-peer {eth1 n4} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.2.254/24 dev eth0 + ip addr add 172.16.3.254/24 dev eth1 + ip addr add 45.45.45.254/21 dev eth2 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.3.0/24 via 172.16.3.254 + ip route add 172.16.2.0/24 via 172.16.2.254 + ip route add 0.0.0.0/0 via 45.45.45.254 + ip route add 172.16.1.0/24 via 172.16.2.254 + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.3.251 + + + rpcbind + inetd + + } + } + } + custom-enabled true + interface-peer {eth2 n5} + custom-selected default +} + +node n2 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {552 144} + labelcoords {548 113} + interface-peer {e0 n0} + interface-peer {e1 n1} + interface-peer {e2 n7} + interface-peer {e3 n14} +} + +node n3 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {216 96} + labelcoords {214 59} + interface-peer {e0 n0} + interface-peer {e1 n6} +} + +node n4 { + type lanswitch + network-config { + hostname switch3 + ! + } + canvas c0 + iconcoords {840 96} + labelcoords {832 60} + interface-peer {e0 n1} + interface-peer {e1 n8} +} + +node n6 { + type pc + network-config { + hostname pc1 + ! + interface eth0 + mac address 42:00:aa:00:00:06 + ip address 172.16.1.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 172.16.1.253 + ! + } + canvas c0 + iconcoords {96 432} + labelcoords {96 463} + interface-peer {eth0 n3} +} + +node n7 { + type pc + network-config { + hostname pc2 + ! + interface eth0 + mac address 42:00:aa:00:00:08 + ip address 172.16.2.2/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 172.16.2.254 + ! + } + canvas c0 + iconcoords {360 480} + labelcoords {360 511} + interface-peer {eth0 n2} +} + +node n8 { + type pc + network-config { + hostname pc3 + ! + interface eth0 + mac address 42:00:aa:00:00:07 + ip address 172.16.3.3/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {960 240} + labelcoords {961 270} + interface-peer {eth0 n4} +} + +node n5 { + type lanswitch + network-config { + hostname switch4 + ! + interface e3 + ! + interface e2 + ! + interface e1 + ! + interface e0 + ! + ! + } + canvas c0 + iconcoords {744 528} + labelcoords {771 568} + interface-peer {e0 n1} + interface-peer {e1 n12} + interface-peer {e2 n13} + interface-peer {e3 n9} +} + +node n9 { + type router + model quagga + network-config { + hostname router1 + ! + interface eth1 + mac address 42:00:aa:00:00:0c + ip address 62.62.62.253/19 + ! + interface eth0 + mac address 42:00:aa:00:00:0a + ip address 45.45.45.253/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + canvas c0 + iconcoords {672 720} + labelcoords {672 745} + interface-peer {eth0 n5} + interface-peer {eth1 n10} +} + +node n10 { + type router + model quagga + network-config { + hostname router2 + ! + interface eth1 + mac address 42:00:aa:00:00:0d + ip address 37.37.37.254/22 + ! + interface eth0 + mac address 42:00:aa:00:00:0b + ip address 62.62.62.254/19 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + canvas c0 + iconcoords {288 672} + labelcoords {288 697} + interface-peer {eth0 n9} + interface-peer {eth1 n11} +} + +node n11 { + type pc + network-config { + hostname pc + ! + interface eth0 + mac address 42:00:aa:00:00:0e + ip address 37.37.37.1/22 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + ip route 0.0.0.0/0 37.37.37.254 + ! + } + canvas c0 + iconcoords {48 600} + labelcoords {48 631} + interface-peer {eth0 n10} +} + +node n12 { + type host + network-config { + hostname host1 + ! + interface eth0 + mac address 42:00:aa:00:00:05 + ip address 45.45.45.1/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {912 288} + labelcoords {912 324} + interface-peer {eth0 n5} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 45.45.45.1/21 dev eth0 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.3.0/24 via 45.45.45.254 + ip route add 172.16.2.0/24 via 45.45.45.254 + ip route add 0.0.0.0/0 via 45.45.45.253 + ip route add 172.16.1.0/24 via 45.45.45.254 + + rpcbind + inetd + + } + } + } + custom-selected default + custom-enabled true +} + +node n13 { + type host + network-config { + hostname host2 + ! + interface eth0 + mac address 42:00:aa:00:00:09 + ip address 45.45.45.2/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {984 648} + labelcoords {984 684} + interface-peer {eth0 n5} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 45.45.45.2/21 dev eth0 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.3.0/24 via 45.45.45.254 + ip route add 172.16.2.0/24 via 45.45.45.254 + ip route add 0.0.0.0/0 via 45.45.45.253 + ip route add 172.16.1.0/24 via 45.45.45.254 + + rpcbind + inetd + + } + } + } + custom-selected default + custom-enabled true +} + +node n14 { + type host + network-config { + hostname FTP + ! + interface eth0 + ip address 172.16.2.10/24 + mac address 42:00:aa:00:00:0f + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + auto_default_routes enabled + canvas c0 + iconcoords {720 24} + labelcoords {720 60} + interface-peer {eth0 n2} +} + +link l0 { + nodes {n0 n3} + bandwidth 0 +} + +link l1 { + nodes {n2 n0} + bandwidth 0 +} + +link l2 { + nodes {n1 n2} + bandwidth 0 +} + +link l3 { + nodes {n4 n1} + bandwidth 0 +} + +link l5 { + nodes {n3 n6} + bandwidth 0 +} + +link l6 { + nodes {n8 n4} + bandwidth 0 +} + +link l7 { + nodes {n7 n2} + bandwidth 0 +} + +link l4 { + nodes {n5 n1} + bandwidth 0 +} + +link l8 { + nodes {n12 n5} + bandwidth 0 +} + +link l9 { + nodes {n13 n5} + bandwidth 0 +} + +link l10 { + nodes {n9 n5} + bandwidth 0 +} + +link l11 { + nodes {n10 n9} + bandwidth 0 +} + +link l12 { + nodes {n11 n10} + bandwidth 0 +} + +link l13 { + nodes {n2 n14} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} + size {1000 820} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/TP_SCR3.2/TP02/yolou-3-tp02note.imn b/TP_SCR3.2/TP02/yolou-3-tp02note.imn new file mode 100644 index 0000000..1f28def --- /dev/null +++ b/TP_SCR3.2/TP02/yolou-3-tp02note.imn @@ -0,0 +1,524 @@ +node n0 { + type host + network-config { + hostname GW1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 172.16.1.253/24 + ! + interface eth1 + mac address 42:00:aa:00:00:01 + ip address 172.16.2.253/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {312 216} + labelcoords {339 144} + interface-peer {eth0 n3} + interface-peer {eth1 n2} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.1.253/24 dev eth0 + ip addr add 172.16.2.253/24 dev eth1 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.2.0/24 via 172.16.2.253 + ip route add 172.16.1.0/24 via 172.16.1.253 + ip route add 0.0.0.0/0 via 172.16.2.253 + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.253 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n1 { + type host + network-config { + hostname GW2 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 172.16.3.254/24 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 172.16.2.254/24 + ! + interface eth2 + mac address 42:00:aa:00:00:04 + ip address 45.45.45.254/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + ! + ! + } + canvas c0 + iconcoords {624 312} + labelcoords {591 355} + interface-peer {eth0 n2} + interface-peer {eth1 n4} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 172.16.2.254/24 dev eth0 + ip addr add 172.16.3.254/24 dev eth1 + ip addr add 45.45.45.254/21 dev eth2 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.3.0/24 via 172.16.3.254 + ip route add 172.16.2.0/24 via 172.16.2.254 + ip route add 0.0.0.0/0 via 45.45.45.254 + ip route add 172.16.1.0/24 via 172.16.2.254 + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.3.251 + + + rpcbind + inetd + + } + } + } + custom-enabled true + interface-peer {eth2 n5} + custom-selected default +} + +node n2 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {552 144} + labelcoords {548 113} + interface-peer {e0 n0} + interface-peer {e1 n1} + interface-peer {e2 n7} +} + +node n3 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {216 96} + labelcoords {214 59} + interface-peer {e0 n0} + interface-peer {e1 n6} +} + +node n4 { + type lanswitch + network-config { + hostname switch3 + ! + } + canvas c0 + iconcoords {840 96} + labelcoords {832 60} + interface-peer {e0 n1} + interface-peer {e1 n8} +} + +node n6 { + type pc + network-config { + hostname pc1 + ! + interface eth0 + mac address 42:00:aa:00:00:06 + ip address 172.16.1.1/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 172.16.1.253 + ! + } + canvas c0 + iconcoords {48 192} + labelcoords {48 223} + interface-peer {eth0 n3} +} + +node n7 { + type pc + network-config { + hostname pc2 + ! + interface eth0 + mac address 42:00:aa:00:00:08 + ip address 172.16.2.2/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 172.16.2.254 + ip route 172.16.2.0/24 172.16.2.254 + ip route 172.16.3.0/24 172.16.2.254 + ! + } + canvas c0 + iconcoords {408 336} + labelcoords {408 367} + interface-peer {eth0 n2} +} + +node n8 { + type pc + network-config { + hostname pc3 + ! + interface eth0 + mac address 42:00:aa:00:00:07 + ip address 172.16.3.3/24 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {960 240} + labelcoords {960 271} + interface-peer {eth0 n4} +} + +node n5 { + type lanswitch + network-config { + hostname switch4 + ! + interface e3 + ! + interface e2 + ! + interface e1 + ! + interface e0 + ! + ! + } + canvas c0 + iconcoords {744 528} + labelcoords {771 568} + interface-peer {e0 n1} + interface-peer {e1 n12} + interface-peer {e2 n13} + interface-peer {e3 n9} +} + +node n9 { + type router + model quagga + network-config { + hostname router1 + ! + interface eth1 + mac address 42:00:aa:00:00:0c + ip address 62.62.62.253/19 + ! + interface eth0 + mac address 42:00:aa:00:00:0a + ip address 45.45.45.253/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + canvas c0 + iconcoords {672 720} + labelcoords {672 745} + interface-peer {eth0 n5} + interface-peer {eth1 n10} +} + +node n10 { + type router + model quagga + network-config { + hostname router2 + ! + interface eth1 + mac address 42:00:aa:00:00:0d + ip address 37.37.37.254/22 + ! + interface eth0 + mac address 42:00:aa:00:00:0b + ip address 62.62.62.254/19 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + router rip + redistribute static + redistribute connected + redistribute ospf + network 0.0.0.0/0 + ! + router ripng + redistribute static + redistribute connected + redistribute ospf6 + network ::/0 + ! + } + canvas c0 + iconcoords {312 600} + labelcoords {312 625} + interface-peer {eth0 n9} + interface-peer {eth1 n11} +} + +node n11 { + type pc + network-config { + hostname pc + ! + interface eth0 + mac address 42:00:aa:00:00:0e + ip address 37.37.37.1/22 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + ip route 0.0.0.0/0 37.37.37.254 + ip route 171.16.2.0/24 37.37.37.254 + ip route 172.16.2.0/24 37.37.37.254 + ! + } + canvas c0 + iconcoords {48 600} + labelcoords {48 631} + interface-peer {eth0 n10} +} + +node n12 { + type host + network-config { + hostname host1 + ! + interface eth0 + mac address 42:00:aa:00:00:05 + ip address 45.45.45.1/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {864 336} + labelcoords {864 372} + interface-peer {eth0 n5} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 45.45.45.1/21 dev eth0 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.3.0/24 via 45.45.45.254 + ip route add 172.16.2.0/24 via 45.45.45.254 + ip route add 0.0.0.0/0 via 45.45.45.253 + ip route add 172.16.1.0/24 via 45.45.45.254 + + rpcbind + inetd + + } + } + } + custom-selected default + custom-enabled true +} + +node n13 { + type host + network-config { + hostname host2 + ! + interface eth0 + mac address 42:00:aa:00:00:09 + ip address 45.45.45.2/21 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {960 480} + labelcoords {960 516} + interface-peer {eth0 n5} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 45.45.45.2/21 dev eth0 + ip -6 addr add ::1/128 dev lo0 + + ip route add 172.16.3.0/24 via 45.45.45.254 + ip route add 172.16.2.0/24 via 45.45.45.254 + ip route add 0.0.0.0/0 via 45.45.45.253 + ip route add 172.16.1.0/24 via 45.45.45.254 + + rpcbind + inetd + + } + } + } + custom-selected default + custom-enabled true +} + +link l0 { + nodes {n0 n3} + bandwidth 0 +} + +link l1 { + nodes {n2 n0} + bandwidth 0 +} + +link l2 { + nodes {n1 n2} + bandwidth 0 +} + +link l3 { + nodes {n4 n1} + bandwidth 0 +} + +link l5 { + nodes {n3 n6} + bandwidth 0 +} + +link l6 { + nodes {n8 n4} + bandwidth 0 +} + +link l7 { + nodes {n7 n2} + bandwidth 0 +} + +link l4 { + nodes {n5 n1} + bandwidth 0 +} + +link l8 { + nodes {n12 n5} + bandwidth 0 +} + +link l9 { + nodes {n13 n5} + bandwidth 0 +} + +link l10 { + nodes {n9 n5} + bandwidth 0 +} + +link l11 { + nodes {n10 n9} + bandwidth 0 +} + +link l12 { + nodes {n11 n10} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} + size {1000 820} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses yes + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/TP_SCR3.2/TP03/TP03-reponses.txt b/TP_SCR3.2/TP03/TP03-reponses.txt new file mode 100644 index 0000000..55d8b58 --- /dev/null +++ b/TP_SCR3.2/TP03/TP03-reponses.txt @@ -0,0 +1,68 @@ +Tp03- + +I- + +4.touch /var/lib/dhcp/dhcpd.leases + +5. /etc/init.d/isc-dhcp-server start on le lance sur DHCPsrv + +7. Le numéro de port est le :67 et son nom est :bootps + + + + +II- +dans le dhcp on met: 172.16.2.0/24 192.168.10.254 + + + +1- host GW-eth0{ + hardware ethernet 42:00:aa:00:00:02; + fixed-address 172.16.2.254; +} + +host GW-eth1{ + hardware ethernet 42:00:aa:00:00:04; + fixed-address 192.168.10.254; +} + +2- +subnet 172.16.2.0 netmask 255.255.255.0 { + range 172.16.2.1 172.16.2.254; + // option routers 172.16.2.1; + option subnet-mask 255.255.255.0; + option broadcast-address 172.16.2.255; +} + + +3 et 4- sur GW: + +root@GW:/# dhcrelay -d 192.168.10.10 +Internet Systems Consortium DHCP Relay Agent 4.3.5 +Copyright 2004-2016 Internet Systems Consortium. +All rights reserved. +For info, please visit https://www.isc.org/software/dhcp/ +Listening on LPF/eth1/42:00:aa:00:00:04 +Sending on LPF/eth1/42:00:aa:00:00:04 +Listening on LPF/eth0/42:00:aa:00:00:02 +Sending on LPF/eth0/42:00:aa:00:00:02 +Sending on Socket/fallback +Forwarded BOOTREQUEST for 42:00:aa:00:00:06 to 192.168.10.10 + + +sur pc2-2 : + +root@pc2-2:/# dhclient -r eth0 +root@pc2-2:/# dhclient eth0 + +a) Le mac qui apparait est celui du client pc2-2 (42:00:aa:00:00:06) + +b) L'adresse est 172.16.2.254 (c'est celle de l'interface eth1 de GW sur le réseau 172.16.2.0/24 ) + +5) Le serveur reçoit des doublons car les requete dhcp sont des broadcasts, le gw peut relayer depuis plusieurs interfaces ce qui crée des double relay. + +6) DHCPDISCOVER,DHCPREQUEST + +7) dhcrelay -d -i eth1 192.168.10.10 (l'option -i eth1 demande à GW de ne pas remettre un message déjà traité) + +8) plus de doublon, un seul discover, un seul request, fonctionnement normal \ No newline at end of file diff --git a/TP_SCR3.2/TP03/dhcp-serv.imn b/TP_SCR3.2/TP03/dhcp-serv.imn index a9be52f..3f71994 100644 --- a/TP_SCR3.2/TP03/dhcp-serv.imn +++ b/TP_SCR3.2/TP03/dhcp-serv.imn @@ -69,8 +69,9 @@ node n3 { ip address 127.0.0.1/8 ipv6 address ::1/128 ! + ip route 172.16.2.0/24 192.168.10.254 + ! } - auto_default_routes enabled canvas c0 iconcoords {72 96} labelcoords {72 132} diff --git a/TP_SCR3.2/TP03/dhcpd.conf b/TP_SCR3.2/TP03/dhcpd.conf new file mode 100644 index 0000000..00afb51 --- /dev/null +++ b/TP_SCR3.2/TP03/dhcpd.conf @@ -0,0 +1,24 @@ +default-lease-time 600; +max-lease-time 7200; + +option rfc-3442-classless-static-routes code 121 = array of integer 8; + +subnet 192.168.0.0 netmask 255.255.240.0 { +range 192.168.10.20 192.168.10.40; +option rfc-3442-classless-static-routes 24,172,16,2,192,168,10,254; +} + +host GW-eth0{ + hardware ethernet 42:00:aa:00:00:02; + fixed-address 172.16.2.254; +} + +host GW-eth1{ + hardware ethernet 42:00:aa:00:00:04; + fixed-address 192.168.10.254; +} + +subnet 172.16.2.0 netmask 255.255.255.0 { + range 172.16.2.20 172.16.2.254; +} + diff --git a/TP_SCR3.2/TP03/isc-dhcp-server b/TP_SCR3.2/TP03/isc-dhcp-server new file mode 100644 index 0000000..fc0e3e8 --- /dev/null +++ b/TP_SCR3.2/TP03/isc-dhcp-server @@ -0,0 +1,5 @@ + +#dans /etc/default/isc-dhcp-server + +INTERFACESv4="eth0" +#INTERFACESv6=""