SlideShare a Scribd company logo
1 of 22
Download to read offline
UE31 - M3102 : Services Réseaux
Corrigé du TP 3
Services FTP et DHCP
IUT Aix-Marseille - INFO Aix C. Pain-Barre
1 FTP
1.6 Exercices
Corrigé de l’exercice 1 (Session FTP graphique à allegro)
[Consulter l’énoncé]
Cet exercice ne devrait pas poser de problèmes particuliers. La fenêtre de gftp devrait ressembler à celle de
la figure 1.
FIGURE 1 – Transfert de fichier par FTP réalisé avec gftp
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 2/22
Corrigé de l’exercice 2 (Session FTP en mode texte à allegro)
[Consulter l’énoncé]
toto@pc$ ftp allegro
Connected to allegro.aix.univ-amu.fr.
220 allegro.aix.univ-amu.fr FTP server (Version 6.4/OpenBSD/Linux-ftpd-0.17) ready.
Name (allegro:toto): etxxxx
331 Password required for etxxxx.
Password: mon password
230- Linux allegro 2.6.32-5-686 #1 SMP Sat May 5 01:33:08 UTC 2012 i686
230-
230- The programs included with the Debian GNU/Linux system are free software;
230- the exact distribution terms for each program are described in the
230- individual files in /usr/share/doc/*/copyright.
230-
230- Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
230- permitted by applicable law.
230 User etxxxx logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
1. ftp> passive
Passive mode on.
2. ftp> cd /home/cpb/public/unix
250 CWD command successful.
ftp> dir
227 Entering Passive Mode (139,124,181,131,195,191)
150 Opening ASCII mode data connection for '/bin/ls'.
total 4788
-rw-r--r-- 1 cpb prof 19254 Aug 30 2012 BonnePartieDeTP6UnixIUT.pdf.bz2
-rw-r--r-- 1 cpb prof 476014 Aug 30 2012 Cours8&9Unix.pdf.bz2
-rw-r--r-- 1 cpb prof 96059 Aug 30 2012 TP6UnixIUT.pdf.bz2
-rw-r--r-- 1 cpb prof 50500 Aug 30 2012 Test08-10-04.pdf.bz2
-rw-r--r-- 1 cpb prof 4840 Aug 30 2012 a_decouper.txt
...
226 Transfer complete.
ftp> bin
200 Type set to I.
Á le fichier à transférer est de type binaire
ftp> get bart.gif
local: bart.gif remote: bart.gif
227 Entering Passive Mode (139,124,181,131,148,182)
150 Opening BINARY mode data connection for 'bart.gif' (3807 bytes).
226 Transfer complete.
3807 bytes received in 0.04 secs (83.5 kB/s)
3. ... pas de corrigé pour cette question...
4. ftp> cd /home/etxxxx
250 CWD command successful.
ftp> ascii
200 Type set to A.
Á cette fois, le fichier à déposer est un fichier texte
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
3/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
ftp> put un-fichier.txt
local: un-fichier.txt remote: un-fichier.txt
227 Entering Passive Mode (139,124,181,131,191,139)
150 Opening ASCII mode data connection for 'un-fichier.txt'.
226 Transfer complete.
128 bytes sent in 0.00 secs (2500.0 kB/s)
5. ftp> bye
221 Goodbye.
toto@pc$
Corrigé de l’exercice 3 (Session FTP avec ftp.rfc-editor.org depuis Linux)
[Consulter l’énoncé]
toto@pc$ ftp ftp.rfc-editor.org
Connected to ftp.rfc-editor.org.
220 "FTP Server Ready"
Name (ftp.rfc-editor.org:toto): anonymous
331 Please specify the password.
Password: toto@etu.univ-amu.fr
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
1. ftp> passive
Passive mode on.
2. ftp> cd in-notes
250 Directory successfully changed.
3. ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> ascii
200 Switching to ASCII mode.
ftp> get rfc1939.txt
local: rfc1939.txt remote: rfc1939.txt
227 Entering Passive Mode (4,31,198,49,117,146).
150 Opening ASCII mode data connection for rfc1939.txt (47018 bytes).
################################################
226 Transfer complete.
48309 bytes received in 0.52 secs (90.1 kB/s)
4. ftp> bye
221 Goodbye.
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 4/22
1.8 Exercices
Corrigé de l’exercice 4 (Transfert manuel en mode passif)
[Consulter l’énoncé]
toto@pc$ telnet ftp.rfc-editor.org 21
Trying 4.31.198.49...
Connected to ftp.rfc-editor.org.
Escape character is '^]'.
220 "FTP Server Ready"
USER anonymous
331 Please specify the password.
PASS toto@etu.univ-amu.fr
230 Login successful.
CWD in-notes
250 Directory successfully changed.
TYPE A
200 Switching to ASCII mode.
PASV
227 Entering Passive Mode (4,31,198,49,117,68).
Á à ce stade, il faut se connecter à l’adresse (4.31.198.49) et au port (117 × 256 + 68), indiqués
entre parenthèses dans la ligne ci-dessus. Pour cela, on utilise nc (et un peu de shell) dans un autre
terminal :
$ nc 4.31.198.49 $((117*256+68)) > rfc821.txt
Á où $((117*256+68)) demande à bash de calculer le port (30020), et où on redirige
la sortie de nc dans le fichier de notre choix (rfc821.txt)
RETR rfc821.txt
150 Opening ASCII mode data connection for rfc821.txt (120432 bytes).
226 Transfer complete.
Á à ce stade, le transfert est terminé, nc s’arrête, et le fichier rfc821.txt a été rempli
QUIT
221 Goodbye.
Connection closed by foreign host.
toto@pc$
1.9 Installation du serveur ProFTP
Corrigé de l’exercice 5 (Installation de proftpd)
[Consulter l’énoncé]
1. ... pas de corrigé pour cette question...
2. ... pas de corrigé pour cette question...
3. ... pas de corrigé pour cette question...
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
5/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
4. m2:~# apt-get update
Ign http://ftp.fr.debian.org lenny Release.gpg
Ign http://ftp.fr.debian.org lenny/main Translation-en_US
...
Get:5 http://archive.debian.org lenny/main Packages [5191kB]
Get:6 http://archive.debian.org lenny/contrib Packages [76.2kB]
...
W: Failed to fetch http://security.debian.org/dists/lenny/updates/contrib/source/So
E: Some index files failed to download, they have been ignored, or old ones used in
5. m2:~# apt-cache search ftp-server
ftpd-ssl - FTP server with SSL encryption support
ftpd - File Transfer Protocol (FTP) server
...
wu-ftpd - powerful and widely used FTP server
...
proftpd-basic - versatile, virtual-hosting FTP daemon - binaries
vsftpd - The Very Secure FTP Daemon
6. m2:~# apt-get install proftpd-basic
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
Suggested packages:
proftpd-doc proftpd-mod-mysql proftpd-mod-pgsql proftpd-mod-ldap
The following NEW packages will be installed:
proftpd-basic
0 upgraded, 1 newly installed, 0 to remove and 543 not upgraded.
Need to get 691kB of archives.
After this operation, 1603kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
proftpd-basic
Install these packages without verification [y/N]? y
Get:1 http://archive.debian.org lenny/main proftpd-basic 1.3.1-17lenny9 [691kB]
Fetched 691kB in 0s (1441kB/s)
Preconfiguring packages ...
Selecting previously deselected package proftpd-basic.
(Reading database ... 78259 files and directories currently installed.)
Unpacking proftpd-basic (from .../proftpd-basic_1.3.1-17lenny9_i386.deb) ...
Setting up proftpd-basic (1.3.1-17lenny9) ...
Adding system user `proftpd' (UID 108) ...
Adding new user `proftpd' (UID 108) with group `nogroup' ...
Not creating home directory `/var/run/proftpd'.
Adding system user `ftp' (UID 109) ...
Adding new user `ftp' (UID 109) with group `nogroup' ...
Creating home directory `/home/ftp' ...
`/usr/share/proftpd/templates/welcome.msg' -> `/home/ftp/welcome.msg.proftpd-new'
Starting ftp server: proftpd.
7. m2:~# /etc/init.d/proftpd start
Starting ftp server: proftpd.
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 6/22
8. m2:~# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:58917 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4459 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN
tcp6 0 0 :::21 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
Á Les options utilisées sont -t pour TCP, -l pour les serveurs en écoute (listen), et -n pour garder
les adresses et les ports sous forme numérique. Ca n’a pas d’importance mais on peut aussi
remarquer que le serveur utilise une adresse d’écoute IPv6 (mais qui comprend IPv4).
9. Une recherche de la chaîne ftp dans le fichier suffit :
m2:~# grep -i ftp /etc/services
ftp-data 20/tcp
ftp 21/tcp
tftp 69/udp
sftp 115/tcp
ftps-data 989/tcp # FTP over SSL (data)
ftps 990/tcp
venus-se 2431/udp # udp sftp side effect
codasrv-se 2433/udp # udp sftp side effect
frox 2121/tcp # frox: caching ftp proxy
zope-ftp 8021/tcp # zope management by ftp
Á les ports concernés sont mis en évidence en gras
Corrigé de l’exercice 6 (Autoriser l’accès à root)
[Consulter l’énoncé]
1.
 D’abord, il faut configurer m1 :
m1:~# ifconfig eth0 10.0.2.15/24
m1:~# route add default gw 10.0.2.2
m1:~# ftp 10.0.2.10
Connected to 10.0.2.10.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
Name (10.0.2.10:root):
331 Password required for root
Password:
530 Login incorrect.
Login failed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp quit
221 Goodbye.
Á En effet, le login root a échoué
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
7/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
2. (a) le fichier modifié devrait commencer par les lignes suivantes, où les modifications sont en gras :
# /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5).
# root
daemon
...
(b) La portion du fichier modifié devrait contenir les lignes :
...
# DefaultRoot ~
# Autoriser le login root
RootLogin on
...
(c) m2:~# /etc/init.d/proftpd stop
Stopping ftp server: proftpd.
m2:~# /etc/init.d/proftpd start
Starting ftp server: proftpd.
 on aurait pu aussi taper la seule commande :
m2:~# /etc/init.d/proftpd restart
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
3. m1:~# ftp 10.0.2.10
Connected to 10.0.2.10.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
Name (10.0.2.10:root):
331 Password required for root
Password:
230 User root logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
drwx------ 2 root root 4096 Sep 15 2007 Desktop
drwxr-xr-x 2 root root 4096 Sep 5 2007 tmp
226 Transfer complete
ftp quit
221 Goodbye.
4. ... pas de corrigé pour cette question...
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 8/22
Corrigé de l’exercice 7 (Autoriser l’accès aux utilisateurs)
[Consulter l’énoncé]
1. m2:~# adduser toto
Adding user `toto' ...
Adding new group `toto' (1000) ...
Adding new user `toto' (1000) with group `toto' ...
Creating home directory `/home/toto' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: toto
Retype new UNIX password: toto
passwd: password updated successfully
Changing the user information for toto
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/N] y
m2:~# adduser titi
Adding user `titi' ...
...
m2:~#
2. m1:~# pwd
/root
m1:~# ls
Desktop tmp
Á pour le moment, il n’y a que deux répertoires dans le répertoire personnel de root sur m1
m1:~# ftp 10.0.2.10
Connected to 10.0.2.10.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
Name (10.0.2.10:root): toto
331 Password required for toto
Password:
230 User toto logged in
Remote system type is UNIX.
Using binary mode to transfer files.
Á le login de toto a bien été accepté
ftp pwd
257 /home/toto is the current directory
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
226 Transfer complete
Á son répertoire personnel est vide sur m2
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
9/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
ftp put /etc/passwd passwd
local: /etc/passwd remote: passwd
200 PORT command successful
150 Opening BINARY mode data connection for passwd
226 Transfer complete
1091 bytes sent in 0.00 secs (5667.2 kB/s)
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 toto toto 1091 Dec 29 12:25 passwd
226 Transfer complete
Á toto peut y déposer un fichier
ftp get passwd mypassswd
local: mypassswd remote: passwd
200 PORT command successful
150 Opening BINARY mode data connection for passwd (1091 bytes)
226 Transfer complete
1091 bytes received in 0.00 secs (716.5 kB/s)
ftp ! ls -l
total 12
drwx------ 2 root root 4096 2007-09-15 13:22 Desktop
-rw-r--r-- 1 root root 1091 2014-12-29 13:26 mypassswd
drwxr-xr-x 2 root root 4096 2007-09-05 18:00 tmp
ftp
Á et peut aussi en télécharger ; les transferts fonctionnent bien dans les deux sens.
3. ftp cd ..
250 CWD command successful
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 ftp nogroup 4096 Dec 29 11:09 ftp
drwxr-xr-x 2 titi titi 4096 Dec 29 12:23 titi
drwxr-xr-x 2 toto toto 4096 Dec 29 12:25 toto
226 Transfer complete
ftp cd ftp
250 CWD command successful
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 root root 170 Nov 16 2011 welcome.msg
226 Transfer complete
ftp get welcome.msg
local: welcome.msg remote: welcome.msg
200 PORT command successful
150 Opening BINARY mode data connection for welcome.msg (170 bytes)
226 Transfer complete
170 bytes received in 0.00 secs (532.1 kB/s)
ftp ! ls
Desktop mypassswd tmp welcome.msg
Á effectivement, toto peut se balader dans l’arborescence et télécharger des fichiers
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 10/22
4. La portion du fichier concernée devient donc :
...
# Use this to jail all users in their homes
DefaultRoot ~
...
5. ftp open 10.0.2.10
Connected to 10.0.2.10.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
Name (10.0.2.10:root): toto
331 Password required for toto
Password: toto
230 User toto logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 toto toto 1091 Dec 29 12:25 passwd
226 Transfer complete
ftp cd ..
250 CWD command successful
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 toto toto 1091 Dec 29 12:25 passwd
226 Transfer complete
Á tiens ? en redescendant, on a le même contenu ?
ftp pwd
257 / is the current directory
Á en effet, car toto se situe à la racine, c’est à dire son répertoire personnel...
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
11/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
Corrigé de l’exercice 8 (Autoriser le login anonyme)
[Consulter l’énoncé]
1. La portion du fichier modifiée devient :
Anonymous ~ftp
User ftp
Group nogroup
# We want clients to be able to login with anonymous as well as ftp
UserAlias anonymous ftp
# Cosmetic changes, all files belongs to ftp user
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
# Limit the maximum number of anonymous logins
MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayChdir .message
# Limit WRITE everywhere in the anonymous chroot
Directory *
Limit WRITE
DenyAll
/Limit
/Directory
# Uncomment this if you're brave.
Directory incoming
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
Limit READ WRITE
DenyAll
/Limit
Limit STOR
AllowAll
/Limit
/Directory
/Anonymous
2. m1:~# cp /etc/passwd .
3. m1:~# ftp 10.0.2.10
Connected to 10.0.2.10.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
Name (10.0.2.10:root): anonymous
331 Anonymous login ok, send your complete email address as your password
Password:
230-Welcome, archive user anonymous@::ffff:10.0.2.15 !
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 12/22
230-
230-The local time is: Tue Dec 23 17:54:06 2014
230-
230-This is an experimental FTP server. If you have any unusual problems,
230-please report them via e-mail to root@localhost.
230-
230 Anonymous access granted, restrictions apply
Remote system type is UNIX.
Using binary mode to transfer files.
ftp
4. ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 ftp ftp 170 Nov 16 2011 welcome.msg
226 Transfer complete
ftp ascii
200 Type set to A
ftp get welcome.msg
local: welcome.msg remote: welcome.msg
200 PORT command successful
150 Opening ASCII mode data connection for welcome.msg (170 bytes)
226 Transfer complete
177 bytes received in 0.00 secs (442.1 kB/s)
ftp ! cat welcome.msg
Welcome, archive user %U@%R !
The local time is: %T
This is an experimental FTP server. If you have any unusual problems,
please report them via e-mail to root@%L.
5. ftp put passwd
local: passwd remote: passwd
200 PORT command successful
550 passwd: No such file or directory
Á en effet, le transfert est refusé
6. m2:~# cp /etc/services /home/ftp
m2:~# ls -l /home/ftp
total 24
-rw-r--r-- 1 root root 18274 2014-12-29 14:56 services
-rw-r--r-- 1 root root 170 2011-11-16 10:55 welcome.msg
7. Sur la session FTP de m1 :
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 ftp ftp 18274 Dec 23 17:02 services
-rw-r--r-- 1 ftp ftp 170 Nov 16 2011 welcome.msg
226 Transfer complete
8. Sur m2 :
m2:~# mkdir /home/ftp/incoming
m2:~# ls -ld /home/ftp/incoming
drwxr-xr-x 2 root root 4096 2014-12-29 15:06 /home/ftp/incoming
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
13/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
et sur la session FTP de m1 :
ftp dir
200 PORT command successful
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 ftp ftp 4096 Dec 29 13:58 incoming
-rw-r--r-- 1 ftp ftp 18274 Dec 29 13:56 services
-rw-r--r-- 1 ftp ftp 170 Nov 16 2011 welcome.msg
226 Transfer complete
Á le répertoire incoming est bien présent
ftp put /etc/protocols incoming/protocols
local: /etc/protocols remote: incoming/protocols
200 PORT command successful
550 incoming/protocols: Permission denied
Á mais on ne peut y déposer un fichier
9. On peut observer que ce sont les identités indiquées dans la partie Anonymous ~ftp du fichier de
configuration...
10. ftp put /etc/protocols incoming/protocols
local: /etc/protocols remote: incoming/protocols
200 PORT command successful
150 Opening BINARY mode data connection for incoming/protocols
226 Transfer complete
2510 bytes sent in 0.00 secs (6846.8 kB/s)
ftp dir incoming
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 ftp ftp 2510 Dec 29 14:11 protocols
226 Transfer complete
Á le fichier a bien été déposé sur le serveur
11. ftp get incoming/protocols zefile
local: zefile remote: incoming/protocols
200 PORT command successful
550 incoming/protocols: No such file or directory
Á précisons que c’est le téléchargement qui pose problème et non pas le nom qu’on veut donner
à notre copie du fichier
12. Dans la partie Directory incoming, il faut ajouter la directive :
AllowOverwrite off
et remplacer la directive :
Limit READ WRITE
DenyAll
/Limit
par les deux directives :
Limit WRITE
DenyAll
/Limit
Limit READ
AllowAll
/Limit
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 14/22
Et enfin redémarrer le serveur :
m2:/home/ftp# /etc/init.d/proftpd restart
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
13. On rouvre une session FTP :
ftp open 10.0.2.10
Connected to 10.0.2.10.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
Name (10.0.2.10:root): anonymous
331 Anonymous login ok, send your complete email address as your password
Password:
230-Welcome, archive user anonymous@::ffff:10.0.2.15 !
230-
230-The local time is: Mon Dec 29 15:18:20 2014
230-
230-This is an experimental FTP server. If you have any unusual problems,
230-please report them via e-mail to root@localhost.
230-
230 Anonymous access granted, restrictions apply
Remote system type is UNIX.
Using binary mode to transfer files.
ftp dir incoming
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 ftp ftp 2510 Dec 29 14:11 protocols
226 Transfer complete
ftp get incoming/protocols ze-file
local: ze-file remote: incoming/protocols
200 PORT command successful
150 Opening BINARY mode data connection for incoming/protocols (2510 bytes)
226 Transfer complete
2510 bytes received in 0.00 secs (1518.7 kB/s)
Á le téléchargement du fichier fonctionne bien
ftp put /etc/passwd incoming/protocols
local: /etc/passwd remote: incoming/protocols
200 PORT command successful
550 incoming/protocols: Overwrite permission denied
Á et on ne peut pas écraser le fichier
ftp delete incoming/protocols
550 incoming/protocols: No such file or directory
Á ni le supprimer
ftp append /etc/passwd incoming/protocols
local: /etc/passwd remote: incoming/protocols
200 PORT command successful
550 incoming/protocols: No such file or directory
Á on ne peut pas non plus lui ajouter du contenu
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
15/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
ftp put /etc/passwd incoming/truc
local: /etc/passwd remote: incoming/truc
200 PORT command successful
150 Opening BINARY mode data connection for incoming/truc
226 Transfer complete
1091 bytes sent in 0.00 secs (7102.9 kB/s)
ftp dir incoming
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-r--r-- 1 ftp ftp 2510 Dec 29 14:11 protocols
-rw-r--r-- 1 ftp ftp 1091 Dec 29 14:36 truc
226 Transfer complete
Á on peut toujours déposer un fichier
ftp rename incoming/truc incoming/passwd
350 File or directory exists, ready for destination name
550 Rename incoming/passwd: No such file or directory
Á mais qu’on ne peut même pas renommer...
Corrigé de l’exercice 9 (Transfert manuel en mode actif)
[Consulter l’énoncé]
1. Le serveur écoute sur le port 21 donc :
m1:~# telnet 10.0.2.10 21
Trying 10.0.2.10...
Connected to 10.0.2.10.
Escape character is '^]'.
220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10]
2. USER toto
331 Password required for toto
PASS toto
230 User toto logged in
3.
4. $ nc -l -p 12345
5. PORT 10,0,2,15,48,57
200 PORT command successful
6. LIST
150 Opening ASCII mode data connection for file list
226 Transfer complete
Á le serveur de m2 envoie le contenu du répertoire sur la connexion de données, établie avec nc
(mode actif)
7. QUIT
221 Goodbye.
Connection closed by foreign host.
m1:~#
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 16/22
2 DHCP
2.1 Configuration d’un serveur DHCP
Corrigé de l’exercice 11 (configuration du serveur DHCP de m2)
[Consulter l’énoncé]
1. Le fichier après la modification :
m2:~# cat /etc/default/dhcp3-server
# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. eth0 eth1.
INTERFACES=eth0
2. Le fichier (extrait) après les modifications :
m2:~# cat /etc/dhcp3/dhcpd.conf
...
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name iut.univ-aix.fr;
option domain-name-servers 139.124.1.2;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
# log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
17/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
subnet 10.0.2.0 netmask 255.255.255.0 {
range 10.0.2.120 10.0.2.150;
option routers 10.0.2.2;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.2.255;
host vmxp {
hardware ethernet 08:00:26:66:20:13;
fixed-address 10.0.2.20;
}
}
...
Á Si la VM Windows XP a effectivement pour adresses MAC 08:00:26:66:20:13
3. m2:~# /etc/init.d/dhcp3-server start
Starting DHCP server: dhcpd3.
2.2 Configuration des clients DHCP
Corrigé de l’exercice 12 (configuration temporaire du client DHCP de m1)
[Consulter l’énoncé]
1. m1:~# dhclient eth0
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/02:04:06:22:ab:24
Sending on LPF/eth0/02:04:06:22:ab:24
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 10.0.2.10
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 10.0.2.10
bound to 10.0.2.120 -- renewal in 273 seconds.
2. m1:~# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 02:04:06:22:ab:24
inet addr:10.0.2.120 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::4:6ff:fe22:ab24/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:263 errors:0 dropped:0 overruns:0 frame:0
TX packets:275 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9742 (9.5 KiB) TX bytes:12971 (12.6 KiB)
Interrupt:5
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 18/22
m1:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0
m1:~# cat /etc/resolv.conf
domain iut.univ-aix.fr
search iut.univ-aix.fr
nameserver 139.124.1.2
m1:~#
Á Tout ce qu’on a fait jusqu’à présent sur m1 devrait continuer de fonctionner.
Corrigé de l’exercice 13 (configuration du client DHCP de la VM Windows)
[Consulter l’énoncé]
1. il faut configurer l’interface via DHCP :
C:netsh int ip set address Connexion au réseau local dhcp
Ok.
2. C:ipconfig
Configuration IP de Windows
Carte Ethernet Connexion au réseau local:
Suffixe DNS propre à la connexion : iut.univ-aix.fr
Adresse IP. . . . . . . . . . . . : 10.0.2.20
Masque de sous-réseau . . . . . . : 255.255.255.0
Passerelle par défaut . . . . . . : 10.0.2.2
On peut aussi utiliser ipconfig/all pour avoir plus de détails sur la configuration.
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
19/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
C:route print
===========================================================================
Liste d'Interfaces
0x1 ........................... MS TCP Loopback interface
0x2 ...08 00 27 71 76 54 ...... Carte AMD PCNET Family Ethernet PCI - Mini...
===========================================================================
===========================================================================
Itinéraires actifs :
Destination réseau Masque réseau Adr. passerelle Adr. interface Métrique
0.0.0.0 0.0.0.0 10.0.2.2 10.0.2.20 20
10.0.2.0 255.255.255.0 10.0.2.20 10.0.2.20 20
10.0.2.20 255.255.255.255 127.0.0.1 127.0.0.1 20
10.0.2.255 255.255.255.255 10.0.2.20 10.0.2.20 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 240.0.0.0 10.0.2.20 10.0.2.20 20
255.255.255.255 255.255.255.255 10.0.2.20 10.0.2.20 1
Passerelle par défaut : 10.0.2.2
===========================================================================
Itinéraires persistants :
Aucun
Corrigé de l’exercice 14 (configuration permanente du client DHCP de m1)
[Consulter l’énoncé]
1. Au même titre que la VM XP précédemment, il faut ajouter une entrée host pour m1 :
host m1 {
hardware ethernet 02:04:06:22:ab:24;
fixed-address 10.0.2.15;
}
2. Après redémarrage :
m1:~# ifconfig
eth0 Link encap:Ethernet HWaddr 02:04:06:22:ab:24
inet6 addr: fe80::4:6ff:fe22:ab24/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
...
Á la configuration n’a pas été obtenue
3. ... pas de corrigé pour cette question...
4. ... pas de corrigé pour cette question...
5. Après redémarrage :
m1:~# ifconfig
eth0 Link encap:Ethernet HWaddr 02:04:06:22:ab:24
inet addr:10.0.2.120 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::4:6ff:fe22:ab24/64 Scope:Link
...
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 20/22
m1:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0
3 Le courrier électronique
3.1 Clients de messagerie
Il ne devrait pas y avoir besoin de corrigé...
3.2 Format d’un message électronique
3.3 SMTP
3.3.1 Messages du protocole SMTP
3.3.2 Exercice
Corrigé de l’exercice 16 (Envoi du message anonyme)
[Consulter l’énoncé]
$ telnet allegro 25
Trying 139.124.181.131...
Connected to allegro.aix.univ-amu.fr.
Escape character is '^]'.
220 allegro.iut.univ-aix.fr ESMTP Postfix (Debian/GNU)
HELO mamachine.com
250 allegro.iut.univ-aix.fr
MAIL FROM:tarzan@jungle.org
250 2.1.0 Ok
RCPT TO:cpb
250 2.1.5 Ok
DATA
354 End data with CRLF.CRLF
From: Tarzan of the Jungle tarzan@jungle.org
To: Cyril Pain-Barre cpb@allegro
Subject: Un message super interessant
blablabla le message anonyme
et patati et patata
.
250 2.0.0 Ok: queued as CDCCBF975
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
$
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
21/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux
Si on consulte ce message par mail, voici ça donne :
$ mail
mailx version nail 11.25 7/29/05. Type ? for help.
/var/spool/mail/cpb: 1 message 1 new
N 1 Tarzan of the Jung Tue May 13 10:51 16/619 Un message super interessant
? 1
Message 1:
From tarzan@jungle.org Tue May 13 10:51:50 2008
Return-Path: tarzan@jungle.org
X-Original-To: cpb
Delivered-To: cpb@allegro.iut.univ-aix.fr
From: Tarzan of the Jungle tarzan@jungle.org
To: Cyril Pain-Barre cpb@allegro.iut.univ-aix.fr
Subject: Un message super interessant
Date: Tue, 13 May 2008 10:48:53 +0200 (CEST)
Status: R
blablabla le message anonyme
et patati et patata
? x
Si on le récupère par Thunderbird et qu’on double-clique dessus, voici ce que l’on obtient :
IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 22/22
3.4 Étude de la RFC de POP3
Corrigé de l’exercice 17 (récupération de messages avec POP3)
[Consulter l’énoncé]
Voici la trace de la discussion avec le serveur POP3 d’allegro, en supposant qu’il y a 4 messages dans la boîte aux
lettres et que le message anonyme est le dernier :
$ telnet allegro 110
Trying 139.124.181.131...
Connected to allegro.aix.univ-amu.fr.
Escape character is '^]'.
+OK
USER cpb
+OK
PASS mon-mot-de-passe
+OK
LIST
+OK
1 470
2 390
3 281
4 455
.
RETR 4
+OK
Return-Path: tarzan@jungle.org
X-Original-To: cpb
Delivered-To: cpb@allegro.iut.univ-aix.fr
Received: from mamachine.com (a73.iut.univ-aix.fr [139.124.187.73])
by allegro.iut.univ-aix.fr (Postfix) with SMTP id CDCCBF975
for cpb; Mon, 29 Dec 2014 16:45:54 +0100 (CET)
From: Tarzan of the Jungle tarzan@jungle.org
To: Cyril Pain-Barre cpb@allegro
Subject: Un message super interessant
blablabla le message anonyme
et patati et patata
.
DELE 4
+OK
QUIT
+OK
Connection closed by foreign host.
C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix

More Related Content

What's hot

Travaux pratiques configuration du routage entre réseaux locaux virtuels
Travaux pratiques   configuration du routage entre réseaux locaux virtuelsTravaux pratiques   configuration du routage entre réseaux locaux virtuels
Travaux pratiques configuration du routage entre réseaux locaux virtuelsMohamed Keita
 
Ccna 4 configuration-de_frame_ relay_hub_and_spoke
Ccna 4 configuration-de_frame_ relay_hub_and_spokeCcna 4 configuration-de_frame_ relay_hub_and_spoke
Ccna 4 configuration-de_frame_ relay_hub_and_spokeTouré Kunda
 
Comment paramétrer une connexion adsl sur un modem
Comment paramétrer une connexion adsl sur un modemComment paramétrer une connexion adsl sur un modem
Comment paramétrer une connexion adsl sur un modemCONNECT Tunisia
 
Tp snmp-packet-tracer
Tp snmp-packet-tracerTp snmp-packet-tracer
Tp snmp-packet-tracerChris Dogny
 
vpn-site-a-site-avec-des-routeurs-cisco
 vpn-site-a-site-avec-des-routeurs-cisco vpn-site-a-site-avec-des-routeurs-cisco
vpn-site-a-site-avec-des-routeurs-ciscoCamara Assane
 
Configuration dns sous linux
Configuration  dns sous linuxConfiguration  dns sous linux
Configuration dns sous linuxBalamine Gassama
 
4 protocole de redondance(hsrp-vrrp-glbp)
4 protocole de redondance(hsrp-vrrp-glbp)4 protocole de redondance(hsrp-vrrp-glbp)
4 protocole de redondance(hsrp-vrrp-glbp)medalaa
 
system de gestion Nfs (Network File System)
system de gestion Nfs (Network File System)system de gestion Nfs (Network File System)
system de gestion Nfs (Network File System)ninanoursan
 
TP switch pod4
TP switch pod4TP switch pod4
TP switch pod4mickaelday
 
3 switchport securité
3 switchport securité3 switchport securité
3 switchport securitémedalaa
 
Lire les tables de routage
Lire les tables de routageLire les tables de routage
Lire les tables de routagebelhadj_rached
 
Authentification des protocoles de routage
Authentification des protocoles de routageAuthentification des protocoles de routage
Authentification des protocoles de routageThomas Moegli
 

What's hot (20)

Travaux pratiques configuration du routage entre réseaux locaux virtuels
Travaux pratiques   configuration du routage entre réseaux locaux virtuelsTravaux pratiques   configuration du routage entre réseaux locaux virtuels
Travaux pratiques configuration du routage entre réseaux locaux virtuels
 
Protocole EIGRP
Protocole EIGRPProtocole EIGRP
Protocole EIGRP
 
Ccna 4 configuration-de_frame_ relay_hub_and_spoke
Ccna 4 configuration-de_frame_ relay_hub_and_spokeCcna 4 configuration-de_frame_ relay_hub_and_spoke
Ccna 4 configuration-de_frame_ relay_hub_and_spoke
 
Comment paramétrer une connexion adsl sur un modem
Comment paramétrer une connexion adsl sur un modemComment paramétrer une connexion adsl sur un modem
Comment paramétrer une connexion adsl sur un modem
 
Tp snmp-packet-tracer
Tp snmp-packet-tracerTp snmp-packet-tracer
Tp snmp-packet-tracer
 
vpn-site-a-site-avec-des-routeurs-cisco
 vpn-site-a-site-avec-des-routeurs-cisco vpn-site-a-site-avec-des-routeurs-cisco
vpn-site-a-site-avec-des-routeurs-cisco
 
E4 pt act_7_5_1
E4 pt act_7_5_1E4 pt act_7_5_1
E4 pt act_7_5_1
 
Eigrp ccna v5
Eigrp ccna v5 Eigrp ccna v5
Eigrp ccna v5
 
Configuration dns sous linux
Configuration  dns sous linuxConfiguration  dns sous linux
Configuration dns sous linux
 
Configuration dns
Configuration dnsConfiguration dns
Configuration dns
 
4 protocole de redondance(hsrp-vrrp-glbp)
4 protocole de redondance(hsrp-vrrp-glbp)4 protocole de redondance(hsrp-vrrp-glbp)
4 protocole de redondance(hsrp-vrrp-glbp)
 
system de gestion Nfs (Network File System)
system de gestion Nfs (Network File System)system de gestion Nfs (Network File System)
system de gestion Nfs (Network File System)
 
TP switch pod4
TP switch pod4TP switch pod4
TP switch pod4
 
Tutoriel nat pat
Tutoriel nat patTutoriel nat pat
Tutoriel nat pat
 
3 switchport securité
3 switchport securité3 switchport securité
3 switchport securité
 
Lire les tables de routage
Lire les tables de routageLire les tables de routage
Lire les tables de routage
 
Redondance
RedondanceRedondance
Redondance
 
10 ipv6
10 ipv610 ipv6
10 ipv6
 
Authentification des protocoles de routage
Authentification des protocoles de routageAuthentification des protocoles de routage
Authentification des protocoles de routage
 
IPV6
IPV6IPV6
IPV6
 

Similar to Corrige tp3 m3102_dut2

05 02 surveillance et analyse de traffic tcpip
05 02 surveillance et analyse de traffic tcpip05 02 surveillance et analyse de traffic tcpip
05 02 surveillance et analyse de traffic tcpipNoël
 
04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...
04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...
04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...ronanlebalch
 
Firewalls
FirewallsFirewalls
Firewallsc0r3war
 
laboratoire formation ccna cisco materiel .ppt
laboratoire formation ccna cisco materiel .pptlaboratoire formation ccna cisco materiel .ppt
laboratoire formation ccna cisco materiel .pptprofsn
 
Composants routeur cisco et différent mode de Configuration
Composants routeur cisco et différent mode de ConfigurationComposants routeur cisco et différent mode de Configuration
Composants routeur cisco et différent mode de ConfigurationZakariaBouzzitMadrid
 
TD_complet_reseau__CISCO__Packet Tracer.pdf
TD_complet_reseau__CISCO__Packet Tracer.pdfTD_complet_reseau__CISCO__Packet Tracer.pdf
TD_complet_reseau__CISCO__Packet Tracer.pdfInes Ben Hassine
 
TP2_dhcp_linux-ubuntu-2023.pdf
TP2_dhcp_linux-ubuntu-2023.pdfTP2_dhcp_linux-ubuntu-2023.pdf
TP2_dhcp_linux-ubuntu-2023.pdfaymanmikh7
 
Présentation Packet Radio et APRS par F4BHQ et F1IJP
Présentation Packet Radio et APRS par F4BHQ et F1IJPPrésentation Packet Radio et APRS par F4BHQ et F1IJP
Présentation Packet Radio et APRS par F4BHQ et F1IJPLionel Repellin
 
Admin reseaux sous linux cours 3
Admin reseaux sous linux   cours 3Admin reseaux sous linux   cours 3
Admin reseaux sous linux cours 3Stephen Salama
 
Réseaux et protocoles - Cours + exercices
Réseaux et protocoles - Cours + exercices Réseaux et protocoles - Cours + exercices
Réseaux et protocoles - Cours + exercices sarah Benmerzouk
 
Sizing PoC LSF & PowerAI for Engineers schools workloads
Sizing PoC LSF & PowerAI for Engineers schools workloadsSizing PoC LSF & PowerAI for Engineers schools workloads
Sizing PoC LSF & PowerAI for Engineers schools workloadsPhilippeBrogi
 
gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018
gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018
gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018Carles Sistare
 
BreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseries
BreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseriesBreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseries
BreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseriesXavier MARIN
 
gRPC, échange à haute fréquence !
gRPC, échange à haute fréquence !gRPC, échange à haute fréquence !
gRPC, échange à haute fréquence !David Caramelo
 
LPIC1 11 01 sécurité réseaux
LPIC1 11 01 sécurité réseauxLPIC1 11 01 sécurité réseaux
LPIC1 11 01 sécurité réseauxNoël
 

Similar to Corrige tp3 m3102_dut2 (20)

05 02 surveillance et analyse de traffic tcpip
05 02 surveillance et analyse de traffic tcpip05 02 surveillance et analyse de traffic tcpip
05 02 surveillance et analyse de traffic tcpip
 
chapitre-2.pptx.pdf
chapitre-2.pptx.pdfchapitre-2.pptx.pdf
chapitre-2.pptx.pdf
 
04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...
04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...
04 2 procédure de configuration du routeur linux ubuntu server 14.04 de nom r...
 
Firewalls
FirewallsFirewalls
Firewalls
 
laboratoire formation ccna cisco materiel .ppt
laboratoire formation ccna cisco materiel .pptlaboratoire formation ccna cisco materiel .ppt
laboratoire formation ccna cisco materiel .ppt
 
Composants routeur cisco et différent mode de Configuration
Composants routeur cisco et différent mode de ConfigurationComposants routeur cisco et différent mode de Configuration
Composants routeur cisco et différent mode de Configuration
 
Astuces cisco
Astuces ciscoAstuces cisco
Astuces cisco
 
TD_complet_reseau__CISCO__Packet Tracer.pdf
TD_complet_reseau__CISCO__Packet Tracer.pdfTD_complet_reseau__CISCO__Packet Tracer.pdf
TD_complet_reseau__CISCO__Packet Tracer.pdf
 
TP2_dhcp_linux-ubuntu-2023.pdf
TP2_dhcp_linux-ubuntu-2023.pdfTP2_dhcp_linux-ubuntu-2023.pdf
TP2_dhcp_linux-ubuntu-2023.pdf
 
Présentation Packet Radio et APRS par F4BHQ et F1IJP
Présentation Packet Radio et APRS par F4BHQ et F1IJPPrésentation Packet Radio et APRS par F4BHQ et F1IJP
Présentation Packet Radio et APRS par F4BHQ et F1IJP
 
Admin reseaux sous linux cours 3
Admin reseaux sous linux   cours 3Admin reseaux sous linux   cours 3
Admin reseaux sous linux cours 3
 
Réseaux et protocoles - Cours + exercices
Réseaux et protocoles - Cours + exercices Réseaux et protocoles - Cours + exercices
Réseaux et protocoles - Cours + exercices
 
Tp voip
Tp voipTp voip
Tp voip
 
Configuration rnis
Configuration rnisConfiguration rnis
Configuration rnis
 
Sizing PoC LSF & PowerAI for Engineers schools workloads
Sizing PoC LSF & PowerAI for Engineers schools workloadsSizing PoC LSF & PowerAI for Engineers schools workloads
Sizing PoC LSF & PowerAI for Engineers schools workloads
 
gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018
gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018
gRPC, ECHANGES A HAUTE FREQUENCE ! DEVOXX 2018
 
BreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseries
BreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseriesBreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseries
BreizhCamp 2019 - IoT et open source hardware pour la collecte de timeseries
 
gRPC, échange à haute fréquence !
gRPC, échange à haute fréquence !gRPC, échange à haute fréquence !
gRPC, échange à haute fréquence !
 
LPIC1 11 01 sécurité réseaux
LPIC1 11 01 sécurité réseauxLPIC1 11 01 sécurité réseaux
LPIC1 11 01 sécurité réseaux
 
Config ip
Config ipConfig ip
Config ip
 

Corrige tp3 m3102_dut2

  • 1. UE31 - M3102 : Services Réseaux Corrigé du TP 3 Services FTP et DHCP IUT Aix-Marseille - INFO Aix C. Pain-Barre 1 FTP 1.6 Exercices Corrigé de l’exercice 1 (Session FTP graphique à allegro) [Consulter l’énoncé] Cet exercice ne devrait pas poser de problèmes particuliers. La fenêtre de gftp devrait ressembler à celle de la figure 1. FIGURE 1 – Transfert de fichier par FTP réalisé avec gftp IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 2. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 2/22 Corrigé de l’exercice 2 (Session FTP en mode texte à allegro) [Consulter l’énoncé] toto@pc$ ftp allegro Connected to allegro.aix.univ-amu.fr. 220 allegro.aix.univ-amu.fr FTP server (Version 6.4/OpenBSD/Linux-ftpd-0.17) ready. Name (allegro:toto): etxxxx 331 Password required for etxxxx. Password: mon password 230- Linux allegro 2.6.32-5-686 #1 SMP Sat May 5 01:33:08 UTC 2012 i686 230- 230- The programs included with the Debian GNU/Linux system are free software; 230- the exact distribution terms for each program are described in the 230- individual files in /usr/share/doc/*/copyright. 230- 230- Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent 230- permitted by applicable law. 230 User etxxxx logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> 1. ftp> passive Passive mode on. 2. ftp> cd /home/cpb/public/unix 250 CWD command successful. ftp> dir 227 Entering Passive Mode (139,124,181,131,195,191) 150 Opening ASCII mode data connection for '/bin/ls'. total 4788 -rw-r--r-- 1 cpb prof 19254 Aug 30 2012 BonnePartieDeTP6UnixIUT.pdf.bz2 -rw-r--r-- 1 cpb prof 476014 Aug 30 2012 Cours8&9Unix.pdf.bz2 -rw-r--r-- 1 cpb prof 96059 Aug 30 2012 TP6UnixIUT.pdf.bz2 -rw-r--r-- 1 cpb prof 50500 Aug 30 2012 Test08-10-04.pdf.bz2 -rw-r--r-- 1 cpb prof 4840 Aug 30 2012 a_decouper.txt ... 226 Transfer complete. ftp> bin 200 Type set to I. Á le fichier à transférer est de type binaire ftp> get bart.gif local: bart.gif remote: bart.gif 227 Entering Passive Mode (139,124,181,131,148,182) 150 Opening BINARY mode data connection for 'bart.gif' (3807 bytes). 226 Transfer complete. 3807 bytes received in 0.04 secs (83.5 kB/s) 3. ... pas de corrigé pour cette question... 4. ftp> cd /home/etxxxx 250 CWD command successful. ftp> ascii 200 Type set to A. Á cette fois, le fichier à déposer est un fichier texte C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 3. 3/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux ftp> put un-fichier.txt local: un-fichier.txt remote: un-fichier.txt 227 Entering Passive Mode (139,124,181,131,191,139) 150 Opening ASCII mode data connection for 'un-fichier.txt'. 226 Transfer complete. 128 bytes sent in 0.00 secs (2500.0 kB/s) 5. ftp> bye 221 Goodbye. toto@pc$ Corrigé de l’exercice 3 (Session FTP avec ftp.rfc-editor.org depuis Linux) [Consulter l’énoncé] toto@pc$ ftp ftp.rfc-editor.org Connected to ftp.rfc-editor.org. 220 "FTP Server Ready" Name (ftp.rfc-editor.org:toto): anonymous 331 Please specify the password. Password: toto@etu.univ-amu.fr 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> 1. ftp> passive Passive mode on. 2. ftp> cd in-notes 250 Directory successfully changed. 3. ftp> hash Hash mark printing on (1024 bytes/hash mark). ftp> ascii 200 Switching to ASCII mode. ftp> get rfc1939.txt local: rfc1939.txt remote: rfc1939.txt 227 Entering Passive Mode (4,31,198,49,117,146). 150 Opening ASCII mode data connection for rfc1939.txt (47018 bytes). ################################################ 226 Transfer complete. 48309 bytes received in 0.52 secs (90.1 kB/s) 4. ftp> bye 221 Goodbye. IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 4. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 4/22 1.8 Exercices Corrigé de l’exercice 4 (Transfert manuel en mode passif) [Consulter l’énoncé] toto@pc$ telnet ftp.rfc-editor.org 21 Trying 4.31.198.49... Connected to ftp.rfc-editor.org. Escape character is '^]'. 220 "FTP Server Ready" USER anonymous 331 Please specify the password. PASS toto@etu.univ-amu.fr 230 Login successful. CWD in-notes 250 Directory successfully changed. TYPE A 200 Switching to ASCII mode. PASV 227 Entering Passive Mode (4,31,198,49,117,68). Á à ce stade, il faut se connecter à l’adresse (4.31.198.49) et au port (117 × 256 + 68), indiqués entre parenthèses dans la ligne ci-dessus. Pour cela, on utilise nc (et un peu de shell) dans un autre terminal : $ nc 4.31.198.49 $((117*256+68)) > rfc821.txt Á où $((117*256+68)) demande à bash de calculer le port (30020), et où on redirige la sortie de nc dans le fichier de notre choix (rfc821.txt) RETR rfc821.txt 150 Opening ASCII mode data connection for rfc821.txt (120432 bytes). 226 Transfer complete. Á à ce stade, le transfert est terminé, nc s’arrête, et le fichier rfc821.txt a été rempli QUIT 221 Goodbye. Connection closed by foreign host. toto@pc$ 1.9 Installation du serveur ProFTP Corrigé de l’exercice 5 (Installation de proftpd) [Consulter l’énoncé] 1. ... pas de corrigé pour cette question... 2. ... pas de corrigé pour cette question... 3. ... pas de corrigé pour cette question... C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 5. 5/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux 4. m2:~# apt-get update Ign http://ftp.fr.debian.org lenny Release.gpg Ign http://ftp.fr.debian.org lenny/main Translation-en_US ... Get:5 http://archive.debian.org lenny/main Packages [5191kB] Get:6 http://archive.debian.org lenny/contrib Packages [76.2kB] ... W: Failed to fetch http://security.debian.org/dists/lenny/updates/contrib/source/So E: Some index files failed to download, they have been ignored, or old ones used in 5. m2:~# apt-cache search ftp-server ftpd-ssl - FTP server with SSL encryption support ftpd - File Transfer Protocol (FTP) server ... wu-ftpd - powerful and widely used FTP server ... proftpd-basic - versatile, virtual-hosting FTP daemon - binaries vsftpd - The Very Secure FTP Daemon 6. m2:~# apt-get install proftpd-basic Reading package lists... Done Building dependency tree Reading state information... Done ... Suggested packages: proftpd-doc proftpd-mod-mysql proftpd-mod-pgsql proftpd-mod-ldap The following NEW packages will be installed: proftpd-basic 0 upgraded, 1 newly installed, 0 to remove and 543 not upgraded. Need to get 691kB of archives. After this operation, 1603kB of additional disk space will be used. WARNING: The following packages cannot be authenticated! proftpd-basic Install these packages without verification [y/N]? y Get:1 http://archive.debian.org lenny/main proftpd-basic 1.3.1-17lenny9 [691kB] Fetched 691kB in 0s (1441kB/s) Preconfiguring packages ... Selecting previously deselected package proftpd-basic. (Reading database ... 78259 files and directories currently installed.) Unpacking proftpd-basic (from .../proftpd-basic_1.3.1-17lenny9_i386.deb) ... Setting up proftpd-basic (1.3.1-17lenny9) ... Adding system user `proftpd' (UID 108) ... Adding new user `proftpd' (UID 108) with group `nogroup' ... Not creating home directory `/var/run/proftpd'. Adding system user `ftp' (UID 109) ... Adding new user `ftp' (UID 109) with group `nogroup' ... Creating home directory `/home/ftp' ... `/usr/share/proftpd/templates/welcome.msg' -> `/home/ftp/welcome.msg.proftpd-new' Starting ftp server: proftpd. 7. m2:~# /etc/init.d/proftpd start Starting ftp server: proftpd. IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 6. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 6/22 8. m2:~# netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:58917 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:4459 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN tcp6 0 0 :::21 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN Á Les options utilisées sont -t pour TCP, -l pour les serveurs en écoute (listen), et -n pour garder les adresses et les ports sous forme numérique. Ca n’a pas d’importance mais on peut aussi remarquer que le serveur utilise une adresse d’écoute IPv6 (mais qui comprend IPv4). 9. Une recherche de la chaîne ftp dans le fichier suffit : m2:~# grep -i ftp /etc/services ftp-data 20/tcp ftp 21/tcp tftp 69/udp sftp 115/tcp ftps-data 989/tcp # FTP over SSL (data) ftps 990/tcp venus-se 2431/udp # udp sftp side effect codasrv-se 2433/udp # udp sftp side effect frox 2121/tcp # frox: caching ftp proxy zope-ftp 8021/tcp # zope management by ftp Á les ports concernés sont mis en évidence en gras Corrigé de l’exercice 6 (Autoriser l’accès à root) [Consulter l’énoncé] 1. D’abord, il faut configurer m1 : m1:~# ifconfig eth0 10.0.2.15/24 m1:~# route add default gw 10.0.2.2 m1:~# ftp 10.0.2.10 Connected to 10.0.2.10. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] Name (10.0.2.10:root): 331 Password required for root Password: 530 Login incorrect. Login failed. Remote system type is UNIX. Using binary mode to transfer files. ftp quit 221 Goodbye. Á En effet, le login root a échoué C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 7. 7/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux 2. (a) le fichier modifié devrait commencer par les lignes suivantes, où les modifications sont en gras : # /etc/ftpusers: list of users disallowed FTP access. See ftpusers(5). # root daemon ... (b) La portion du fichier modifié devrait contenir les lignes : ... # DefaultRoot ~ # Autoriser le login root RootLogin on ... (c) m2:~# /etc/init.d/proftpd stop Stopping ftp server: proftpd. m2:~# /etc/init.d/proftpd start Starting ftp server: proftpd. on aurait pu aussi taper la seule commande : m2:~# /etc/init.d/proftpd restart Stopping ftp server: proftpd. Starting ftp server: proftpd. 3. m1:~# ftp 10.0.2.10 Connected to 10.0.2.10. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] Name (10.0.2.10:root): 331 Password required for root Password: 230 User root logged in Remote system type is UNIX. Using binary mode to transfer files. ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list drwx------ 2 root root 4096 Sep 15 2007 Desktop drwxr-xr-x 2 root root 4096 Sep 5 2007 tmp 226 Transfer complete ftp quit 221 Goodbye. 4. ... pas de corrigé pour cette question... IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 8. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 8/22 Corrigé de l’exercice 7 (Autoriser l’accès aux utilisateurs) [Consulter l’énoncé] 1. m2:~# adduser toto Adding user `toto' ... Adding new group `toto' (1000) ... Adding new user `toto' (1000) with group `toto' ... Creating home directory `/home/toto' ... Copying files from `/etc/skel' ... Enter new UNIX password: toto Retype new UNIX password: toto passwd: password updated successfully Changing the user information for toto Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [y/N] y m2:~# adduser titi Adding user `titi' ... ... m2:~# 2. m1:~# pwd /root m1:~# ls Desktop tmp Á pour le moment, il n’y a que deux répertoires dans le répertoire personnel de root sur m1 m1:~# ftp 10.0.2.10 Connected to 10.0.2.10. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] Name (10.0.2.10:root): toto 331 Password required for toto Password: 230 User toto logged in Remote system type is UNIX. Using binary mode to transfer files. Á le login de toto a bien été accepté ftp pwd 257 /home/toto is the current directory ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list 226 Transfer complete Á son répertoire personnel est vide sur m2 C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 9. 9/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux ftp put /etc/passwd passwd local: /etc/passwd remote: passwd 200 PORT command successful 150 Opening BINARY mode data connection for passwd 226 Transfer complete 1091 bytes sent in 0.00 secs (5667.2 kB/s) ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 toto toto 1091 Dec 29 12:25 passwd 226 Transfer complete Á toto peut y déposer un fichier ftp get passwd mypassswd local: mypassswd remote: passwd 200 PORT command successful 150 Opening BINARY mode data connection for passwd (1091 bytes) 226 Transfer complete 1091 bytes received in 0.00 secs (716.5 kB/s) ftp ! ls -l total 12 drwx------ 2 root root 4096 2007-09-15 13:22 Desktop -rw-r--r-- 1 root root 1091 2014-12-29 13:26 mypassswd drwxr-xr-x 2 root root 4096 2007-09-05 18:00 tmp ftp Á et peut aussi en télécharger ; les transferts fonctionnent bien dans les deux sens. 3. ftp cd .. 250 CWD command successful ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list drwxr-xr-x 2 ftp nogroup 4096 Dec 29 11:09 ftp drwxr-xr-x 2 titi titi 4096 Dec 29 12:23 titi drwxr-xr-x 2 toto toto 4096 Dec 29 12:25 toto 226 Transfer complete ftp cd ftp 250 CWD command successful ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 root root 170 Nov 16 2011 welcome.msg 226 Transfer complete ftp get welcome.msg local: welcome.msg remote: welcome.msg 200 PORT command successful 150 Opening BINARY mode data connection for welcome.msg (170 bytes) 226 Transfer complete 170 bytes received in 0.00 secs (532.1 kB/s) ftp ! ls Desktop mypassswd tmp welcome.msg Á effectivement, toto peut se balader dans l’arborescence et télécharger des fichiers IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 10. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 10/22 4. La portion du fichier concernée devient donc : ... # Use this to jail all users in their homes DefaultRoot ~ ... 5. ftp open 10.0.2.10 Connected to 10.0.2.10. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] Name (10.0.2.10:root): toto 331 Password required for toto Password: toto 230 User toto logged in Remote system type is UNIX. Using binary mode to transfer files. ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 toto toto 1091 Dec 29 12:25 passwd 226 Transfer complete ftp cd .. 250 CWD command successful ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 toto toto 1091 Dec 29 12:25 passwd 226 Transfer complete Á tiens ? en redescendant, on a le même contenu ? ftp pwd 257 / is the current directory Á en effet, car toto se situe à la racine, c’est à dire son répertoire personnel... C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 11. 11/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux Corrigé de l’exercice 8 (Autoriser le login anonyme) [Consulter l’énoncé] 1. La portion du fichier modifiée devient : Anonymous ~ftp User ftp Group nogroup # We want clients to be able to login with anonymous as well as ftp UserAlias anonymous ftp # Cosmetic changes, all files belongs to ftp user DirFakeUser on ftp DirFakeGroup on ftp RequireValidShell off # Limit the maximum number of anonymous logins MaxClients 10 # We want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayChdir .message # Limit WRITE everywhere in the anonymous chroot Directory * Limit WRITE DenyAll /Limit /Directory # Uncomment this if you're brave. Directory incoming # Umask 022 is a good standard umask to prevent new files and dirs # (second parm) from being group and world writable. Umask 022 022 Limit READ WRITE DenyAll /Limit Limit STOR AllowAll /Limit /Directory /Anonymous 2. m1:~# cp /etc/passwd . 3. m1:~# ftp 10.0.2.10 Connected to 10.0.2.10. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] Name (10.0.2.10:root): anonymous 331 Anonymous login ok, send your complete email address as your password Password: 230-Welcome, archive user anonymous@::ffff:10.0.2.15 ! IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 12. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 12/22 230- 230-The local time is: Tue Dec 23 17:54:06 2014 230- 230-This is an experimental FTP server. If you have any unusual problems, 230-please report them via e-mail to root@localhost. 230- 230 Anonymous access granted, restrictions apply Remote system type is UNIX. Using binary mode to transfer files. ftp 4. ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 ftp ftp 170 Nov 16 2011 welcome.msg 226 Transfer complete ftp ascii 200 Type set to A ftp get welcome.msg local: welcome.msg remote: welcome.msg 200 PORT command successful 150 Opening ASCII mode data connection for welcome.msg (170 bytes) 226 Transfer complete 177 bytes received in 0.00 secs (442.1 kB/s) ftp ! cat welcome.msg Welcome, archive user %U@%R ! The local time is: %T This is an experimental FTP server. If you have any unusual problems, please report them via e-mail to root@%L. 5. ftp put passwd local: passwd remote: passwd 200 PORT command successful 550 passwd: No such file or directory Á en effet, le transfert est refusé 6. m2:~# cp /etc/services /home/ftp m2:~# ls -l /home/ftp total 24 -rw-r--r-- 1 root root 18274 2014-12-29 14:56 services -rw-r--r-- 1 root root 170 2011-11-16 10:55 welcome.msg 7. Sur la session FTP de m1 : ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 ftp ftp 18274 Dec 23 17:02 services -rw-r--r-- 1 ftp ftp 170 Nov 16 2011 welcome.msg 226 Transfer complete 8. Sur m2 : m2:~# mkdir /home/ftp/incoming m2:~# ls -ld /home/ftp/incoming drwxr-xr-x 2 root root 4096 2014-12-29 15:06 /home/ftp/incoming C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 13. 13/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux et sur la session FTP de m1 : ftp dir 200 PORT command successful 150 Opening ASCII mode data connection for file list drwxr-xr-x 2 ftp ftp 4096 Dec 29 13:58 incoming -rw-r--r-- 1 ftp ftp 18274 Dec 29 13:56 services -rw-r--r-- 1 ftp ftp 170 Nov 16 2011 welcome.msg 226 Transfer complete Á le répertoire incoming est bien présent ftp put /etc/protocols incoming/protocols local: /etc/protocols remote: incoming/protocols 200 PORT command successful 550 incoming/protocols: Permission denied Á mais on ne peut y déposer un fichier 9. On peut observer que ce sont les identités indiquées dans la partie Anonymous ~ftp du fichier de configuration... 10. ftp put /etc/protocols incoming/protocols local: /etc/protocols remote: incoming/protocols 200 PORT command successful 150 Opening BINARY mode data connection for incoming/protocols 226 Transfer complete 2510 bytes sent in 0.00 secs (6846.8 kB/s) ftp dir incoming 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 ftp ftp 2510 Dec 29 14:11 protocols 226 Transfer complete Á le fichier a bien été déposé sur le serveur 11. ftp get incoming/protocols zefile local: zefile remote: incoming/protocols 200 PORT command successful 550 incoming/protocols: No such file or directory Á précisons que c’est le téléchargement qui pose problème et non pas le nom qu’on veut donner à notre copie du fichier 12. Dans la partie Directory incoming, il faut ajouter la directive : AllowOverwrite off et remplacer la directive : Limit READ WRITE DenyAll /Limit par les deux directives : Limit WRITE DenyAll /Limit Limit READ AllowAll /Limit IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 14. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 14/22 Et enfin redémarrer le serveur : m2:/home/ftp# /etc/init.d/proftpd restart Stopping ftp server: proftpd. Starting ftp server: proftpd. 13. On rouvre une session FTP : ftp open 10.0.2.10 Connected to 10.0.2.10. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] Name (10.0.2.10:root): anonymous 331 Anonymous login ok, send your complete email address as your password Password: 230-Welcome, archive user anonymous@::ffff:10.0.2.15 ! 230- 230-The local time is: Mon Dec 29 15:18:20 2014 230- 230-This is an experimental FTP server. If you have any unusual problems, 230-please report them via e-mail to root@localhost. 230- 230 Anonymous access granted, restrictions apply Remote system type is UNIX. Using binary mode to transfer files. ftp dir incoming 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 ftp ftp 2510 Dec 29 14:11 protocols 226 Transfer complete ftp get incoming/protocols ze-file local: ze-file remote: incoming/protocols 200 PORT command successful 150 Opening BINARY mode data connection for incoming/protocols (2510 bytes) 226 Transfer complete 2510 bytes received in 0.00 secs (1518.7 kB/s) Á le téléchargement du fichier fonctionne bien ftp put /etc/passwd incoming/protocols local: /etc/passwd remote: incoming/protocols 200 PORT command successful 550 incoming/protocols: Overwrite permission denied Á et on ne peut pas écraser le fichier ftp delete incoming/protocols 550 incoming/protocols: No such file or directory Á ni le supprimer ftp append /etc/passwd incoming/protocols local: /etc/passwd remote: incoming/protocols 200 PORT command successful 550 incoming/protocols: No such file or directory Á on ne peut pas non plus lui ajouter du contenu C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 15. 15/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux ftp put /etc/passwd incoming/truc local: /etc/passwd remote: incoming/truc 200 PORT command successful 150 Opening BINARY mode data connection for incoming/truc 226 Transfer complete 1091 bytes sent in 0.00 secs (7102.9 kB/s) ftp dir incoming 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 ftp ftp 2510 Dec 29 14:11 protocols -rw-r--r-- 1 ftp ftp 1091 Dec 29 14:36 truc 226 Transfer complete Á on peut toujours déposer un fichier ftp rename incoming/truc incoming/passwd 350 File or directory exists, ready for destination name 550 Rename incoming/passwd: No such file or directory Á mais qu’on ne peut même pas renommer... Corrigé de l’exercice 9 (Transfert manuel en mode actif) [Consulter l’énoncé] 1. Le serveur écoute sur le port 21 donc : m1:~# telnet 10.0.2.10 21 Trying 10.0.2.10... Connected to 10.0.2.10. Escape character is '^]'. 220 ProFTPD 1.3.1 Server (Debian) [::ffff:10.0.2.10] 2. USER toto 331 Password required for toto PASS toto 230 User toto logged in 3. 4. $ nc -l -p 12345 5. PORT 10,0,2,15,48,57 200 PORT command successful 6. LIST 150 Opening ASCII mode data connection for file list 226 Transfer complete Á le serveur de m2 envoie le contenu du répertoire sur la connexion de données, établie avec nc (mode actif) 7. QUIT 221 Goodbye. Connection closed by foreign host. m1:~# IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 16. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 16/22 2 DHCP 2.1 Configuration d’un serveur DHCP Corrigé de l’exercice 11 (configuration du serveur DHCP de m2) [Consulter l’énoncé] 1. Le fichier après la modification : m2:~# cat /etc/default/dhcp3-server # Defaults for dhcp initscript # sourced by /etc/init.d/dhcp # installed at /etc/default/dhcp3-server by the maintainer scripts # # This is a POSIX shell fragment # # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. eth0 eth1. INTERFACES=eth0 2. Le fichier (extrait) après les modifications : m2:~# cat /etc/dhcp3/dhcpd.conf ... ddns-update-style none; # option definitions common to all supported networks... option domain-name iut.univ-aix.fr; option domain-name-servers 139.124.1.2; default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). # log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 17. 17/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux subnet 10.0.2.0 netmask 255.255.255.0 { range 10.0.2.120 10.0.2.150; option routers 10.0.2.2; option subnet-mask 255.255.255.0; option broadcast-address 10.0.2.255; host vmxp { hardware ethernet 08:00:26:66:20:13; fixed-address 10.0.2.20; } } ... Á Si la VM Windows XP a effectivement pour adresses MAC 08:00:26:66:20:13 3. m2:~# /etc/init.d/dhcp3-server start Starting DHCP server: dhcpd3. 2.2 Configuration des clients DHCP Corrigé de l’exercice 12 (configuration temporaire du client DHCP de m1) [Consulter l’énoncé] 1. m1:~# dhclient eth0 Internet Systems Consortium DHCP Client V3.1.1 Copyright 2004-2008 Internet Systems Consortium. All rights reserved. For info, please visit http://www.isc.org/sw/dhcp/ Listening on LPF/eth0/02:04:06:22:ab:24 Sending on LPF/eth0/02:04:06:22:ab:24 Sending on Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3 DHCPOFFER from 10.0.2.10 DHCPREQUEST on eth0 to 255.255.255.255 port 67 DHCPACK from 10.0.2.10 bound to 10.0.2.120 -- renewal in 273 seconds. 2. m1:~# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 02:04:06:22:ab:24 inet addr:10.0.2.120 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::4:6ff:fe22:ab24/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:263 errors:0 dropped:0 overruns:0 frame:0 TX packets:275 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:9742 (9.5 KiB) TX bytes:12971 (12.6 KiB) Interrupt:5 IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 18. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 18/22 m1:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0 m1:~# cat /etc/resolv.conf domain iut.univ-aix.fr search iut.univ-aix.fr nameserver 139.124.1.2 m1:~# Á Tout ce qu’on a fait jusqu’à présent sur m1 devrait continuer de fonctionner. Corrigé de l’exercice 13 (configuration du client DHCP de la VM Windows) [Consulter l’énoncé] 1. il faut configurer l’interface via DHCP : C:netsh int ip set address Connexion au réseau local dhcp Ok. 2. C:ipconfig Configuration IP de Windows Carte Ethernet Connexion au réseau local: Suffixe DNS propre à la connexion : iut.univ-aix.fr Adresse IP. . . . . . . . . . . . : 10.0.2.20 Masque de sous-réseau . . . . . . : 255.255.255.0 Passerelle par défaut . . . . . . : 10.0.2.2 On peut aussi utiliser ipconfig/all pour avoir plus de détails sur la configuration. C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 19. 19/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux C:route print =========================================================================== Liste d'Interfaces 0x1 ........................... MS TCP Loopback interface 0x2 ...08 00 27 71 76 54 ...... Carte AMD PCNET Family Ethernet PCI - Mini... =========================================================================== =========================================================================== Itinéraires actifs : Destination réseau Masque réseau Adr. passerelle Adr. interface Métrique 0.0.0.0 0.0.0.0 10.0.2.2 10.0.2.20 20 10.0.2.0 255.255.255.0 10.0.2.20 10.0.2.20 20 10.0.2.20 255.255.255.255 127.0.0.1 127.0.0.1 20 10.0.2.255 255.255.255.255 10.0.2.20 10.0.2.20 20 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 224.0.0.0 240.0.0.0 10.0.2.20 10.0.2.20 20 255.255.255.255 255.255.255.255 10.0.2.20 10.0.2.20 1 Passerelle par défaut : 10.0.2.2 =========================================================================== Itinéraires persistants : Aucun Corrigé de l’exercice 14 (configuration permanente du client DHCP de m1) [Consulter l’énoncé] 1. Au même titre que la VM XP précédemment, il faut ajouter une entrée host pour m1 : host m1 { hardware ethernet 02:04:06:22:ab:24; fixed-address 10.0.2.15; } 2. Après redémarrage : m1:~# ifconfig eth0 Link encap:Ethernet HWaddr 02:04:06:22:ab:24 inet6 addr: fe80::4:6ff:fe22:ab24/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1 errors:0 dropped:0 overruns:0 frame:0 ... Á la configuration n’a pas été obtenue 3. ... pas de corrigé pour cette question... 4. ... pas de corrigé pour cette question... 5. Après redémarrage : m1:~# ifconfig eth0 Link encap:Ethernet HWaddr 02:04:06:22:ab:24 inet addr:10.0.2.120 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::4:6ff:fe22:ab24/64 Scope:Link ... IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 20. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 20/22 m1:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0 3 Le courrier électronique 3.1 Clients de messagerie Il ne devrait pas y avoir besoin de corrigé... 3.2 Format d’un message électronique 3.3 SMTP 3.3.1 Messages du protocole SMTP 3.3.2 Exercice Corrigé de l’exercice 16 (Envoi du message anonyme) [Consulter l’énoncé] $ telnet allegro 25 Trying 139.124.181.131... Connected to allegro.aix.univ-amu.fr. Escape character is '^]'. 220 allegro.iut.univ-aix.fr ESMTP Postfix (Debian/GNU) HELO mamachine.com 250 allegro.iut.univ-aix.fr MAIL FROM:tarzan@jungle.org 250 2.1.0 Ok RCPT TO:cpb 250 2.1.5 Ok DATA 354 End data with CRLF.CRLF From: Tarzan of the Jungle tarzan@jungle.org To: Cyril Pain-Barre cpb@allegro Subject: Un message super interessant blablabla le message anonyme et patati et patata . 250 2.0.0 Ok: queued as CDCCBF975 QUIT 221 2.0.0 Bye Connection closed by foreign host. $ C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix
  • 21. 21/22 Corrig´e du TP 3 UE31 - M3102 : Services R´eseaux Si on consulte ce message par mail, voici ça donne : $ mail mailx version nail 11.25 7/29/05. Type ? for help. /var/spool/mail/cpb: 1 message 1 new N 1 Tarzan of the Jung Tue May 13 10:51 16/619 Un message super interessant ? 1 Message 1: From tarzan@jungle.org Tue May 13 10:51:50 2008 Return-Path: tarzan@jungle.org X-Original-To: cpb Delivered-To: cpb@allegro.iut.univ-aix.fr From: Tarzan of the Jungle tarzan@jungle.org To: Cyril Pain-Barre cpb@allegro.iut.univ-aix.fr Subject: Un message super interessant Date: Tue, 13 May 2008 10:48:53 +0200 (CEST) Status: R blablabla le message anonyme et patati et patata ? x Si on le récupère par Thunderbird et qu’on double-clique dessus, voici ce que l’on obtient : IUT Aix-Marseille - INFO Aix 29/12/2014 - C. Pain-Barre
  • 22. UE31 - M3102 : Services R´eseaux Corrig´e du TP 3 22/22 3.4 Étude de la RFC de POP3 Corrigé de l’exercice 17 (récupération de messages avec POP3) [Consulter l’énoncé] Voici la trace de la discussion avec le serveur POP3 d’allegro, en supposant qu’il y a 4 messages dans la boîte aux lettres et que le message anonyme est le dernier : $ telnet allegro 110 Trying 139.124.181.131... Connected to allegro.aix.univ-amu.fr. Escape character is '^]'. +OK USER cpb +OK PASS mon-mot-de-passe +OK LIST +OK 1 470 2 390 3 281 4 455 . RETR 4 +OK Return-Path: tarzan@jungle.org X-Original-To: cpb Delivered-To: cpb@allegro.iut.univ-aix.fr Received: from mamachine.com (a73.iut.univ-aix.fr [139.124.187.73]) by allegro.iut.univ-aix.fr (Postfix) with SMTP id CDCCBF975 for cpb; Mon, 29 Dec 2014 16:45:54 +0100 (CET) From: Tarzan of the Jungle tarzan@jungle.org To: Cyril Pain-Barre cpb@allegro Subject: Un message super interessant blablabla le message anonyme et patati et patata . DELE 4 +OK QUIT +OK Connection closed by foreign host. C. Pain-Barre - 29/12/2014 IUT Aix-Marseille - INFO Aix