1)
On utilise la commande	ncat -ul 50000 sur un premier terminal.

sur un autre terminal on utilise la commande ss -lnu

[solar@salle231-04 TP14]$ ss -lun
State                  Recv-Q                 Send-Q                                                    Local Address:Port                                  Peer Address:Port                 
UNCONN                 0                      0                                                               0.0.0.0:5353                                       0.0.0.0:*                    
UNCONN                 0                      0                                                               0.0.0.0:5355                                       0.0.0.0:*                    
UNCONN                 0                      0                                                            127.0.0.54:53                                         0.0.0.0:*                    
UNCONN                 0                      0                                                         127.0.0.53%lo:53                                         0.0.0.0:*                    
UNCONN                 0                      0                                                      172.16.2.91%eno1:68                                         0.0.0.0:*                    
UNCONN                 0                      0                                                        172.17.255.255:137                                        0.0.0.0:*                    
UNCONN                 0                      0                                                            172.17.0.1:137                                        0.0.0.0:*                    
UNCONN                 0                      0                                                        172.16.255.255:137                                        0.0.0.0:*                    
UNCONN                 0                      0                                                           172.16.2.91:137                                        0.0.0.0:*                    
UNCONN                 0                      0                                                               0.0.0.0:137                                        0.0.0.0:*                    
UNCONN                 0                      0                                                        172.17.255.255:138                                        0.0.0.0:*                    
UNCONN                 0                      0                                                            172.17.0.1:138                                        0.0.0.0:*                    
UNCONN                 0                      0                                                        172.16.255.255:138                                        0.0.0.0:*                    
UNCONN                 0                      0                                                           172.16.2.91:138                                        0.0.0.0:*                    
UNCONN                 0                      0                                                               0.0.0.0:138                                        0.0.0.0:*                    
UNCONN                 0                      0                                                               0.0.0.0:50000                                      0.0.0.0:*                    
UNCONN                 0                      0                                                                  [::]:5353                                          [::]:*                    
UNCONN                 0                      0                                                                  [::]:5355                                          [::]:*                    
UNCONN                 0                      0                                      [fe80::e654:e8ff:fea1:a2e8]%eno1:546                                           [::]:*                    
UNCONN                 0                      0                                                                  [::]:50000                                         [::]:*                    

2)

dd if=/dev/urandom of=ft-file.dat bs=1024 count=9

9+0 records in
9+0 records out
9216 bytes (9.2 kB, 9.0 KiB) copied, 0.0083619 s, 1.1 MB/s


ls -lh ft-file.dat
-rw-r--r-- 1 solar students23 9.0K Mar 12 14:52 ft-file.dat

3)

ncat -lu 50000 > resultat

ncat 192.16.2.91 < ft-file.dat

a la fin dans resultat on a la même chose que tu sur le fichier ft-file.dat

-rw-r--r-- 1 solar info-etu-but-2024  9216 Feb 11 17:06  resultat


4.
tcpdump -tn "tcp and port 50000 and not arp"


a)
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eno1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel


b)

tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eno1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel


c) 

tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eno1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel


6)

serveur :
-terminal 1:

ncat -ul 50000

-terminal 2:
tcpdump -i eno1 "udp and port 50000"
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eno1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
16:40:07.467945 IP salle229-02.iut-fbleau.fr.52428 > salle229-01.iut-fbleau.fr.50000: UDP, length 8192
16:40:07.468060 IP salle229-02.iut-fbleau.fr.52428 > salle229-01.iut-fbleau.fr.50000: UDP, length 1024


Client :
terminal 1:
tcpdump -i eno1 "udp and port 50000"

terminal 2:
ncat -u [ip] 500000 < ft-file.dat

7)
Il y a 2 paquet, un de 8192 et un autre de 1024.



II)

1)
which traceroute
which: no traceroute in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

which tracepath
/usr/bin/tracepath

cela signifie que tracepath existe et non traceroute

2)

terminal 1:

tcpdump -i eno1 -nlvt "host 172.16.2.102 and host not 172.16.3.30 and host not 172.16.3.31 and not arp and not tcp" > tracepath-trace.txt


terminal 2:

tracepath 8.8.8.8 -4 -n -p 33434


terminal 2:

1?: [LOCALHOST]                      pmtu 1500
 1:  172.16.1.254                                          0.570ms 
 1:  172.16.1.254                                          0.544ms 
 2:  37.58.131.238                                         0.876ms 
 3:  100.65.0.27                                           3.015ms 
 4:  100.121.1.230                                         4.487ms 
 5:  no reply
 6:  108.170.255.139                                       4.279ms asymm  9 
 7:  142.250.234.43                                        3.753ms asymm  9 
 8:  8.8.8.8                                               3.383ms reached
     Resume: pmtu 1500 hops 8 back 12 

terminal 1:
IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33434: UDP, length 1472
IP (tos 0xc0, ttl 64, id 2195, offset 0, flags [none], proto ICMP (1), length 576)
    172.16.1.254 > 172.16.2.102: ICMP time exceeded in-transit, length 556
	IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33434: UDP, length 1472
IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33435: UDP, length 1472
IP (tos 0xc0, ttl 64, id 2196, offset 0, flags [none], proto ICMP (1), length 576)
    172.16.1.254 > 172.16.2.102: ICMP time exceeded in-transit, length 556
	IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33435: UDP, length 1472
IP (tos 0x0, ttl 2, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33436: UDP, length 1472
IP (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto ICMP (1), length 56)
    37.58.131.238 > 172.16.2.102: ICMP time exceeded in-transit, length 36
	IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33436: UDP, length 1472
IP (tos 0x0, ttl 3, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33437: UDP, length 1472
IP (tos 0x0, ttl 253, id 13569, offset 0, flags [none], proto ICMP (1), length 96)
    100.65.0.27 > 172.16.2.102: ICMP time exceeded in-transit, length 76
	IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33437: UDP, length 1472
IP (tos 0x0, ttl 4, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33438: UDP, length 1472
IP (tos 0x0, ttl 252, id 33397, offset 0, flags [none], proto ICMP (1), length 96)
    100.121.1.230 > 172.16.2.102: ICMP time exceeded in-transit, length 76
	IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33438: UDP, length 1472
IP (tos 0x0, ttl 5, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33439: UDP, length 1472
IP (tos 0x0, ttl 5, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33440: UDP, length 1472
IP (tos 0x0, ttl 5, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33441: UDP, length 1472
IP (tos 0x0, ttl 6, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33442: UDP, length 1472
IP (tos 0x0, ttl 56, id 56705, offset 0, flags [none], proto ICMP (1), length 576)
    142.251.77.75 > 172.16.2.102: ICMP time exceeded in-transit, length 556
	IP (tos 0x80, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33442: UDP, length 1472
IP (tos 0x0, ttl 7, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33443: UDP, length 1472
IP (tos 0x0, ttl 56, id 55663, offset 0, flags [none], proto ICMP (1), length 576)
    142.251.64.125 > 172.16.2.102: ICMP time exceeded in-transit, length 556
	IP (tos 0x80, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33443: UDP, length 1472
IP (tos 0x0, ttl 8, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33444: UDP, length 1472
IP (tos 0x0, ttl 117, id 0, offset 0, flags [none], proto ICMP (1), length 56)
    8.8.8.8 > 172.16.2.102: ICMP 8.8.8.8 udp port 33444 unreachable, length 36
	IP (tos 0x80, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 1500)
    172.16.2.102.37566 > 8.8.8.8.33444: UDP, length 1472
^C19 packets captured
20 packets received by filter
0 packets dropped by kernel


3.
Le -n permet d'écrire principalement les adresse IP en format numérique.

dig www.google.fr
142.250.179.67

tracepath 142.250.179.67 -4


4.
a)
grep "ICMP time" tracepath-trace.txt

b) 
grep "ttl" tracepath-trace.txt
