I am trying to establish a 3G connection with Raspbian, a 3G USB dongle, usb_modeswitch
and wvdial
. I followed this tutorial which has worked well before with a different 3G dongle.
My 3G dongle is a ZTE D6601, the SIM has no PIN and the connection works flawlessly with the ISPs tool under Windows and under Ubuntu 15 with the built-in mobile broadband tool. But I need to do this on a Raspberry Pi and from the command line.
This is what I have tried so far: When I boot Raspbian, lsusb
returns
Bus 001 Device 004: ID 19d2:0154 ZTE WCDMA Technologies MSM
I then run
sudo usb_modeswitch -I -v 19d2 -p 0154 -c /etc/usb_modeswitch.conf
Which changes the ProductID to
Bus 001 Device 009: ID 19d2:0108 ZTE WCDMA Technologies MSM
There is more than one 3G dongle with 0154 as DefaultProduct
ID so the standard switching rules of usb_modeswitch
don't work. 0108 is what Ubuntu switches the device to or what happens when I sudo eject
the virtual CD drive, so I used that.
My /etc/network/interfaces
was only changed to use a WiFi connection:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
So far, so good. When I run sudo wvdialconf
, a modem is detected at /dev/ttyUSB1
. I then run sudo wvdial dcom
with dcom
being defined like this (APN "e-connect" is correct, no user / pass required):
[Dialer dcom]
Modem = /dev/ttyUSB1
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","e-connect"
Stupid Mode = 1
Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Username = { }
Auto Reconnect = 1
Password = { }
Baud = 460800
The shell returns this:
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","e-connect"
AT+CGDCONT=1,"IP","e-connect"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 21600000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sat Apr 25 18:09:08 2015
--> Pid of pppd: 5530
--> Using interface ppp0
--> pppd: [08]FX[01]�FX[01]8GX[01]p<X[01]�PX[01]�QX[01] (+4 more times)
After running this, ifconfig
shows that ppp0
was created but no IP address is assigned. Then, about 10 seconds later this happens:
--> Disconnecting at Sat Apr 25 18:09:39 2015
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 5 seconds
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","e-connect"
AT+CGDCONT=1,"IP","e-connect"
OK
--> Modem initialized.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","e-connect"
AT+CGDCONT=1,"IP","e-connect"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
ERROR
--> Invalid dial command.
--> Disconnecting at Sat Apr 25 18:09:45 2015
If I run wvdial dcom
again, it will repeat the output of the second connection attempt above (Invalid dial command
) and not even configure ppp0
. Weirdly, after a quick sudo wvdialconf
(during which /etv/wvdial.conf
remains unchanged), I can connect again, but it will again assign no IP and break after 10 seconds. I have replicated this several times.
Maybe this is also interesting: wlan0
loses its IP the moment ppp0
is created and I can only get it back running sudo ifdown wlan0
and sudo ifup wlan0
even though it is set to automatically reconnect.