PirateBox - OpenWrt sur TP-Link TL-MR3020

De L'abscisse - FabLab et Hackerspace de Dijon
Révision datée du 5 octobre 2013 à 01:23 par Dlareg (discussion | contributions) (Choisir les paramètres réseaux)
Aller à : navigation, rechercher
Dialog-warning.png Article en cours de rédaction Dialog-warning.png


Présentation

Coût

TP-Link ≈ 30 €

Niveau de difficulté

Orange.png

Outillage nécessaire

  • Ordinateur
  • Connexion internet

Composants nécessaires

  • TP-Link

Schémas

Étape par étape

Préparer le routeur

  • placer le routeur en mode WISP (Wireless Information Service Point ou Wireless Internet Service Provider selon l'usage)
  • alimenter électriquement le routeur (USB)
  • connecter le routeur directement à votre ordinateur à l'aide d'un câble réseau

Se connecter au routeur et mettre à jour le firmware

Il faut être sur le même réseau, pour cela :

   ifconfig eth0 192.168.0.50

Alors on peut ouvrir un navigateur et aller sur le routeur à l'adresse suivante http://192.168.0.254
L'identifiant est : admin et le mot de passe : admin

Il faut télécharger le firmware OpenWRT concu pout le TP-Link MR3020 sur son poste de travail :

   $ wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin

Dans l'interface du TP-Link, à l'adresse http://192.168.0.254 il faut se rendre dans System Tools > Firmware Upgrade.
Un formulaire propose d'uploader le nouveau firmware via un formulaire.

Après la mise à jour, le MR3020 redémarre et l'on perd la connexion dans le navigateur, en effet l'installation change l'adresse IP du routeur.

Se reconnecter

Le câble relie toujours le routeur et votre ordinateur, il faut se mettre sur le même réseau que le routeur :

   # ifconfig eth0 192.168.1.2

Puis on accède en telnet

   # telnet 192.168.1.1

Une fois connecté la première chose à faire est de changer le mot de passe :

   # passwd

Une confirmation est demandée, il faut donc saisir deux fois de suite le même mot de passe.

Configuration du routeur

Les paramètres du réseaux vont nous permettre de se reconnecter au routeur mais non plus en telnet mais en SSH.
L'idée est que votre routeur aura accès à internet pendant que vous vous aurez accès au routeur en SSH, pour cela il faut que tout le monde soit sur le même réseau, votre réseau local.
Admettons que notre réseau local soit dans l'adressage suivant 192.168.0.x alors nous allons choisir une adresse fixe pour le routeur, non prise sur le réseau, par exemple 192.168.0.50
Il faut également connaître la passerelle de votre réseau (dans le cas le plus c'est l'adresse de votre boîtier ADSL), ici notre passerelle est 192.168.0.254
Ses paramètres vont nous servir à configurer le routeur pour y avoir accès en SSH.
On est toujours en telnet on édite le fichier /etc/config/network avec la commande vi :

   # vi /etc/config/network

On modifie les paramètres suivants :

   option ipaddr ‘192.168.0.50‘
   option netmask ’255.255.255.0′
   option gateway ‘192.168.0.254‘

On ajoute les paramètres suivants :

   list dns ‘192.168.0.254‘
   list dns ’8.8.8.8′

Puis il faut éditer les règles de parefeu :

   # vi /etc/config/firewall

Il faut passer toutes les règles REJECT en ACCEPT.

On active maintenant le wifi en éditant le fichier /etc/config/wireless

   # vi /etc/config/wireless

Et on passe la variable option disabled 1 à option disabled 0
La configuration est terminée, on peut éteindre le routeur !

Installation de l'application PirateBox

Pour l'installation il faut que le routeur soit connecté à internet.
On branche le TP-Link et l'ordinateur sur notre réseau local.
Il faut que notre ordinateur reprenne une adresse du réseau local :

   # dhclient eth0

On alimente denouveau électriquement le routeur (USB) et cette fois on se connecte en SSH :

   # ssh root@192.168.0.50

Le mot de passe demandé est celui que nous avons redéfini plus haut avec la commande passwd.
On vérifie que le routeur a bien accès à internet :

   # ping free.fr

Si le routeur n'a pas accès vérifier vos branchements et la configuration réseau du routeur (/etc/config/network).

Il faut ajouter le support USB à notre routeur :

   # opkg update
   # opkg install kmod-usb-uhci
   # insmod usbcore
   # insmod uhci
   # opkg install kmod-usb-ohci
   # insmod usb-ohci

Il se peut que certains insmod ne soient pas possible, on poursuit.
On peut maintenant connecter notre clé USB FAT 32 à notre routeur.

Dans la fenêtre SSH toujours ouverte, on installe l'application PirateBox :

   # cd /tmp
   # opkg update && opkg install http://piratebox.aod-rpg.de/piratebox_0.6.3_all.ipk

Once the install is completed, unplug the ethernet cable and disconnect the power for at least 10 seconds.

5. Restart the device and join the “PirateBox – Share Freely” network. Open any web page and you should be redirected to the PirateBox menu.

root@OpenWrt:/tmp# opkg update && opkg install http://piratebox.aod-rpg.de/pirat ebox_0.6.3_all.ipk Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz. Updated list of available packages in /var/opkg-lists/barrier_breaker. Downloading http://piratebox.aod-rpg.de/piratebox_0.6.3_all.ipk. Installing piratebox (0.6.3) to root... Installing kmod-usb-storage (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-usb-storage_3.10.13-1_ar71xx.ipk. Installing kmod-scsi-core (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-scsi-core_3.10.13-1_ar71xx.ipk. Installing kmod-fs-vfat (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-fs-vfat_3.10.13-1_ar71xx.ipk. Installing kmod-nls-cp437 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-cp437_3.10.13-1_ar71xx.ipk. Installing kmod-nls-cp850 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-cp850_3.10.13-1_ar71xx.ipk. Installing kmod-nls-iso8859-1 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-iso8859-1_3.10.13-1_ar71xx.ipk. Installing kmod-nls-iso8859-15 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-iso8859-15_3.10.13-1_ar71xx.ipk. Installing kmod-fs-ext4 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-fs-ext4_3.10.13-1_ar71xx.ipk. Installing kmod-lib-crc16 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-lib-crc16_3.10.13-1_ar71xx.ipk. Installing block-mount (2013-09-29-887256e92838ef94eeea8d7ba06ff078c7e05296) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/block-mount_2013-09-29-887256e92838ef94eeea8d7ba06ff078c7e05296_ar71xx.ipk. Installing kmod-loop (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-loop_3.10.13-1_ar71xx.ipk. Installing losetup (2.21.2-2) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/losetup_2.21.2-2_ar71xx.ipk. Configuring kmod-scsi-core. kmod: failed to insert /lib/modules/3.10.13/sd_mod.ko Configuring kmod-usb-storage. Configuring kmod-lib-crc16. Configuring block-mount. Configuring kmod-fs-vfat. Configuring kmod-fs-ext4. kmod: failed to insert /lib/modules/3.10.13/ext4.ko Configuring losetup. Configuring kmod-nls-cp437. Configuring kmod-nls-cp850. Configuring kmod-nls-iso8859-1. Configuring kmod-nls-iso8859-15. Configuring kmod-loop. Configuring piratebox. Please connect USB disk. If it is already plugged-in, wait for a few seconds, and if nothing happens, please reconnect the device. Keep in mind that your router's ports may not be able to supply enough power to spin-up a USB HDD. ...............................................................................................................................................................................................................................................Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz. Updated list of available packages in /var/opkg-lists/barrier_breaker. Downloading http://piratebox.aod-rpg.de/piratebox_0.6.3_all.ipk. Installing piratebox (0.6.3) to root... Installing kmod-usb-storage (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-usb-storage_3.10.13-1_ar71xx.ipk. Installing kmod-scsi-core (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-scsi-core_3.10.13-1_ar71xx.ipk. Installing kmod-fs-vfat (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-fs-vfat_3.10.13-1_ar71xx.ipk. Installing kmod-nls-cp437 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-cp437_3.10.13-1_ar71xx.ipk. Installing kmod-nls-cp850 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-cp850_3.10.13-1_ar71xx.ipk. Installing kmod-nls-iso8859-1 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-iso8859-1_3.10.13-1_ar71xx.ipk. Installing kmod-nls-iso8859-15 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-nls-iso8859-15_3.10.13-1_ar71xx.ipk. Installing kmod-fs-ext4 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-fs-ext4_3.10.13-1_ar71xx.ipk. Installing kmod-lib-crc16 (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-lib-crc16_3.10.13-1_ar71xx.ipk. Installing block-mount (2013-09-29-887256e92838ef94eeea8d7ba06ff078c7e05296) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/block-mount_2013-09-29-887256e92838ef94eeea8d7ba06ff078c7e05296_ar71xx.ipk. Installing kmod-loop (3.10.13-1) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/kmod-loop_3.10.13-1_ar71xx.ipk. Installing losetup (2.21.2-2) to root... Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/losetup_2.21.2-2_ar71xx.ipk. Configuring kmod-scsi-core. kmod: failed to insert /lib/modules/3.10.13/sd_mod.ko Configuring kmod-usb-storage. Configuring kmod-lib-crc16. Configuring block-mount. Configuring kmod-fs-vfat. Configuring kmod-fs-ext4. kmod: failed to insert /lib/modules/3.10.13/ext4.ko Configuring losetup. Configuring kmod-nls-cp437. Configuring kmod-nls-cp850. Configuring kmod-nls-iso8859-1. Configuring kmod-nls-iso8859-15. Configuring kmod-loop. Configuring piratebox. Please connect USB disk. If it is already plugged-in, wait for a few seconds, and if nothing happens, please reconnect the device. Keep in mind that your router's ports may not be able to supply enough power to spin-up a USB HDD. ..................................................................................................................................................................................

Liens

Tutoriel sur le blog de Nicolas Hachet
http://blog.nicolashachet.com/fonctionnement-du-web/tutoriel-installer-une-piratebox-en-images/

TP-Link TL-MR3020 sur le site d'OpenWrt
http://wiki.openwrt.org/toh/tp-link/tl-mr3020

PirateBox DIY – OpenWrt
(en)http://daviddarts.com/piratebox-diy-openwrt/?title=PirateBox_DIY_OpenWrt

http://wiki.labomedia.org/index.php/PirateBox

Auteurs

  • Dlareg