Ubuntu 12.04 share the internet over WiFi from wvdial?

Posted by Sour Lemon on Ask Ubuntu See other posts from Ask Ubuntu or by Sour Lemon
Published on 2012-10-03T03:13:06Z Indexed on 2012/10/03 3:50 UTC
Read the original article Hit count: 273

Filed under:
|
|
|
|

I have just installed Ubuntu 12.04 on a separate partition on my hard drive so I can dual boot to either Windows 7 or Ubuntu.

I am living in Japan and so I'm using a mobile broadband USB device called "Softbank C02LC".

By default it seems that this device isn't recognised so I did the following:

Terminal:

sudo su
nano /usr/bin/usbModemScript

Nano:

#!/bin/bash
echo 1c9e 9900 > /sys/bus/usb-serial/drivers/option1/new_id

Terminal:

chmod +x /usr/bin/usbModemScript
nano /etc/udev/rules.d/option.rules

Nano:

ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9900", RUN+="/usr/bin/usbModemScript"
ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9900", RUN+="/sbin/modprobe option"

which made the device visible from the network manager etc.

However even though I set up my details correctly when I created a new connection (Correct username, APN etc) as soon as I try to connect it almost immediately disconnects.

Because of this I then followed the instructions at this site: http://debugitos.main.jp/index.php?Ubuntu%2F%A5%E2%A5%D0%A5%A4%A5%EB%A5%A4%A5%F3%A5%BF%A1%BC%A5%CD%A5%C3%A5%C8

And I ended up using the c02lc_connect script at the bottom of the page to connect to the internet.

The file contains the following bash script:

#!/bin/sh

usbinterfece=/dev/ttyUSB2
VID=1c9e
PID=9900
WRONG_PID=f000
LSUSB=/usr/sbin/lsusb
GREP=/bin/grep
MODPROBE=/sbin/modprobe
SWITCH=/usr/sbin/usb_modeswitch
SWITCH_D=/etc/usb_modeswitch.d
WVDIAL=/usr/bin/wvdial
SLEEP=/bin/sleep
SUDO=/usr/bin/sudo
WHICH=/usr/bin/which

switch_config="$SWITCH_D/$VID:$WRONG_PID"

if ! [ -x $WVDIAL -a -x $SWITCH ]; then
    echo "Install wvdial and usb_modeswitch."
    exit 0
fi

check_usb() {
    local vid="$1"
    local pid="$2"
    ($LSUSB | $GREP "$vid:$pid")
}

if ! (check_usb "$VID" "$PID"); then
    echo "Cannot find modem device..."
    if (check_usb "$VID" "$WRONG_PID") && ( [ -f "$switch_config" ] ); then
        echo "The device is attached but its mode is wrong."
        echo "Try usb_modeswitch..."
        $SUDO $SWITCH -c "$switch_config"
        $SLEEP 1
        if (check_usb "$VID" "$PID"); then
            echo "Successfully switched the mode."
        else
            echo "Failed to switch the mode..."
            exit 1
        fi
    else
        exit 1
    fi
fi

if [ ! -c "$usbinterface" ]; then
    $SUDO $MODPROBE usbserial vendor=0x$VID product=0x$PID
    $SLEEP 2
fi

$SUDO $WVDIAL

which works completely fine - no problems what-so-ever.

But we also have 1 more laptop here which I need to share the internet connection with. In Windows 7 I do this with the Connectify program, and in Ubuntu I have seen that you can do things like set up hotspots etc.

But because I am using WvDial I am not sure how I would share the internet.

I am only beginning to use Ubuntu but unfortunately until I can figure out how to share the internet over WiFi when connected via WvDial I have to stick with Windows.

If you have any ideas on how to do this it would be much appreciated!

© Ask Ubuntu or respective owner

Related posts about 12.04

Related posts about wireless