Mobile internet using you mobile phone in Linux

When I am on the road sometimes its very handy to have internet around.

luckily this is very easy to accomplish in Linux. In this case I will be using a Samsung F700 Mobile phone connected to my Asus EEE 701 laptop running Ubuntu linux.

A few things however to think of before you start:
- Do you have a ‘unlimited’ or limited (100MiB/1GiB etc..) contract (‘unlimited’ is recommended)
- Does your provider allow dial up using your phone & laptop (By Vodafone it is not allowed but if you use it for ‘normal’ web browsing they don’t mind (if you start using it to download your latest TV episode’s or whatever you will be shutdown.)

So lets start:

First connect the phone to the laptop using the USB cable in my case the phone will ask me in what ‘mode’ the phone should operate, I need to select ‘pc studio’ to use the phone as a gateway to the internet.

Now when the phone is connected to the PC open a terminal and run wvdialconf to create a new config file:

trouble@sun:$ sudo wvdialconf /etc/wvdial.conf

Editing `/etc/wvdial.conf’.

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 — failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 — and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 — OK
ttyACM0<*1>: ATQ0 V1 E1 Z — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — ERROR
ttyACM0<*1>: Modem Identifier: ATI — Manufacturer: SAMSUNG ELECTRONICS CORPORATION
ttyACM0<*1>: Speed 4800: AT — OK
ttyACM0<*1>: Speed 9600: AT — OK
ttyACM0<*1>: Speed 19200: AT — OK
ttyACM0<*1>: Speed 38400: AT — OK
ttyACM0<*1>: Speed 57600: AT — OK
ttyACM0<*1>: Speed 115200: AT — OK
ttyACM0<*1>: Speed 230400: AT — OK
ttyACM0<*1>: Speed 460800: AT — OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 — OK

Found an USB modem on /dev/ttyACM0.
Modem configuration written to /etc/wvdial.conf.
ttyACM0: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2″

As you can see it found my Samsung F700 phone and updated the wvdial.conf file.

Now we need to edit the wvdial.conf file to add a few paramaters (user/pass & dial number)
the default config file looks like this:

trouble@sun:$ $ cat /etc/wvdial.conf

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyACM0
ISDN = 0
; Phone =
; Password =
; Username =

Now you will need to know the ‘Target Phone Number’ for vodafone in the Netherlands this is ‘*99#’ but this might be different in your case so just ‘google’ around if you have a other provider for the target phone number.

The username and password can be just random but I like to keep it simple and changed both to ‘vodafone’

Also you need to enable ‘stupid mode’ in wvdial to work around some of the ‘intelligence’ in wvdial to get it to work.

So vi the wvdial.conf file and it should look like this:

trouble@sun:$ $ sudo vi /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyACM0
ISDN = 0
Phone = *99#
Password = vodafone
Username = vodafone
Stupid Mode = 1

Now you are ready to go, so start ‘wvdial’ and you should be connected (I created a desktop terminal launcher with the command: ‘sudo wvdial’ for this).

trouble@sun:$ $ sudo wvdial
–> WvDial: Internet dialer version 1.60
–> Cannot get information for serial port.
–> Initializing modem.
–> Sending: ATZ
ATZ
OK
–> Sending: ATQ0 V1 E1 S0=0 &C1 &D2
ATQ0 V1 E1 S0=0 &C1 &D2
OK
–> Modem initialized.
–> Sending: ATDT*99#
–> Waiting for carrier.
ATDT*99#
CONNECT
–> Carrier detected. Starting PPP immediately.
–> Starting pppd at Sun Aug 24 18:14:11 2008
–> Pid of pppd: 23198
–> Using interface ppp0
–> pppd: ��[06][08]��[06][08]
–> pppd: ��[06][08]��[06][08]
–> pppd: ��[06][08]��[06][08]
–> pppd: ��[06][08]��[06][08]
–> pppd: ��[06][08]��[06][08]
–> pppd: ��[06][08]��[06][08]
–> pppd: ��[06][08]��[06][08]
–> local IP address YOURIP
–> pppd: ��[06][08]��[06][08]
–> remote IP address GATEWAYIP
–> pppd: ��[06][08]��[06][08]
–> primary DNS address DNSIP
–> pppd: ��[06][08]��[06][08]
–> secondary DNS address DNSIP
–> pppd: ��[06][08]��[06][08]

Bond network interfaces in linux

Short intro:

Bonding (or ‘teaming’) network interfaces is a way to bind 2 interfaces as one. This way you can configure a more redundant network connection. A normal bonded setup should of course be connected to a redundant switch (lan port1 to switch 1, lan port 2 to switch 2). It is also possible to do load balancing, but in this case traffic is low but availability should be high so i’m going for redundancy.

This setup is for a IBM Xserver running ubuntu 6.06.1 LTS server, this is a server with two Broadcom NetXtreme BCM5703X Gigabit Ethernet network interfaces which uses the ‘t3′ module.

Before proceeding check what interfaces you have and what module you are using for your network interfaces.

To get started with ‘bonding’ first you will need to look at your situation and check in what ‘mode’ you want to configure the interface, while I normally use ‘mode: 2′ this could maybe not work in your configuration so Google for a few pages that explain the differences (this is a referance base remember..)

The Configuration:

First edit /etc/modprobe.d/aliases and at the end of the file add (be sure to change the module, mode and miimon if necessary) :

1
2
3
4
alias bond0 bonding
alias eth0 t3
alias eth1 t3
options bonding mode=2 miimon=100

Then edit /etc/modprobe.d/arch/i386 (and again be sure to change the module and miimon setting if necessary):

1
2
alias bond0 bonding
options bonding mode=2 miimon=100 downdelay=200 updelay=200

First we need to check what mac interface we are going to use so use ‘ifconfig’ to get the mac for the primary adapter in your server (this is the one I normally use).

trouble@sun:$ /sbin/ifconfig eth0
eth0 Link encap:Ethernet HWaddr YOUR MAC
…..snap….

Now edit /etc/network/interfaces, disable all the settings for the current interface (except lo of course) and add the following:

1
2
3
4
5
6
7
8
9
auto bond0
iface bond0 inet static
   address 192.168.0.100
   netmask 255.255.255.0
   network 192.168.0.0
   broadcast 192.168.0.255
   gateway 192.168.0.1
   hwaddress ether YOUR MAC
   post-up ifenslave bond0 eth0 eth1

Now reboot and you should be ready to go.

Testing the config:

Test it out by starting a ping to a other host in your network and unplug one cable at a time (no unplugging both interfaces won’t work..)

Also you can check the status with:

trouble@sun:$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.0.0 (November 8, 2005)

Bonding Mode: load balancing (xor)
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: MAC

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: MAC

Changing the usplash theme

Already got tired of the default ubuntu usplash theme?
(* for the one’s that don’t know what the ‘usplash’ is: its that nice graphical boot screen used in ubuntu linux)

Here’s the way to change it to a brand new one (first the ‘geeky’ hardway then the easy way)

The hardway

First of course find a nice usplash theme (for some links to site’s with usplash theme’s see below) download it to your desktop and extract the downloaded file to get the .so file and move the new file to /usr/lib/usplash/.
(* note that in ubuntu you can do: sudo apt-get install usplash* to install some already default usplash themes to /usr/lib/usplash)

trouble@sun:$ cd (Your dlded theme dir)
trouble@sun:$ sudo mv yournewusplashtheme.so /usr/lib/usplash/

Then we need to link the new usplash theme to be the default:

trouble@sun:$ sudo ln -sf /usr/lib/usplash/yournewusplashtheme.so /etc/alternatives/usplash-artwork.so

And finaly reconfigure the kernel:

trouble@sun:$ sudo dpkg-reconfigure linux-image-`uname -r`

To get a preview of your just installed usplash (get out with ‘ctrl’ ‘alt’ ‘F7′):

trouble@sun:$ sudo usplash

The easy way

First install the ‘startupmanager’ available from apt-get.

trouble@sun:$ apt-get install startupmanager

Then download your new usplash theme and extract the .so file from the archive and follow the next steps:

  • startup the startup manager by going to ‘system’ -> ‘Administration’ -> StartUp-Manager or open a console and type ‘sudo startupmanager’
  • go to the ‘appearance’ tab and select ‘manage usplash themes’
  • select ‘add’
  • browse to your new usplash theme.so file
  • double click the .so file or select it and choose ‘open’
  • now select your new theme and choose ‘close’
  • press ‘close’ for the 2nd time and the new usplash will be installed

Some sites with usplash themes:

Page 1 of 2 12