Friday, 27 December 2013

Experimenting with Ubuntu...establishing internet

Hi there! Finally a post after a long time!
I have been experimenting with ubuntu these days! The first thing we need is internet. Perpetual connectivity is one thing we strive for!

So this post intends to cover two major issues I came against while establishing internet on Ubuntu. Ubuntu works in quite different way than windows so the BSNL or ISPs might not help you much in this case!

Initially, I tried establishing mobile internet (!dea Netconnect dongle), recently I tried establishing BSNL Broadband Connection.

Lets first talk about what is still fresh:

ESTABLISHING BSNL BROADBAND CONNECTION:

If you have already experimented a lot then you might be suffering a problem where wired network is  "unmanaged".

Solution:

First, remove the existing network configurations for eth* from /etc/network/interfaces. So the resulting /etc/network/interfaces will only has the following loopback interface.

auto lo
iface lo inet loopback



PS: If you are new to Ubuntu you might be finding difficulty to edit the file due to read only rights. Only root can modify the file. So I would suggest opening the file through terminal using this command:





$sudo gedit /etc/network/interfaces









                       

Note: sudo helps you to access files as root.You are asked to enter the password before the file opens. Make the asked changes. The changes can be saved now.

Now, enable wired network settings on NetworkManager by changing "managed=false" to "managed=true" in /etc/NetworkManager/NetworkManager.conf.

NOte: Open the file in the same way as above.

[ifupdown]
managed=true
Finally, restart NetworkManager to reload its configuration.

$ sudo service network-manager restart
Once you restart NetworkManager, you will be able to edit wired network settings in System Settings -> Network -> Wired.

Next , issue you would face is configuring the modem and defining the access point. Here it goes:

  1. Connect your ethernet wire to the port at the back of your computer.
  2. Fire up the terminal and type in sudo pppoeconf
  3. It should detect your modem.
  4. Keep on pressing enter. Fill in your user name and password when indicated.
  5. It should be easy to stick on to defaults.
  6. You should be prompted back to your terminal when it would say pppoe loaded. Simple. That's the end of terminal. Now go to System>Networking. Click on it
  7. Activate the Wired connection.
  8. Highlight the wired connection and click on properties.
  9. Check the box "enable the connection"
(Source: askubuntu.com)




These would definitely sort out the issue for you. Let's come to establishing net connectivity via mobile internet:

1- get the a readymade Script

If the link doesn't works, make a file named MobileBroadband-autoconnect.sh
with this Script:

#!/bin/bash

while true; do
    LC_ALL=C nmcli -t -f TYPE,STATE dev | grep -q "^gsm:disconnected$"
    if [ $? -eq 0 ]; then
        #jdownloader is still in the download status so stop it because
        #internet is disconnected and jdownloader won't resume download
        #when connected again
        #jdownloader --stop-download
        #sometimes I can not get connected after disconnection when
        #I click on <name of the network connection>. I have to disable
        #and enable Mobile Broadband
        nmcli -t nm wwan off
        sleep 1
        nmcli -t nm wwan on
        sleep 1
        nmcli -t con up id "Tunisie Télécom / TUNTEL WEB DATA"
        #wait approximately 15 sec to get connected
        #if anyone can add better command to check for it just comment it :-p
        sleep 15
        #now connected to internet so start download
        #jdownloader --start-download
    fi
    #it does not worth keep it checking every millisecond.
    #my connection will be reestablished within 5-15 seconds
    sleep 2
    #if anyone can code it better please feel free to comment
    #TO-DO:: check for data received. if data < 15 KB after 20 seconds of connection
    #reconnect mobile broadband connection 
done


2- extract it to your home folder (or somewhere safe) and make it hidden by placing a period before it like this .network-autoconnection.sh (so that you won't accidentally delete it)

3- Give it execution permission like this: right click on it, go to "properties", then navigate to "permissions" then tick "Allow executing file as program"

4- go to t/media/infinite/New Volume/100/MobileBroadband-autoconnect.shhe Mint menu and type "startup applications"


5- click on "add" then "browse" opposite to "command" field to give the directory of the script (your home folder or wherever you've placed it) then give it a name in the "name" field, for example mine is "Tunisie Télécom / TUNTEL WEB DATA".


That's it guys!
Hope this may help you and you have your internet up and running!
Do drop by queries if you have any! :)

A secret love message ~

Hmm, so the trick of putting up a catchy seasonal title worked out, we got you here! Folks, we will be talking about a really cool tech...