Archive | Ubuntu 12.04 RSS feed for this section

How to get the usb modem K3772-Z working with Network Manager Applet & Wvdial

10 Sep

The K3772-Z usb modem

The good news is that with ubuntu 12.04 the K3772-Z modem is detected straight after a new install and can be used brilliantly with network manager applet.

I have been working with openSUSE 12.01 which uses an older version of usb-modeswitch which doesn’t switch this modem automatically.

If your K3772-Z is not detected as a modem by the Linux operating System you first need to compile and install the latest usb-modeswitch.


Install the packages necessary on your Linux system to enable you to compile from source code.

In openSUSE 12.01

I opened YaST

I clicked on Software Management Icon

I installed the following packages:

binutils, gcc, gcc46, make

This should be fine, if you find that you cannot compile try installing kernel-devel

Then obtain the latest source code for USB modeswitch at the following location:

At the time of writing you can download : 1. usb-modeswitch-1.2.4.tar.bz2 – extract this to a sub-directory in your “home” directory (I created a /home/simon/src/ directory – “simon” being my personal username)

2. Download usb-modeswitch-data package – extract this to the same directory.

Then this is what i did in a teminal:

cd /home/simon/src/usb-modeswitch-1.2.4 (or “cd” to the directory you extracted the first package) then:

sudo make install

If you have no compiling errors move on

cd /home/simon/src/usb-modeswitch-data-20120815 (or “cd” to the directory that you extracted the 2nd package) then:

sudo make install

Other compiling instructions and specific help is available on the website.

If you have had no compiling errors, plug in your K3772-Z modem and wait . . . It should at first be mounted as a cd drive and flash red. The usb-modeswitch program will switch it to being a modem and the system should detect it automatically. Network manager applet will ask you for a sim pin. Enter this and create a new mobile connection via the network manager applet. (ie Enable Mobile Broadband should be ticked click on New Mobile Broadband connection – follow instructions)

You should now be able to connect to the internet with your K3772-Z usb modem.

Note: Once your modem is detected by the system you can also get your modem to work with Wvdial.

Why bother you may say???

In openSUSE when you configure your Network with YaST you seem to have to disable network manager applet. You therefore need an alternative way to use control your usb modem.

STEP2 : Configuring WVdial.

Plug in your modem and let it be switched – type in the sim pin. (via nm-applet)

In the terminal enter the following command:

sudo wvdialconf /etc/wvdial.conf

This will go through a process of detecting your modem and creating a simple config file at /etc/wvdial.conf

then you need to edit this config file with your specific provider and modem details. Enter at the terminal command line:

sudo nano /etc/wvdial.conf

This is a copy of mine –  Add the relevant lines:


[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,”IP”,”internet”
Modem = /dev/ttyACM0
Modem Type = USB Modem
Stupid Mode = yes
Baud = 460800
Auto DNS = 1
ISDN = 0
Password = ”
Username = ”
Phone = *99#

[Dialer 1gig]
Init4 = AT+CPIN=”1234″

[Dialer 2gig]
Init4 = AT+CPIN=”5678″


A bit of explanation may be needed:

The line Init3 = AT+CGDCONT=1,”IP”,”internet” shows my service provider to have an APN of “internet” this may be different from service provider to service provider. 2. My service provider requires no username or password so I need to use 2 single quotation marks ” as the username & password. You may have a specific password and username to insert in these quotation marks to get connected depending on your service provider. 3. The config file is split into 3 sections. a)”[Dailer defaults]” b) “[Dialer 1gig]” c) “[Dialer 2gig]” This is because I have 2 modems which I call “1gig” and “2gig” each with different sim pins. If you have only one usb modem you need just one entry with your sim pin number.

CTRL x exits the nano program – make sure you save the config file.

Then to use wvdial on my system I have the options of entering the following commands at the terminal:

option 1: “sudo wvdial 1gig” – when I have plugged in the 1gig modem and I haven’t yet entered in the sim pin through Network Manager applet.

option 2:”sudo wvdial 2gig” – when I have plugged in the 2gig modem and I haven’t yet entered in the sim pin through Network Manager applet.

option 3: “sudo wvdial” – when I have plugged in either modems. And have already entered in the sim pin via the Network Manager applet. Only the Dialer default settings will be used by the Dailer.

You should get the following feedback if all is successful – but you might not be finished yet – Read Troubleshooting below to view the /etc/resolv.conf


simon@netbook:~$ sudo wvdial 1gig
root’s password:
–> WvDial: Internet dialer version 1.60
–> Cannot get information for serial port.
–> Initializing modem.
–> Sending: ATZ
–> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
–> Sending: AT+CGDCONT=1,”IP”,”internet”
–> Sending: AT+CPIN=”1234″
–> Modem initialized.
–> Sending: ATDT*99#
–> Waiting for carrier.
CONNECT 7200000
–> Carrier detected.  Starting PPP immediately.
–> Starting pppd at Mon Sep 10 10:23:47 2012
–> Pid of pppd: 2683
–> Using interface ppp0
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> local  IP address
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> remote IP address
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> primary   DNS address
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> secondary DNS address
–> pppd: ��[06][08]��[06][08]H�[06][08]
–> Script /etc/ppp/ip-up run successful
–> Default route Ok.
–> Nameserver (DNS) Ok.
–> Connected… Press Ctrl-C to disconnect
–> pppd: ��[06][08]��[06][08]H�[06][08]



Notice the above snippet shows that my Vodacom SA service provider has the following DNS server addresses. Yours may be different.

primary   DNS address

secondary DNS address

And the following replies were given:

-> Default route Ok.
–> Nameserver (DNS) Ok

For this to happen these addresses need to be in your /etc/resolv.conf file. The entries need to be made as follows:



In Ubuntu I could just insert the following entries manually

In openSUSE I used Yast sysconfig editor and edited the following entry:


and in the empty box I put the following entries with a space in between

and pressed the finished button.

Once the nameservers are in the resolv.conf then connect with wvdial. You are no longer dependent on network manager applet.

Ubuntu 12.04 – setting up my Wifi Hotspot

1 May

Please Note: As the Title suggests – I am a newbie, Please do not expect in-depth computer support. I can only say that the setup below really does work on my netbook. Perhaps it will work on yours too!


The first thing I wanted to do after installing Ubuntu 12.04 is setup a wifi hotspot. I have a Samsung Netbook N130. I use a usb-modem to connect to the internet. I have a single data contract with Vodacom and I want all my devices to use this data at the same time.

Gathering information:

Opening a terminal and typing the following command :


Showed me that I have a :

 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express)


Shows that it uses the ath9k drivers (this information may help you to google for setup information specific to your machine.)



will give you the name of your wireless adapter name for example:

“wlan0 “or “wlan1” (note that the “0” and “1” are numbers not letters)

Installing Programs

I then installed 2 programs via apt. In a terminal enter the following command:

#sudo apt-get install dhcp3-server

#sudo apt-get install hostapd

Editing Configuration Files

In a terminal:

#sudo gedit

This will bring up the editor with root privileges so that you can edit system files. (WARNING – editing system files can damage your system. Please do not edit system files unless you have made a backup of them first)

Open / Create the following files editing:

1. /etc/hostapd/hostapd.conf

wpa_pairwise=TKIP CCMP

Please note: the “ssid” in this case “my_hotspot” is the name of the network that will show up on the device or laptop that will connect to the hotspot. The passphrase is a password – you can change this to any other 10 digit number. The device / laptop that wants to connect will have to enter this password.

Save the file.

2. /etc/default/isc-dhcp-server

Edit the line that says




Or change the “wlan0” to “wlan1” or whatever the wireless adapter name you have (see above section on gathering information.)

3. /etc/dhcp/dhcpd.conf

Make sure the follow lines are Commented out ( put a hash “#”  sign at the beginning of the line ) the following lines:

# option definitions common to all supported networks…
#option domain-name “”;
#option domain-name-servers,;

#default-lease-time 600;
#max-lease-time 7200;

Add the following lines to the file (copy and paste)

subnet netmask {
        option domain-name-servers,;
        option routers;

(Note: the only other line in this whole config file that is uncommented is :

ddns-update-style none;)

4. /etc/default/hostapd

Add the following lines to the bottom of the file. Make sure similar lines are commented.


(Note: This file makes sure hostapd program starts on bootup with your edited configuration files loaded)

5. /etc/network/interfaces

This is how my interfaces file looks:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static

(Note: Again you must change every “wlan0” to the name of your adapter. This file may have more entries for other network adapters. Just make sure you edit the section of the wireless adapter you want to use. This file will automatically configure the wireless network adapter’s network address at bootup time.)

At this stage you can reboot. And hopefully any device / laptop should connect to your wifi hotspots network via the network manager applet. On these devices search for the network “my_hotspot” and type in the password.

At this stage however you cannot access the Internet. Which brings us to another important step:

Internet connection Sharing.

You will need to ask yourself the following information. How do I connect to the internet on my ubuntu computer / laptop? In my case I use a usb 3G modem. You need to know the name of the network adapter that you connect to the internet on. > This must be different from the network adapter you configured above. (ie wlan0)

Connect to the internet, and in a terminal type:


On my netbook, one of the entries is for adapter “ppp0” this is the network adapter for my usb modem and the connection to the internet. The following steps use “ppp0” however you can swap it for your adapter name:

To share the internet connection we have to do a thing called “ip masquerading”.

First we have to allow ip forwarding:

#sudo gedit

edit /etc/sysctl.conf

Make sure the following line is uncommented and reads


Save and close gedit. (reboot)

After reboot: Connect to the Internet and In a terminal type:

# sudo iptables -t nat -A POSTROUTING -s -o ppp0 -j MASQUERADE

(Note the “ppp0” adapter name in the above line. The is the ip address of your network that you configured in steps 3 and 5 above. Your wifi hotspot will thus share the internet with up to 15 machines that are given the ip addresses to

All devices and laptops should now be able to browse the internet and download email. If this works we have to make this permanent:

#sudo gedit

edit /etc/rc.local

add this line just before exit 0″

iptables -t nat -A POSTROUTING -s -o ppp0 -j MASQUERADE

Reboot / Connect to the internet and Enjoy your wifi hotspot.


When configuring and setting up mine I used and adapted the following  Howto’s and forums: