Use mobile internet 3g USB dongle as WAN

A collection of tips on howto tweak your Bubba.

Use mobile internet 3g USB dongle as WAN

Postby psykopatpastorn » 27 Jul 2009, 21:35

Disclaimer: no guarantees given. If you brick your unit, tough luck. Anyhow, it works neatly for me. I hope I remember all the steps here.

Being a cheapskate, I have cancelled my ADSL internet and use the mobile internet 3g dongle at home. I get 3-4Mbit/s which is sufficient for my needs. This is how I share the 3g internet connection over my home LAN (and Wifi if you like). The dongle is a Huawei E169 HSDPA USB stick, but it probably works with other dongles too.

If you care about security, start and finish by testing your external firewall (perhaps with some online test like http://www.auditmypc.com ).

#### Preparation phase:
1. stick the dongle into bubba2, let it settle for some seconds
2. apt-get install wvdial
3. copy the file contents at the bottom of this message into /etc/wvdial.conf, replacing any existing content
4. Unless you are using Tre Sweden, edit /etc/wvdial.conf (the INIT3-line and perhaps the PHONE-line is probably enough)
5. add this to /etc/network/interfaces :
Code: Select all
auto ppp0
iface ppp0 inet wvdial


6. unplug your WAN network cable if you have one (as you will temporarily disable the firewall)
7.
Code: Select all
/etc/init.d/bubba-firewall stop
cd /etc/network
cp firewall.conf firewall.conf.orig
sed -i 's/eth0/ppp0/g' firewall.conf

8. keep the WAN network cable unplugged, you're switching to 3g wan anyway, and it's not safe as long as you use the modified firewall.conf.


#### Test phase:
1. type wvdial. It should give you some output and initiate a working internet connection. If not, use the output to debug.
2. If it works, send it to background (C-z, then bg) and start the firewall: /etc/init.d/bubba-firewall start
3. you should now be up and running, and your LAN computers should have internet access
4. restart your bubba2 if you like to get rid of the terminal emulator used in this test, just to be sure the wvdial won't go down with it.

#### Production phase:
It should all just work now. The ppp0 network interface is set to auto start in /etc/networking/interfaces and the firewall will start as usual, only now using your modified firewall rules. NB: if you switch back to cable WAN, be sure to restore your firewall.conf from the copy you made and restart the firewall.


Well, there it is.


------ /etc/wvdial.conf --------------
Code: Select all
[Dialer Defaults]
Area Code =
Ask Password = 0
Auto DNS = 1
Baud = 460800
Carrier Check = 0
Compuserve = 0
Dial Command = ATD
DialMessage1 =
DialMessage2 =
Force Address =
ISDN = 0
Idle Seconds = 3000
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","bredband.tre.se"
Modem = /dev/ttyUSB0
Modem Type = Analog Modem
New PPPD = yes
Password = ;
Phone = *99#
Stupid Mode = 1
Username = ;
------ end of /etc/wvdial.conf ------
Last edited by psykopatpastorn on 29 Jul 2009, 09:27, edited 1 time in total.
psykopatpastorn
 
Posts: 9
Joined: 05 Jul 2009, 07:05

Re: Use mobile internet 3g USB dongle as WAN

Postby carl » 28 Jul 2009, 00:01

There are some places which have "eth0" statically defined; Depending on your needs, you might want to update following files:
  • /etc/dhcp3/dhclient-exit-hooks.d/bubba-easyfind
  • /etc/dhcp3/dhclient-exit-hooks.d/firewall_rewrite
  • /usr/lib/web-admin/easyfind.pl
  • /usr/lib/web-admin/firewall.pl

We have also though of the possibility of using an dongle as WAN, so perhaps we will include such feature as this in the future.
/Carl Fürstenberg, Excito Software Developer
http://www.excito.com
support@excito.com
carl
Site Admin
 
Posts: 474
Joined: 07 May 2008, 10:41

Re: Use mobile internet 3g USB dongle as WAN

Postby psykopatpastorn » 28 Jul 2009, 00:16

carl wrote:There are some places which have "eth0" statically defined


Thanks for reminding me!


carl wrote:We have also though of the possibility of using an dongle as WAN, so perhaps we will include such feature as this in the future.


Sounds nice. It would definitely be convenient to have a single WAN interface settings somewhere that controls the whole system.
psykopatpastorn
 
Posts: 9
Joined: 05 Jul 2009, 07:05

Re: Use mobile internet 3g USB dongle as WAN

Postby Harry » 28 Jul 2009, 11:56

psykopatpastorn wrote:Disclaimer: no guarantees given. If you brick your unit, tough luck. Anyhow, it works neatly for me. I hope I remember all the steps here.

Being a cheapskate, I have cancelled my ADSL internet and use the mobile internet 3g dongle at home. I get 3-4Mbit/s which is sufficient for my needs. This is how I share the 3g internet connection over my home LAN (and Wifi if you like). The dongle is a Huawei E169 HSDPA USB stick, but it probably works with other dongles too.

If you care about security, start and finish by testing your external firewall (perhaps with some online test like http://www.auditmypc.com ).


Now this sounds really great, especially since I'm really considering buying a 3g router just for this purpose.

Do You have any experiences/theories of hot swapping the 3g dongle? which would come in handy if I would like to use the 3g dongle out in the field on a regularly frequent basis.

I wonder if I could use my Iphone as a 3g "dongle" for the above? It works great as a 3g "dongle" on an Windows xp PC.

Cheers
Harry
Harry
 
Posts: 32
Joined: 12 Feb 2009, 16:43

Re: Use mobile internet 3g USB dongle as WAN

Postby psykopatpastorn » 28 Jul 2009, 13:10

Harry wrote:especially since I'm really considering buying a 3g router just for this purpose.


I did too, before I realised I should buy a Bubba2 instead. A bit more expensive, but of course you get so much more than a 3g router for the money. Also, I don't trust the 3g router firewall. With iptables, I can see what's going on.

Harry wrote:Do You have any experiences/theories of hot swapping the 3g dongle? which would come in handy if I would like to use the 3g dongle out in the field on a regularly frequent basis.


You mean you want to jerk it out of your bubba2 while it's up and running, and then stick it back in and hope everything will work? I doubt that will work, mostly because wvdial will get an interrupted session, and you don't have anything that will reinitiate it upon re-insertion of the dongle. The risk of hardware or OS damage is minimal (or non-existant even?) though. What I would recommend, is to shut down the bubba, then disattach the dongle. When you get back home, you re-insert the dongle, then boot up the bubba.

Harry wrote:I wonder if I could use my Iphone as a 3g "dongle" for the above? It works great as a 3g "dongle" on an Windows xp PC.


I don't know. Do you connect it to the PC with a usb cable, or is it bluetooth? My intuition says it won't work out of the box, prepare for some configuration.
psykopatpastorn
 
Posts: 9
Joined: 05 Jul 2009, 07:05

Re: Use mobile internet 3g USB dongle as WAN

Postby psykopatpastorn » 07 Aug 2009, 07:45

I ran into this trouble every 1440 minutes:
Code: Select all
Aug  6 11:05:18 bubba pppd[4297]: LCP terminated by peer
Aug  6 11:05:18 bubba pppd[4297]: Connect time 1440.0 minutes.
Aug  6 11:05:18 bubba pppd[4297]: Sent 18690882 bytes, received 226028192 bytes.
Aug  6 11:05:18 bubba pppd[4297]: Modem hangup
Aug  6 11:05:18 bubba pppd[4297]: Connection terminated.


I don't know whether it's actually peer who terminates the connection, or it's because of some session timeout setting in wvdial/ppp/?, but if you add this line to wvdial.conf, it will reconnect automatically:
Code: Select all
Auto Reconnect = On


There is still one disconnection problem left, which happens more rarely, and which does not seem recoverable by wvdial. Judging from the syslog, it seems like the USB-dongle itself drops out. Then it is rediscovered, and the fake CD-rom-partition (used by the stick for auto-running stuff in Windows) is mounted again, and the modem is reattached to ttyUSB0. By then, though, wvdial seems to have given up on the modem.
psykopatpastorn
 
Posts: 9
Joined: 05 Jul 2009, 07:05

Re: Use mobile internet 3g USB dongle as WAN

Postby Lars akerman » 08 Apr 2011, 19:04

Hi,

I tried the guide using my Bubba 2 Wifi and a Huawei e1750 with no success.

I get the following error message:
Cannot open /dev/ttyUSB0: No such file or directory

Anyone know what might be wrong?

I then found the following guide:
http://www.geeksonhigh.com/tag/usb-modeswitch

But it was not able to find and install the "usb-modeswitch" on my bubba 2. Anyone know if this can be done?

I found the "usb-modeswitch" package for Debian Squeeze but not for Debian Etch. Will a Debian Squeeze firmware upgrade soon be available for Bubba 2?
http://packages.debian.org/search?keywo ... modeswitch

Thanks
Lars
Lars akerman
 
Posts: 7
Joined: 08 Apr 2011, 15:18

Re: Use mobile internet 3g USB dongle as WAN

Postby vrep » 27 Sep 2011, 20:18

I found Sakis3g to be very easy to use:
  • Download sakis3g script from http://www.sakis3g.org. I used the version without the usb_modeswitch, because I had it already installed and because it says on the website that the version with usb_modeswitch doesn't support powerpc.
  • Installation is very simple. Just type: chmod +x sakis3g
  • Get usb_modeswitch via http://www.draisberghof.de/usb_modeswitch/ and install it according to the guide.
  • The only thing you then have to do is copy the proper configuration file for usb_modeswitch from /usr/share/usb_modeswitch/ to /etc/usb_modeswitch.d/. You'll find the proper configuration file by either knowing the usb code (which equals the file name) or just search the file contents for the device you're looking for. Mine was 12d1:1520 for the Huawei K3765.

Next step is to make this automatic as soon as I plug in the modem.
vrep
 
Posts: 13
Joined: 31 Jul 2009, 09:23

Re: Use mobile internet 3g USB dongle as WAN

Postby vrep » 29 Mar 2012, 23:55

An update with regards to starting the script automatically.

On USB dongle insert:
In the directory /etc/udev/rules.d create a file called 10-sakis3g.rules and fill it with the contect below. To get your usb specific id's, use lsusb.
Code: Select all
bubba:/etc/udev/rules.d# more 10-sakis3g.rules
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1520", ATTRS{bInterfaceNumber}=="00", RUN+="/usr/bin/sakis3g --debug toggle 2> /var/log/sakis3g.log"


On start/stop of the system:
Code: Select all
updaterc.d sakis3g defaults
vrep
 
Posts: 13
Joined: 31 Jul 2009, 09:23


Return to Howtos

Who is online

Users browsing this forum: No registered users and 1 guest