diff --git a/SCR2.1/TP15/tp15-notes.txt b/SCR2.1/TP15/tp15-notes.txt new file mode 100644 index 0000000..d660137 --- /dev/null +++ b/SCR2.1/TP15/tp15-notes.txt @@ -0,0 +1,23 @@ +Question 1) +/etc/resolv.conf + +Question 2) +eru.arda.lan + +II/Question 1) +tshark -i eno1 -V -f "host 172.16.3.219 and not arp" + +Question 2) +dig iluvatar.arda.lan + +Question 3) +L'adresse IPv4 + +Question 4) +qr aa rd ra + +Question 5) +aa + +Question 6) +3600s, le temps de validité diff --git a/SCR2.1/TP16/raspberry-ip b/SCR2.1/TP16/raspberry-ip new file mode 100644 index 0000000..6db3d96 --- /dev/null +++ b/SCR2.1/TP16/raspberry-ip @@ -0,0 +1 @@ +172.16.3.176 diff --git a/SCR2.1/TP16/tp16-notes.txt b/SCR2.1/TP16/tp16-notes.txt new file mode 100644 index 0000000..dc12f21 --- /dev/null +++ b/SCR2.1/TP16/tp16-notes.txt @@ -0,0 +1,6 @@ +Question 1) +Le système d'exploitation est 64-bits + +Question 2) +L'architecture est aarch64 +Le processeur est un ARM Cortex-A53 diff --git a/SCR2.2/TP20/simple1.imn b/SCR2.2/TP20/simple1.imn new file mode 100644 index 0000000..5fb9a0f --- /dev/null +++ b/SCR2.2/TP20/simple1.imn @@ -0,0 +1,113 @@ +node n0 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {408 144} + labelcoords {408 167} + interface-peer {e0 n1} + interface-peer {e1 n2} + interface-peer {e2 n3} +} + +node n1 { + type pc + network-config { + hostname pc1 + ! + interface eth0 + ipv6 address fc00::20/64 + mac address 42:00:aa:00:00:00 + ip address 172.16.1.1/16 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {192 288} + labelcoords {192 319} + interface-peer {eth0 n0} +} + +node n2 { + type pc + network-config { + hostname pc2 + ! + interface eth0 + ipv6 address fc00::21/64 + mac address 42:00:aa:00:00:01 + ip address 172.16.2.2/16 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {408 312} + labelcoords {408 343} + interface-peer {eth0 n0} +} + +node n3 { + type pc + network-config { + hostname pc3 + ! + interface eth0 + ipv6 address fc00::22/64 + mac address 42:00:aa:00:00:02 + ip address 172.16.3.3/16 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + } + canvas c0 + iconcoords {648 264} + labelcoords {648 295} + interface-peer {eth0 n0} +} + +link l0 { + nodes {n0 n1} + bandwidth 0 +} + +link l1 { + nodes {n2 n0} + bandwidth 0 +} + +link l2 { + nodes {n3 n0} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses no + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/SCR2.2/TP20/simple2.imn b/SCR2.2/TP20/simple2.imn new file mode 100644 index 0000000..3e2c5b1 --- /dev/null +++ b/SCR2.2/TP20/simple2.imn @@ -0,0 +1,200 @@ +node n0 { + type host + network-config { + hostname host1 + ! + interface eth1 + ipv6 address fc00:1::10/64 + mac address 42:00:aa:00:00:01 + ip address 172.16.2.254/24 + ! + interface eth0 + ipv6 address fc00::10/64 + mac address 42:00:aa:00:00:00 + 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 {432 120} + labelcoords {432 156} + interface-peer {eth0 n1} + interface-peer {eth1 n2} +} + +node n1 { + type lanswitch + network-config { + hostname switch1 + ! + } + canvas c0 + iconcoords {192 192} + labelcoords {192 215} + interface-peer {e0 n0} + interface-peer {e1 n3} + interface-peer {e2 n4} +} + +node n2 { + type lanswitch + network-config { + hostname switch2 + ! + } + canvas c0 + iconcoords {648 192} + labelcoords {648 215} + interface-peer {e0 n0} + interface-peer {e1 n5} + interface-peer {e2 n6} +} + +node n3 { + type pc + network-config { + hostname pc1-1 + ! + interface eth0 + ipv6 address fc00::20/64 + mac address 42:00:aa:00:00:02 + 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 {72 384} + labelcoords {72 415} + interface-peer {eth0 n1} +} + +node n4 { + type pc + network-config { + hostname pc1-2 + ! + interface eth0 + ipv6 address fc00::21/64 + mac address 42:00:aa:00:00:03 + 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 {288 384} + labelcoords {288 415} + interface-peer {eth0 n1} +} + +node n5 { + type pc + network-config { + hostname pc2-1 + ! + interface eth0 + ipv6 address fc00:1::20/64 + 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 172.16.1.0/24 172.16.2.254 + ! + } + canvas c0 + iconcoords {576 384} + labelcoords {576 415} + interface-peer {eth0 n2} +} + +node n6 { + type pc + network-config { + hostname p2-2 + ! + interface eth0 + ipv6 address fc00:1::21/64 + 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 + ! + ip route 172.16.1.0/24 172.16.2.254 + ! + } + canvas c0 + iconcoords {768 384} + labelcoords {768 415} + interface-peer {eth0 n2} +} + +link l0 { + nodes {n0 n1} + bandwidth 0 +} + +link l1 { + nodes {n2 n0} + bandwidth 0 +} + +link l2 { + nodes {n1 n3} + bandwidth 0 +} + +link l3 { + nodes {n4 n1} + bandwidth 0 +} + +link l4 { + nodes {n5 n2} + bandwidth 0 +} + +link l5 { + nodes {n6 n2} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses no + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/SCR2.2/TP20/simple3.imn b/SCR2.2/TP20/simple3.imn new file mode 100644 index 0000000..b19fe72 --- /dev/null +++ b/SCR2.2/TP20/simple3.imn @@ -0,0 +1,415 @@ +node n0 { + type host + network-config { + hostname P1 + ! + interface eth1 + ipv6 address fc00:1::10/64 + mac address 42:00:aa:00:00:01 + ip address 192.168.127.253/18 + ! + interface eth0 + ipv6 address fc00::10/64 + mac address 42:00:aa:00:00:00 + ip address 192.168.63.254/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.128.0/18 192.168.127.254 + ip route 192.168.192.0/18 192.168.127.254 + ! + } + canvas c0 + iconcoords {216 72} + labelcoords {216 108} + interface-peer {eth0 n1} + interface-peer {eth1 n2} +} + +node n1 { + type lanswitch + network-config { + hostname S1 + ! + } + canvas c0 + iconcoords {120 168} + labelcoords {120 191} + interface-peer {e0 n0} + interface-peer {e1 n5} + interface-peer {e2 n6} +} + +node n2 { + type lanswitch + network-config { + hostname S2 + ! + } + canvas c0 + iconcoords {288 168} + labelcoords {288 191} + interface-peer {e0 n0} + interface-peer {e1 n3} + interface-peer {e2 n7} + interface-peer {e3 n8} +} + +node n3 { + type host + network-config { + hostname P2 + ! + interface eth2 + ipv6 address fc00:3::10/64 + mac address 42:00:aa:00:00:0a + ip address 192.168.191.254/18 + ! + interface eth1 + ipv6 address fc00:2::10/64 + mac address 42:00:aa:00:00:03 + ip address 192.168.255.254/18 + ! + interface eth0 + ipv6 address fc00:1::11/64 + mac address 42:00:aa:00:00:02 + ip address 192.168.127.254/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.127.253 + ! + } + canvas c0 + iconcoords {528 72} + labelcoords {528 108} + interface-peer {eth0 n2} + interface-peer {eth1 n4} + interface-peer {eth2 n11} +} + +node n4 { + type lanswitch + network-config { + hostname S4 + ! + } + canvas c0 + iconcoords {720 168} + labelcoords {720 191} + interface-peer {e0 n3} + interface-peer {e1 n9} + interface-peer {e2 n10} +} + +node n5 { + type pc + network-config { + hostname pc1-1 + ! + interface eth0 + ipv6 address fc00::20/64 + mac address 42:00:aa:00:00:04 + ip address 192.168.6.23/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.128.0/18 192.168.63.254 + ip route 192.168.192.0/18 192.168.63.254 + ip route 192.168.64.0/18 192.168.63.254 + ! + } + canvas c0 + iconcoords {24 288} + labelcoords {24 319} + interface-peer {eth0 n1} +} + +node n6 { + type pc + network-config { + hostname pc1-2 + ! + interface eth0 + ipv6 address fc00::21/64 + mac address 42:00:aa:00:00:05 + ip address 192.168.17.23/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.128.0/18 192.168.63.254 + ip route 192.168.192.0/18 192.168.63.254 + ip route 192.168.64.0/18 192.168.63.254 + ! + } + canvas c0 + iconcoords {216 264} + labelcoords {216 295} + interface-peer {eth0 n1} +} + +node n7 { + type pc + network-config { + hostname pc2-1 + ! + interface eth0 + ipv6 address fc00:1::20/64 + mac address 42:00:aa:00:00:06 + ip address 192.168.68.12/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.127.253 + ip route 192.168.128.0/18 192.168.127.254 + ip route 192.168.192.0/18 192.168.127.254 + ! + } + canvas c0 + iconcoords {192 408} + labelcoords {192 439} + interface-peer {eth0 n2} +} + +node n8 { + type pc + network-config { + hostname pc2-2 + ! + interface eth0 + ipv6 address fc00:1::21/64 + mac address 42:00:aa:00:00:07 + ip address 192.168.66.14/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.127.253 + ip route 192.168.128.0/18 192.168.127.254 + ip route 192.168.192.0/18 192.168.127.254 + ! + } + canvas c0 + iconcoords {384 408} + labelcoords {384 439} + interface-peer {eth0 n2} +} + +node n9 { + type pc + network-config { + hostname pc4-1 + ! + interface eth0 + ipv6 address fc00:2::20/64 + mac address 42:00:aa:00:00:08 + ip address 192.168.200.27/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.255.254 + ip route 192.168.192.0/18 192.168.255.254 + ip route 192.168.64.0/18 192.168.255.254 + ! + } + canvas c0 + iconcoords {600 360} + labelcoords {600 391} + interface-peer {eth0 n4} +} + +node n10 { + type pc + network-config { + hostname pc4-2 + ! + interface eth0 + ipv6 address fc00:2::21/64 + mac address 42:00:aa:00:00:09 + ip address 192.168.216.80/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.255.254 + ip route 192.168.192.0/18 192.168.255.254 + ip route 192.168.64.0/18 192.168.255.254 + ! + } + canvas c0 + iconcoords {864 360} + labelcoords {864 391} + interface-peer {eth0 n4} +} + +node n11 { + type lanswitch + network-config { + hostname S3 + ! + } + canvas c0 + iconcoords {504 216} + labelcoords {504 239} + interface-peer {e0 n3} + interface-peer {e1 n12} + interface-peer {e2 n13} +} + +node n12 { + type pc + network-config { + hostname pc3-1 + ! + interface eth0 + ipv6 address fc00:3::20/64 + mac address 42:00:aa:00:00:0b + ip address 192.168.131.16/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.191.254 + ip route 192.168.192.0/18 192.168.191.254 + ip route 192.168.64.0/18 192.168.191.254 + ! + } + canvas c0 + iconcoords {408 504} + labelcoords {408 535} + interface-peer {eth0 n11} +} + +node n13 { + type pc + network-config { + hostname pc3-2 + ! + interface eth0 + ipv6 address fc00:3::21/64 + mac address 42:00:aa:00:00:0c + ip address 192.168.164.237/18 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 192.168.0.0/18 192.168.191.254 + ip route 192.168.192.0/18 192.168.191.254 + ip route 192.168.64.0/18 192.168.191.254 + ! + } + canvas c0 + iconcoords {624 504} + labelcoords {624 535} + interface-peer {eth0 n11} +} + +link l0 { + nodes {n1 n0} + bandwidth 0 +} + +link l1 { + nodes {n2 n0} + bandwidth 0 +} + +link l2 { + nodes {n3 n2} + bandwidth 0 +} + +link l3 { + nodes {n4 n3} + bandwidth 0 +} + +link l4 { + nodes {n5 n1} + bandwidth 0 +} + +link l5 { + nodes {n6 n1} + bandwidth 0 +} + +link l6 { + nodes {n7 n2} + bandwidth 0 +} + +link l7 { + nodes {n8 n2} + bandwidth 0 +} + +link l8 { + nodes {n9 n4} + bandwidth 0 +} + +link l9 { + nodes {n10 n4} + bandwidth 0 +} + +link l10 { + nodes {n11 n3} + bandwidth 0 +} + +link l11 { + nodes {n12 n11} + bandwidth 0 +} + +link l12 { + nodes {n13 n11} + bandwidth 0 +} + +canvas c0 { + name {Canvas0} +} + +option show { + interface_names yes + ip_addresses yes + ipv6_addresses no + node_labels yes + link_labels yes + background_images no + annotations yes + hostsAutoAssign no + grid yes + iconSize normal + zoom 1.0 +} + diff --git a/SCR2.2/TP20/tp20-extension.SCR.2.2.imn b/SCR2.2/TP20/tp20-extension.SCR.2.2.imn new file mode 100644 index 0000000..f017301 --- /dev/null +++ b/SCR2.2/TP20/tp20-extension.SCR.2.2.imn @@ -0,0 +1,669 @@ +node n2 { + type lanswitch + network-config { + hostname switch3 + ! + } + canvas c0 + iconcoords {120 480} + labelcoords {121 508} + interface-peer {e0 n10} + interface-peer {e1 n19} + interface-peer {e2 n0} +} + +node n3 { + type lanswitch + network-config { + hostname switch4 + ! + } + canvas c0 + iconcoords {120 72} + labelcoords {75 55} + interface-peer {e0 n10} + interface-peer {e1 n11} + interface-peer {e2 n20} +} + +node n4 { + type lanswitch + network-config { + hostname switch5 + ! + } + canvas c0 + iconcoords {408 72} + labelcoords {389 93} + interface-peer {e0 n9} + interface-peer {e1 n11} + interface-peer {e2 n21} + interface-peer {e3 n1} +} + +node n5 { + type lanswitch + network-config { + hostname switch6 + ! + } + canvas c0 + iconcoords {840 72} + labelcoords {789 51} + interface-peer {e0 n9} + interface-peer {e1 n22} +} + +node n6 { + type lanswitch + network-config { + hostname switch7 + ! + } + canvas c0 + iconcoords {624 336} + labelcoords {618 304} + interface-peer {e0 n9} + interface-peer {e1 n12} + interface-peer {e2 n23} + interface-peer {e3 n8} +} + +node n7 { + type lanswitch + network-config { + hostname switch8 + ! + } + canvas c0 + iconcoords {504 456} + labelcoords {489 433} + interface-peer {e0 n12} + interface-peer {e1 n13} + interface-peer {e2 n14} +} + +node n9 { + type host + network-config { + hostname P5 + ! + interface eth3 + mac address 42:00:aa:00:00:09 + ip address 10.80.0.254/17 + ! + interface eth2 + mac address 42:00:aa:00:00:04 + ip address 10.64.0.254/17 + ! + interface eth1 + mac address 42:00:aa:00:00:03 + ip address 10.48.0.254/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {624 72} + labelcoords {591 28} + interface-peer {eth1 n4} + interface-peer {eth2 n5} + interface-peer {eth3 n6} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + + ip addr add 10.48.0.254/17 dev eth1 + ip addr add 10.64.0.254/17 dev eth2 + ip addr add 10.80.0.254/17 dev eth3 + ip -6 addr add ::1/128 dev lo0 + ip route add default via 10.80.0.255 + ip route add 10.16.0.0/17 via 10.48.0.255 + + iptables -t nat -A POSTROUTING -o eth3 -s 10.48.0.0/17 -j SNAT --to-source 10.80.0.254 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n10 { + type host + network-config { + hostname P3 + ! + interface eth1 + mac address 42:00:aa:00:00:06 + ip address 10.32.0.254/17 + ! + interface eth0 + mac address 42:00:aa:00:00:05 + ip address 10.16.0.254/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 10.48.0.0/17 10.32.0.255 + ! + } + canvas c0 + iconcoords {120 312} + labelcoords {126 352} + interface-peer {eth0 n2} + interface-peer {eth1 n3} +} + +node n11 { + type host + network-config { + hostname P4 + ! + interface eth1 + mac address 42:00:aa:00:00:08 + ip address 10.48.0.255/17 + ! + interface eth0 + mac address 42:00:aa:00:00:07 + ip address 10.32.0.255/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + } + canvas c0 + iconcoords {240 72} + labelcoords {247 28} + interface-peer {eth0 n3} + 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 10.32.0.255/17 dev eth0 + ip addr add 10.48.0.255/17 dev eth1 + ip -6 addr add ::1/128 dev lo0 + ip route add default via 10.48.0.254 + ip route add 10.16.0.0/17 via 10.32.0.254 + + + iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 10.32.0.255 + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 10.48.0.255 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n12 { + type host + network-config { + hostname P6 + ! + interface eth0 + mac address 42:00:aa:00:00:0a + ip address 10.80.0.255/17 + ! + interface eth1 + mac address 42:00:aa:00:00:0b + ip address 102.103.104.255/15 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + } + canvas c0 + iconcoords {624 456} + labelcoords {583 479} + interface-peer {eth0 n6} + interface-peer {eth1 n7} + custom-configs { + custom-config-id default { + custom-command /bin/sh + config { + ip addr add 127.0.0.1/8 dev lo0 + ip addr add 10.80.0.255/17 dev eth0 + ip addr add 102.103.104.255/15 dev eth1 + ip -6 addr add ::1/128 dev lo0 + ip route add default via 102.103.104.254 + ip route add 10.64.0.0/17 via 10.80.0.254 + + iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 102.103.104.255 + + rpcbind + inetd + + } + } + } + custom-enabled true + custom-selected default +} + +node n13 { + type router + model quagga + network-config { + hostname router1 + ! + interface eth1 + mac address 42:00:aa:00:00:0e + ip address 202.203.204.254/11 + ! + interface eth0 + mac address 42:00:aa:00:00:0c + ip address 102.103.104.254/15 + ! + 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 {504 552} + labelcoords {504 577} + interface-peer {eth0 n7} + interface-peer {eth1 n15} +} + +node n14 { + type host + network-config { + hostname host2 + ! + interface eth0 + mac address 42:00:aa:00:00:0d + ip address 102.103.104.104/15 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 0.0.0.0/0 102.103.104.254 + ! + } + canvas c0 + iconcoords {360 456} + labelcoords {345 415} + interface-peer {eth0 n7} +} + +node n15 { + type host + network-config { + hostname host3 + ! + interface eth0 + mac address 42:00:aa:00:00:0f + ip address 202.203.204.204/11 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ! + ip route 0.0.0.0/0 202.203.204.254 + ! + } + canvas c0 + iconcoords {768 552} + labelcoords {768 588} + interface-peer {eth0 n13} +} + +node n19 { + type pc + network-config { + hostname pc3 + ! + interface eth0 + mac address 42:00:aa:00:00:13 + ip address 10.16.0.3/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 10.32.0.0/17 10.16.0.254 + ! + } + canvas c0 + iconcoords {264 480} + labelcoords {264 511} + interface-peer {eth0 n2} +} + +node n20 { + type pc + network-config { + hostname pc4 + ! + interface eth0 + mac address 42:00:aa:00:00:14 + ip address 10.32.0.4/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 10.16.0.0/17 10.32.0.254 + ip route 10.48.0.0/17 10.32.0.255 + ! + } + canvas c0 + iconcoords {24 72} + labelcoords {24 103} + interface-peer {eth0 n3} +} + +node n21 { + type pc + network-config { + hostname pc5 + ! + interface eth0 + mac address 42:00:aa:00:00:15 + ip address 10.48.0.5/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 0.0.0.0/0 10.48.0.254 + ip route 10.16.0.0/17 10.48.0.255 + ! + } + canvas c0 + iconcoords {408 0} + labelcoords {408 31} + interface-peer {eth0 n4} +} + +node n22 { + type pc + network-config { + hostname pc6 + ! + interface eth0 + mac address 42:00:aa:00:00:16 + ip address 10.64.0.6/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 0.0.0.0/0 10.64.0.254 + ! + } + canvas c0 + iconcoords {840 264} + labelcoords {840 295} + interface-peer {eth0 n5} +} + +node n23 { + type pc + network-config { + hostname pc7 + ! + interface eth0 + mac address 42:00:aa:00:00:17 + ip address 10.80.0.7/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 0.0.0.0/0 10.80.0.255 + ip route 10.64.0.0/17 10.80.0.254 + ! + } + canvas c0 + iconcoords {504 336} + labelcoords {504 367} + interface-peer {eth0 n6} +} + +node n0 { + type host + network-config { + hostname host1 + ! + interface eth0 + mac address 42:00:aa:00:00:00 + ip address 10.16.0.200/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ! + ip route 10.32.0.0/17 10.16.0.254 + ! + } + canvas c0 + iconcoords {24 480} + labelcoords {7 447} + interface-peer {eth0 n2} +} + +node n1 { + type pc + network-config { + hostname pc6-5 + ! + interface eth0 + mac address 42:00:aa:00:00:01 + ip address 10.48.0.6/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 10.48.0.254 + ip route 10.16.0.0/17 10.48.0.255 + ! + } + canvas c0 + iconcoords {408 336} + labelcoords {381 305} + interface-peer {eth0 n4} +} + +node n8 { + type pc + network-config { + hostname pc8 + ! + interface eth0 + mac address 42:00:aa:00:00:02 + ip address 10.80.0.8/17 + ! + interface lo0 + type lo + ip address 127.0.0.1/8 + ipv6 address ::1/128 + ! + ip route 0.0.0.0/0 10.80.0.255 + ip route 10.64.0.0/17 10.80.0.254 + ! + } + canvas c0 + iconcoords {864 336} + labelcoords {864 367} + interface-peer {eth0 n6} +} + +link l3 { + nodes {n9 n4} + bandwidth 0 +} + +link l4 { + nodes {n5 n9} + bandwidth 0 +} + +link l5 { + nodes {n10 n2} + bandwidth 0 +} + +link l6 { + nodes {n3 n10} + bandwidth 0 +} + +link l7 { + nodes {n11 n3} + bandwidth 0 +} + +link l8 { + nodes {n4 n11} + bandwidth 0 +} + +link l9 { + nodes {n6 n9} + bandwidth 0 +} + +link l10 { + nodes {n6 n12} + bandwidth 0 +} + +link l11 { + nodes {n7 n12} + bandwidth 0 +} + +link l12 { + nodes {n13 n7} + bandwidth 0 +} + +link l13 { + nodes {n7 n14} + bandwidth 0 +} + +link l14 { + nodes {n15 n13} + bandwidth 0 +} + +link l18 { + nodes {n19 n2} + bandwidth 0 +} + +link l19 { + nodes {n20 n3} + bandwidth 0 +} + +link l20 { + nodes {n4 n21} + bandwidth 0 +} + +link l21 { + nodes {n5 n22} + bandwidth 0 +} + +link l22 { + nodes {n6 n23} + bandwidth 0 +} + +link l0 { + nodes {n2 n0} + bandwidth 0 +} + +link l1 { + nodes {n1 n4} + bandwidth 0 +} + +link l2 { + nodes {n6 n8} + 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.5 +} + diff --git a/SCR2.2/TP20/tp20-extension.SCR.2.2.pdf b/SCR2.2/TP20/tp20-extension.SCR.2.2.pdf new file mode 100644 index 0000000..c59d5d3 Binary files /dev/null and b/SCR2.2/TP20/tp20-extension.SCR.2.2.pdf differ diff --git a/SCR3.1/TP1/src/adresses_virtuelles.c b/SCR3.1/TP1/src/adresses_virtuelles.c new file mode 100644 index 0000000..fe6c824 --- /dev/null +++ b/SCR3.1/TP1/src/adresses_virtuelles.c @@ -0,0 +1,29 @@ +/* adresses virtuelles d'un processus */ + +#include +#include +#include +#include + +int t[1000] = {[0 ... 999] = 2}; + +int main(int argc, char * argv[]) +{ + int i=3; + static int j = 3; + char * m = (char*)malloc(1); + + printf("mon pid est %d\n\n",getpid()); + + /* ------- Affichage des adresses --------*/ + + printf("main\t=\t%p\n",main); + printf("&argc\t=\t%p\n",&argc); + printf("&i\t=\t%p\n",&i); + printf("&j\t=\t%p\n",&j); + printf("t\t=\t%p\n",t); + printf("m\t=\t%p\n",m); + + getchar(); +} + diff --git a/SCR3.1/TP1/src/alignement.c b/SCR3.1/TP1/src/alignement.c new file mode 100644 index 0000000..af17aeb --- /dev/null +++ b/SCR3.1/TP1/src/alignement.c @@ -0,0 +1,55 @@ +/* alignement et objets */ + +struct exemple1 { + int x; + int y; + int z; + int w; +}; + +struct exemple2 { + char x; + char y; + char z; + char w; +}; + +struct exemple3 { + int x; + int y; + char z; + char w; +}; + +struct exemple4 { + int x; + char y; + int z; + char w; +}; + +union exemple5 { + int x; + char y; + int z; + char w; +}; + +int main() +{ + int a[4] = {1,2,3,4}; + char c[4] = {'a','b','c','d'}; + struct exemple1 ex1 = {1,2,3,4}; + struct exemple2 ex2 = {'a','b','c','d'}; + struct exemple3 ex3 = {1,2,'c','d'}; + struct exemple4 ex4 = {1,'c',2,'d'}; + union exemple5 ex5; + int x = 61; + char y = 62; + int z = 63; + char w = 64; + ex5.x=62;ex5.y=63;ex5.z=64;ex5.w=65; + + // appelez hexdump pour chaque variable +} + diff --git a/SCR3.1/TP1/src/bss_data.c b/SCR3.1/TP1/src/bss_data.c new file mode 100644 index 0000000..b34c3db --- /dev/null +++ b/SCR3.1/TP1/src/bss_data.c @@ -0,0 +1,10 @@ +/* segment bss et data */ +#define N 1000 +int t[N]; /* version 1 */ +//int t[N]={1}; /* version 2 */ + +int main() +{ + return 0; +} + diff --git a/SCR3.1/TP1/src/ex1bis/Makefile b/SCR3.1/TP1/src/ex1bis/Makefile new file mode 100644 index 0000000..f6ddfde --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/Makefile @@ -0,0 +1,17 @@ +CFLAGS := -Wall -g -O0 +SRC=buf.c heap.c huge.c mmap.c null.c stack.c + +DEPENDHELPERS=helpers.o + +BINARIES=$(SRC:%.c=%) + +%.o : %c + gcc -c $+ + +$(BINARIES): % : %.o $(DEPENDHELPERS) + gcc -o $@ $+ + +all : $(BINARIES) + +clean: + rm -f *.o $(BINARIES) diff --git a/SCR3.1/TP1/src/ex1bis/buf b/SCR3.1/TP1/src/ex1bis/buf new file mode 100755 index 0000000..d2bbf1c Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/buf differ diff --git a/SCR3.1/TP1/src/ex1bis/buf.c b/SCR3.1/TP1/src/ex1bis/buf.c new file mode 100644 index 0000000..b6b1d0f --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/buf.c @@ -0,0 +1,10 @@ +#include "helpers.h" + +static char buf1[8 MB] = {0}; +static char buf2[16 MB] = {0}; + +int main(int argc, char **argv) +{ + randomize(buf2, 16 MB); + return interlude(); +} diff --git a/SCR3.1/TP1/src/ex1bis/data/256k b/SCR3.1/TP1/src/ex1bis/data/256k new file mode 100644 index 0000000..f3e3746 Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/data/256k differ diff --git a/SCR3.1/TP1/src/ex1bis/heap b/SCR3.1/TP1/src/ex1bis/heap new file mode 100755 index 0000000..d31291a Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/heap differ diff --git a/SCR3.1/TP1/src/ex1bis/heap.c b/SCR3.1/TP1/src/ex1bis/heap.c new file mode 100644 index 0000000..196ecb9 --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/heap.c @@ -0,0 +1,8 @@ +#include "helpers.h" + +int main(int argc, char **argv) +{ + dirty(16 MB); + clean(32 MB); + return interlude(); +} diff --git a/SCR3.1/TP1/src/ex1bis/helpers.c b/SCR3.1/TP1/src/ex1bis/helpers.c new file mode 100644 index 0000000..1a2799f --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/helpers.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include "helpers.h" + +#include + +void randomize(char *buf, size_t n) +{ + assert(buf); + memset(buf, rand() & 0xff, n); +} + +void clean(size_t b) +{ + for (; b > 0; b -= 1 KB) + calloc(1 KB, sizeof(char)); +} + +void dirty(size_t b) +{ + for (; b > 0; b -= 1 KB) + randomize(calloc(1 KB, sizeof(char)), 1 KB); +} + +int interlude(void) +{ + pid_t pid = getpid(); + printf("pid %i\n", (int)pid); + printf("------------------------------------------\n" + "go check /proc/%i/smaps; I'll wait...\n" + "press when you're done\n", pid); + fgetc(stdin); + return 0; +} diff --git a/SCR3.1/TP1/src/ex1bis/helpers.h b/SCR3.1/TP1/src/ex1bis/helpers.h new file mode 100644 index 0000000..d8a774a --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/helpers.h @@ -0,0 +1,13 @@ +#ifndef _HELPERS_H +#define _HELPERS_H +#include + +#define KB * 1024 +#define MB * 1024 * 1024 + +void randomize(char *buf, size_t n); +void clean(size_t n); +void dirty(size_t n); +int interlude(void); + +#endif diff --git a/SCR3.1/TP1/src/ex1bis/huge b/SCR3.1/TP1/src/ex1bis/huge new file mode 100755 index 0000000..0a27a49 Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/huge differ diff --git a/SCR3.1/TP1/src/ex1bis/huge.c b/SCR3.1/TP1/src/ex1bis/huge.c new file mode 100644 index 0000000..046aea0 --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/huge.c @@ -0,0 +1,12 @@ +#include "helpers.h" + +int main(int argc, char **argv) +{ + char *under = malloc(96 KB); + randomize(under, 96 KB); + + char *over = malloc(256 KB); + randomize(over, 256 KB); + + return interlude(); +} diff --git a/SCR3.1/TP1/src/ex1bis/mmap b/SCR3.1/TP1/src/ex1bis/mmap new file mode 100755 index 0000000..734e894 Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/mmap differ diff --git a/SCR3.1/TP1/src/ex1bis/mmap.c b/SCR3.1/TP1/src/ex1bis/mmap.c new file mode 100644 index 0000000..ac62144 --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/mmap.c @@ -0,0 +1,38 @@ +#include "helpers.h" +#include +#include +#include + + +int main(int argc, char **argv) +{ + /* inert map (never modified) */ + char *inert = mmap(NULL, 16 KB, + PROT_READ|PROT_WRITE, + MAP_ANONYMOUS|MAP_PRIVATE, + -1, 0); + /* anonymous, private mmap */ + char *anon_priv = mmap(NULL, 32 KB, + PROT_READ|PROT_WRITE, + MAP_ANONYMOUS|MAP_PRIVATE, + -1, 0); + randomize(anon_priv, 32 KB); + + /* anonymous, shared map */ + char *anon_shared = mmap(NULL, 64 KB, + PROT_READ|PROT_WRITE, + MAP_ANONYMOUS|MAP_SHARED, + -1, 0); + randomize(anon_shared, 64 KB); + + /* private, file-backed map */ + int fd = open("data/256k", O_RDWR); + assert(fd >= 0); + char *file = mmap(NULL, 256 KB, + PROT_READ|PROT_WRITE, + MAP_PRIVATE, + fd, 0); + randomize(file, 128 KB); + + return interlude(); +} diff --git a/SCR3.1/TP1/src/ex1bis/null b/SCR3.1/TP1/src/ex1bis/null new file mode 100755 index 0000000..e604f5e Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/null differ diff --git a/SCR3.1/TP1/src/ex1bis/null.c b/SCR3.1/TP1/src/ex1bis/null.c new file mode 100644 index 0000000..fbd46f7 --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/null.c @@ -0,0 +1,6 @@ +#include "helpers.h" + +int main(int argc, char **argv) +{ + return interlude(); +} diff --git a/SCR3.1/TP1/src/ex1bis/stack b/SCR3.1/TP1/src/ex1bis/stack new file mode 100755 index 0000000..2b4d941 Binary files /dev/null and b/SCR3.1/TP1/src/ex1bis/stack differ diff --git a/SCR3.1/TP1/src/ex1bis/stack.c b/SCR3.1/TP1/src/ex1bis/stack.c new file mode 100644 index 0000000..700eef1 --- /dev/null +++ b/SCR3.1/TP1/src/ex1bis/stack.c @@ -0,0 +1,8 @@ +#include "helpers.h" + +int main (int argc, char **argv) +{ + char buf[28 KB] = {0}; + randomize(buf, 28 KB); + return interlude(); +} diff --git a/SCR3.1/TP1/src/ij_ji.c b/SCR3.1/TP1/src/ij_ji.c new file mode 100644 index 0000000..871aef9 --- /dev/null +++ b/SCR3.1/TP1/src/ij_ji.c @@ -0,0 +1,38 @@ +/* accès mémoire */ + +#include +#include +#include +#define N 8192 + +int t[N][N]; + +static inline double tstamp(void) +{ + struct timespec tv; + clock_gettime(CLOCK_REALTIME, &tv); + return tv.tv_sec + tv.tv_nsec * 1.0e-9; +} + +int main() +{ + int i,j; + double t1,t2; + t1=tstamp(); + + /* version 1 */ + + for(i=0;i +#include "mem.h" + +int main(int argc,char * argv[]) +{ + int pages[] = {4,5,6,8,4,9,6,12,4,6,10}; + simu(4,pages,11); + +} diff --git a/SCR3.1/TP1/src/memoire/mem.c b/SCR3.1/TP1/src/memoire/mem.c new file mode 100644 index 0000000..3676a26 --- /dev/null +++ b/SCR3.1/TP1/src/memoire/mem.c @@ -0,0 +1,174 @@ +#include "mem.h" +#include +#include +#include + +typedef struct frame { + int no; + int page; + int r; /* bit pour la seconde chance */ +} frame ; + + +typedef struct fifo { + int head; + int tail; + int nbelem; +} fifo; + +typedef struct mem { + int nbframes; + frame * frames; +} mem; + +static mem * memory=NULL; +static fifo FIFO; + + +/* Fifo est buffer circulaire + * head pointe sur la tete (element le plus ancien) + * tail pointe sur la queue (element le plus recent) + * nbelem represente le nombre d'element dans la file + * head et tail progressent modulo le nombre de frame + * dans la memoire */ +/* + * Memoire + ------------- + | frame 0 | <- head + ------------- + | frame 1 | + ------------- + | frame 2 | + ------------- + | frame 3 | + ------------- + | frame 4 | + ------------- + | ... | + ------------- + | ... | + ------------- + | ... | <- tail + ------------- + | ... | + ------------- +*/ + +static int init(int n) +{ + + int i; + memory = (mem*)calloc(1,sizeof(mem)); + memory-> nbframes = n; + memory-> frames = (frame *) calloc(n,sizeof(frame)); + if (memory -> frames == NULL) return -1; + + for(i=0;iframes[i].no = i; + memory->frames[i].page = -1; /* les frames sont vides initialement */ + memory->frames[i].r=0; + } + FIFO.head = FIFO.tail = 0; + FIFO.nbelem = 0; + return n; +} + +static int _page_is_in(int page) +{ +/* a ecrire */ +} + +static int _fifo_is_full() +{ + return (FIFO.nbelem == memory->nbframes); +} + +int get_page_2chance(int page) +{ +/* pour la deuxieme question */ +} + +int get_page_fifo(int page) +{ + /* a ecrire */ +} + +void simu(int nb_frame,int t[],int l) +{ + int i,j; + init(nb_frame); + frame ** trace; + trace = (frame **) malloc(sizeof(frame *) * l); + int * defaut = (int *) calloc(l,sizeof(int)); + for (i=0;iframes,sizeof(frame)*nb_frame); + } + printf("------------"); + for (i=0;iframes); + free(memory); + memory = NULL; + for(i=0;i +#include +#include +#include +#include + +static inline double tstamp(void) +{ + struct timespec tv; + clock_gettime(CLOCK_REALTIME, &tv); + return tv.tv_sec + tv.tv_nsec * 1.0e-9; +} + +void shuffle(int *array, size_t n) +{ + if (n > 1) + { + size_t i; + for (i = 0; i < n - 1; i++) +// for (i = 0; i < n ; i++) + { + size_t j = i + rand() / (RAND_MAX / (n - i) + 1); +// size_t j = rand()%n; + int t = array[j]; + array[j] = array[i]; + array[i] = t; + } + } +} + +void init_access_c(int access[],size_t size) +{ + int i; + for(i=0;i