Outils pour utilisateurs

Outils du site


configuration_d_une_cle_4g_lte

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
configuration_d_une_cle_4g_lte [2016/09/21 19:43] simonconfiguration_d_une_cle_4g_lte [Date inconnue] (Version actuelle) – supprimée - modification externe (Date inconnue) 127.0.0.1
Ligne 1: Ligne 1:
-====== Installation et configuration d'une clé 4G LTE ====== 
  
-===== Modèle testé ===== 
-D-Link, Model:DWM-221. La datasheet et le manuel d'utilisateur sont accessibles sur [[http://www.dlink.com/fr/fr/support/product/dwm-221-4g-lte-usb-adapter|dlink.com]]. 
- 
-===== Installation ===== 
-<code bash> 
-pi@raspberrypi(rw):~$ lsusb 
-Bus 001 Device 010: ID 2001:a401 D-Link Corp. 
-</code> 
- 
-<code bash> 
-pi@raspberrypi(rw):~$ sudo lsusb -v -s 001:010 
- 
-Bus 001 Device 010: ID 2001:a401 D-Link Corp.  
-Device Descriptor: 
-  bLength                18 
-  bDescriptorType         1 
-  bcdUSB               2.00 
-  bDeviceClass            0 (Defined at Interface level) 
-  bDeviceSubClass          
-  bDeviceProtocol          
-  bMaxPacketSize0        64 
-  idVendor           0x2001 D-Link Corp. 
-  idProduct          0xa401  
-  bcdDevice            2.32 
-  iManufacturer           1 Mobile Connect 
-  iProduct                2 Mobile Connect 
-  iSerial                 3 0123456789ABCDEF 
-  bNumConfigurations      1 
-  Configuration Descriptor: 
-    bLength                 9 
-    bDescriptorType         2 
-    wTotalLength           32 
-    bNumInterfaces          1 
-    bConfigurationValue     1 
-    iConfiguration          0  
-    bmAttributes         0x80 
-      (Bus Powered) 
-    MaxPower              500mA 
-    Interface Descriptor: 
-      bLength                 9 
-      bDescriptorType         4 
-      bInterfaceNumber        0 
-      bAlternateSetting       0 
-      bNumEndpoints           2 
-      bInterfaceClass         8 Mass Storage 
-      bInterfaceSubClass      6 SCSI 
-      bInterfaceProtocol     80 Bulk-Only 
-      iInterface              4 Mass Storage 
-      Endpoint Descriptor: 
-        bLength                 7 
-        bDescriptorType         5 
-        bEndpointAddress     0x81  EP 1 IN 
-        bmAttributes            2 
-          Transfer Type            Bulk 
-          Synch Type               None 
-          Usage Type               Data 
-        wMaxPacketSize     0x0200  1x 512 bytes 
-        bInterval               0 
-      Endpoint Descriptor: 
-        bLength                 7 
-        bDescriptorType         5 
-        bEndpointAddress     0x01  EP 1 OUT 
-        bmAttributes            2 
-          Transfer Type            Bulk 
-          Synch Type               None 
-          Usage Type               Data 
-        wMaxPacketSize     0x0200  1x 512 bytes 
-        bInterval               1 
-Device Qualifier (for other device speed): 
-  bLength                10 
-  bDescriptorType         6 
-  bcdUSB               2.00 
-  bDeviceClass            0 (Defined at Interface level) 
-  bDeviceSubClass          
-  bDeviceProtocol          
-  bMaxPacketSize0        64 
-  bNumConfigurations      1 
-Device Status:     0x0000 
-  (Bus Powered) 
-</code> 
- 
-On ajoute ces quatre lignes dans le fichier : 
- 
-<WRAP center round important 60%> 
-Je ne sais pas s'il faut utiliser le fichier ''usb_modeswitch.conf'' finalement... 
-[Edit: Il faut ! Pour ne pas avoir à utiliser la longue commande [[usb_modswitch]] ci-dessous et que le modem 3G soit prêt au démarrage! Il faut juste le configurer correctement! /Edit] 
-[Edit2: La configuration finale de ce fichier est plus bas./Edit2] 
-</WRAP> 
-<code bash> 
-$ sudo nano /etc/usb_modeswitch.conf 
-$ sudo cat /etc/usb_modeswitch.conf 
-(...) 
-DefaultVendor=0x2001 
-DefaultProduct=0xa401 
-MessageEndpoint="0x01" 
-MessageContent="55534243123456780000000000000011062000000101000100000000000000" 
-</code> 
- 
-On utilise la commande [[usb_modeswitch]] avec ces arguments (trouvé sur [[http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=3&t=2173&start=60|ce forum (draisberghof.de)]]). Je n'ai pas très bien compris où on peut trouver les trois "messages" qu'on envoie (''55534...''), je me suis contenté de copier/coller. 
-<code bash> 
-pi@raspberrypi(rw):~$ sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000 
-Take all parameters from the command line 
- 
- 
- * usb_modeswitch: handle USB devices with multiple modes 
- * Version 2.2.0 (C) Josua Dietze 2014 
- * Based on libusb1/libusbx 
- 
- ! PLEASE REPORT NEW CONFIGURATIONS ! 
- 
-DefaultVendor=  0x2001 
-DefaultProduct= 0xa401 
-MessageContent="555342435b000000000000000001061e000000000000000000000000000000" 
-MessageContent2="555342435c000000000000000001061b000000010000000000000000000000" 
-MessageContent3="555342435d000000000000000001061b000000020000000000000000000000" 
-NeedResponse=1 
- 
-Look for default devices ... 
-  found USB ID 2001:a401 
-   vendor ID matched 
-   product ID matched 
-  found USB ID 0a5c:bd1e 
-  found USB ID 0483:2016 
-  found USB ID 04b3:3021 
-  found USB ID 04b3:3022 
-  found USB ID 0424:ec00 
-  found USB ID 0424:9514 
-  found USB ID 1d6b:0002 
- Found devices in default mode (1) 
-Access device 012 on bus 001 
-Current configuration number is 1 
-Use interface number 0 
-Use endpoints 0x01 (out) and 0x81 (in) 
- 
-USB description data (for identification) 
-------------------------- 
-Manufacturer: Mobile Connect 
-     Product: Mobile Connect 
-  Serial No.: 0123456789ABCDEF 
-------------------------- 
-Looking for active driver ... 
- No active driver found. Detached before or never attached 
-Set up interface 0 
-Use endpoint 0x01 for message sending ... 
-Trying to send message 1 to endpoint 0x01 ... 
- OK, message successfully sent 
-Read the response to message 1 (CSW) ... 
- Response successfully read (13 bytes). 
-Trying to send message 2 to endpoint 0x01 ... 
- OK, message successfully sent 
-Read the response to message 2 (CSW) ... 
- Response successfully read (13 bytes). 
-Trying to send message 3 to endpoint 0x01 ... 
- OK, message successfully sent 
-Read the response to message 3 (CSW) ... 
- Response successfully read (13 bytes). 
-Reset response endpoint 0x81 
-Reset message endpoint 0x01 
--> Run lsusb to note any changes. Bye! 
- 
-pi@raspberrypi(rw):~$ lsusb  
-Bus 001 Device 013: ID 2001:7e19 D-Link Corp.  
-Bus 001 Device 005: ID 0a5c:bd1e Broadcom Corp.  
-Bus 001 Device 011: ID 0483:2016 STMicroelectronics Fingerprint Reader 
-Bus 001 Device 010: ID 04b3:3021 IBM Corp.  
-Bus 001 Device 009: ID 04b3:3022 IBM Corp.  
-Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter 
-Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.  
-Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 
-</code> 
- 
-<code bash> 
-pi@raspberrypi(rw):~$ dmesg | grep ttyUSB 
-[  806.074853] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB0 
-[  806.075897] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1 
-[  806.076943] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2 
-[  806.077874] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB3 
-</code> 
- 
-J'ai un problème quand j'essaye de me connecter parce que je n'ai pas pu mettre le code pin. J'ai donc suivi [[http://john.de-graaff.net/wiki/doku.php/links/umts_debian|ce tutoriel (john.de-graaff.net)]] pour mettre le code pin, me connecter et finalement supprimer l'authentification par code pin (pour ne plus avoir besoin de le faire manuellement!). 
-<code bash> 
-$ sudo apt-get install minicom 
-</code> 
- 
-J'ai configuré minicom pour les quatre ttyUSB*, j'ai trouvé le baurdate via [[https://code.aliyun.com/yaoruisheng/k2-router/tree/514dad408f1dd5bc6f491d41f445828a4e8876ed/uboot/mips|un développeur chinois]]... 
-<code bash> 
-pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB0 
-pu port /dev/ttyUSB0 
-pu baudrate 115200 
-pu bits 8 
-pu parity N 
-pu stopbits 1 
-pu minit ATZ 
-pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB1 
-pu port /dev/ttyUSB1 
-pu baudrate 115200 
-pu bits 8 
-pu parity N 
-pu stopbits 1 
-pu minit ATZ 
-pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB2 
-pu port /dev/ttyUSB2 
-pu baudrate 115200 
-pu bits 8 
-pu parity N 
-pu stopbits 1 
-pu minit ATZ 
-pi@raspberrypi(rw):~$ cat /etc/minicom/minirc.ttyUSB3 
-pu port /dev/ttyUSB3 
-pu baudrate 115200 
-pu bits 8 
-pu parity N 
-pu stopbits 1 
-pu minit ATZ 
-</code> 
- 
-Connexion!! 
-<code bash> 
-pi@raspberrypi(rw):~$ sudo minicom ttyUSB2 
-</code> 
- 
-Une fois dans minicom, connecté au modem, on peut essayer plein de choses. Voici des exemples et le retour des commandes avec une [[carte SIM de chez Proximus]] et une [[carte SIM de chez Base]]. 
- 
-L'essentiel étant de ne plus avoir besoin du code pin pour activer la connexion aux données. Pour ce faire, voici la commande à taper : 
-<code bash> 
-AT+CLCK="SC",0,"1234"                                                            
-OK 
-</code> 
- 
-On peut configurer dans le fichier ''/etc/network/interfaces'' 
-<code bash> 
-pi@raspberrypi(rw):~$ cat /etc/network/interfaces 
-# interfaces(5) file used by ifup(8) and ifdown(8) 
- 
-# Please note that this file is written to be used with dhcpcd 
-# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' 
- 
-# Include files from /etc/network/interfaces.d: 
-source-directory /etc/network/interfaces.d 
- 
-auto lo 
-iface lo inet loopback 
- 
-iface eth0 inet manual 
- 
-#Désactiver l'interface wlan0 (interne à sur un Raspberry Pi 3 
-#allow-hotplug wlan0 
-#iface wlan0 inet manual 
-#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 
- 
-allow-hotplug wlan1 
-iface wlan1 inet manual 
-    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 
- 
-#D-Link (3G,4G,LTE) 
-auto ppp0 
-iface ppp0 inet wvdial 
-</code> 
- 
-<WRAP center round alert 60%> 
-Je pense que le fichier ''gprs'' n'est plus utile, puisqu'on utilise ''wvdial''. À confirmer. 
-</WRAP> 
- 
-Et dans le fichier ''/etc/ppp/peers/gprs'' : 
-<code bash> 
-pi@raspberrypi(rw):~$ sudo cat /etc/ppp/peers/gprs 
-user "pi" 
-connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T em" 
-/dev/ttyUSB0 
-noipdefault 
-defaultroute 
-replacedefaultroute 
-hide-password 
-noauth 
-persist 
-usepeerdns 
-</code> 
- 
-Avec wvdial : 
-<code bash> 
-pi@raspberrypi(rw):~$ cat /etc/wvdial.conf  
- 
-[Dialer Defaults] 
-Init1 = ATZ 
-Init2 = ATQ0 V1 E1 S0=0 +FCLASS=0 
-Modem Type = Analog Modem 
-Baud = 460800 
-Stupid Mode = 1 
-New PPPD = yes 
-Modem = /dev/ttyUSB1 
-ISDN = 0 
-Phone = *99# 
-Password = ''; 
-Username = ''; 
-</code> 
-<WRAP center round alert 60%> 
-Avec la carte SIM de chez Base, j'ai du mettre "Modem = /dev/ttyUSB2" pour que ça fonctionne. 
-</WRAP> 
- 
-Enfin, on peut activer l'interface ppp0 : 
-<code bash> 
-pi@raspberrypi(rw):~$ sudo ifup ppp0  
-</code> 
- 
-Et voir que tout roule dans [[ifconfig]] : 
-<code bash> 
-pi@raspberrypi(rw):~$ ifconfig  
-eth0      Link encap:Ethernet  HWaddr b8:27:eb:63:e1:64   
-          adr inet6: fe80::3fa0:327c:1470:f457/64 Scope:Lien 
-          UP BROADCAST MULTICAST  MTU:1500  Metric:1 
-          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
-          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
-          collisions:0 lg file transmission:1000  
-          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) 
- 
-lo        Link encap:Boucle locale   
-          inet adr:127.0.0.1  Masque:255.0.0.0 
-          adr inet6: ::1/128 Scope:Hôte 
-          UP LOOPBACK RUNNING  MTU:65536  Metric:1 
-          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
-          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
-          collisions:0 lg file transmission: 
-          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) 
- 
-ppp0      Link encap:Protocole Point-à-Point   
-          inet adr:100.115.xxx.xxx  P-t-P:10.64.64.64  Masque:255.255.255.255 
-          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1 
-          RX packets:13618 errors:0 dropped:0 overruns:0 frame:0 
-          TX packets:10473 errors:0 dropped:0 overruns:0 carrier:0 
-          collisions:0 lg file transmission: 
-          RX bytes:16438678 (15.6 MiB)  TX bytes:647948 (632.7 KiB) 
- 
-wlan1     Link encap:Ethernet  HWaddr fc:b4:e6:af:d0:f9   
-          inet adr:192.168.x.xxx  Bcast:192.168.5.255  Masque:255.255.255.0 
-          adr inet6: fe80::f45f:ec3a:7fd5:be5f/64 Scope:Lien 
-          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 
-          RX packets:17147 errors:0 dropped:10532 overruns:0 frame:0 
-          TX packets:3864 errors:0 dropped:0 overruns:0 carrier:0 
-          collisions:0 lg file transmission:1000  
-          RX bytes:2928538 (2.7 MiB)  TX bytes:509019 (497.0 KiB) 
- 
-wwan0     Link encap:Ethernet  HWaddr 0e:b1:82:d0:4e:a1   
-          inet adr:169.254.xxx.xxx  Bcast:169.254.255.255  Masque:255.255.0.0 
-          adr inet6: fe80::b785:3bc:9b3d:b245/64 Scope:Lien 
-          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 
-          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
-          TX packets:153 errors:0 dropped:0 overruns:0 carrier:0 
-          collisions:0 lg file transmission:1000  
-          RX bytes:0 (0.0 B)  TX bytes:51271 (50.0 KiB) 
-</code> 
- 
- 
-J'ai fait différents tests et j'avais différents soucis avec les DNS. J'ai installé [[resolvconf]] et le problème a été résolu. (Avant, le fichier resolv.conf était écrasé par ''openresolv''. 
-<code bash>$ cat /etc/resolv.conf  
-# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) 
-#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN 
-nameserver 80.201.237.239 
-nameserver 80.201.237.238 
-</code> 
- 
-Il restait encore un problème. Au démarrage, il fallait lancer [[usb_modeswitch]] avec une commande longue :  
-<code bash> 
-$ sudo usb_modeswitch -v 2001 -p a401 -W -n -M 555342435b000000000000000001061e000000000000000000000000000000 -2 555342435c000000000000000001061b000000010000000000000000000000 -3 555342435d000000000000000001061b000000020000000000000000000000 
-</code> 
- 
-On peut simplifier cette commande en configuration le fichier '2001:a401' : 
-<code bash> 
-$ sudo nano /etc/usb_modeswitch.d/2001:a401 
-$ sudo cat /etc/usb_modeswitch.d/2001:a401  
-#D-Link DWM-221 
-TargetVendor=0x2001 
-TargetProduct=0x7e19 
-MessageContent="555342435b000000000000000001061e000000000000000000000000000000" 
-MessageContent2="555342435c000000000000000001061b000000010000000000000000000000" 
-MessageContent3="555342435d000000000000000001061b000000020000000000000000000000" 
-</code> 
- 
-On peut maintenant utiliser la commande suivante : 
-<code bash> 
-$ sudo usb_modeswitch -v 2001 -p a401 -c /etc/usb_modeswitch.d/2001:a401 
-</code> 
- 
-C'est mieux, mais il faudrait que le réseau démarre correctement au démarrage. Il faudrait aussi qu'il (re)démarre automatiquement si on branche la clé 3G. Hop, un petit service [[systemd]] : 
-<code bash> 
-$ sudo nano /lib/systemd/system/3g.service 
-$ sudo cat /lib/systemd/system/3g.service  
-[Unit] 
-Description=Connexion 3G 
-After=network.target 
- 
-[Service] 
-ExecStartPre=/usr/sbin/usb_modeswitch -v 2001 -p a401 -c /etc/usb_modeswitch.d/2001:a401 
-ExecStart=/usr/bin/wvdial & 
-ExecStartPost=/sbin/resolvconf -u 
-Restart=always 
-RestartSec=5 
- 
-[Install] 
-WantedBy=multi-user.target 
-</code> 
- 
-On relance le daemon qui gère les services, on active le service et on regarde ce que ça donne! 
-<code bash> 
-$ sudo systemctl daemon-reload  
-$ sudo systemctl enable 3g.service 
-$ sudo systemctl status 3g.service 
-● 3g.service - Connexion 3G 
-   Loaded: loaded (/lib/systemd/system/3g.service; enabled) 
-   Active: active (running) since mer 2016-09-07 15:27:43 CEST; 29min ago 
- Main PID: 2672 (wvdial) 
-   CGroup: /system.slice/3g.service 
-           ├─2672 /usr/bin/wvdial & 
-           └─2692 /usr/sbin/pppd 460800 modem crtscts defaultroute usehostname -detach user ''; noipdefault cal... 
- 
-sep 07 15:27:44 raspberrypi wvdial[2672]: [19B blob data] 
-sep 07 15:27:44 raspberrypi wvdial[2672]: [19B blob data] 
-sep 07 15:27:44 raspberrypi wvdial[2672]: --> local  IP address 100.xxx.xxx.xxx 
-sep 07 15:27:44 raspberrypi wvdial[2672]: [19B blob data] 
-sep 07 15:27:44 raspberrypi wvdial[2672]: --> remote IP address 10.xxx.xxx.xxx 
-sep 07 15:27:44 raspberrypi wvdial[2672]: [19B blob data] 
-sep 07 15:27:44 raspberrypi wvdial[2672]: --> primary   DNS address 80.201.237.239 
-sep 07 15:27:44 raspberrypi wvdial[2672]: [19B blob data] 
-sep 07 15:27:44 raspberrypi wvdial[2672]: --> secondary DNS address 80.201.237.238 
-sep 07 15:27:44 raspberrypi wvdial[2672]: [19B blob data] 
-</code> 
- 
-===== Sources ===== 
-  * [[http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=3&t=2173&start=60|forum (draisberghof.de)]] 
-  * [[http://john.de-graaff.net/wiki/doku.php/links/umts_debian|se connecter avec minicom sur la clé 3G (john.de-graaff.net)]] 
-  * [[http://www.dlink.com/fr/fr/support/product/dwm-221-4g-lte-usb-adapter|DWM-221 4G-LTE usb adapter (dlink.com)]] 
-  * [[https://enavarro.me/raspberry-pi-connection-3g-et-envoi-de-sms-en-meme-temps.html|connection 3G et envoi de sms (enavarro.me)]] 
-  * [[https://www.emnify.com/2015/06/18/how-to-fit-a-raspberry-pi-with-mobile-connectivity/|how to fit a raspberry with mobile connectivité (emmify.com)]] 
-  * [[http://raspberry-at-home.com/installing-3g-modem/|installing 3G modem (raspberry-at-home.com)]] 
-  * [[https://shkspr.mobi/blog/2012/07/3g-internet-on-raspberry-pi-success/|3G internet on Raspberry Pi success (shkspr.mobi)]] 
-  * [[http://www.sbprojects.com/projects/raspberrypi/mobile.php|Raspberry Pi - mobile (sbprojects.com)]] 
configuration_d_une_cle_4g_lte.1474487020.txt.gz · Dernière modification : 2020/08/09 12:59 (modification externe)