Wednesday, 22 May 2013

Installing OLSR from source !

Earlier i have posted about OLSR installation and configuration - this time around i will be putting this in black in white from building it from source and settle this once and for all,

Lets begin it,

Start putting these command as they are and at the end you will have OLSR succesfully installed without any hassles.

First we will install the pre-requisite which are as follows,

1. flex
2. bison
3. libc6
4. git-core

now open the terminal and start typing these commands,

$ sudo su
# apt-get install flex bison libc6 git-core
# git clone git://olsr.org/olsrd.git
# cd olsrd
# make
# make install
# make clean
# make uberclean
# make libs
# make install_libs

This shud get it done, including all the plugins required for multiple functions,

Now you will have to configure the olsrd.conf file before using it - which i will update the blog in a while.

Thank  You.


Wednesday, 23 January 2013

Getting the Android into Ad-Hoc Mode and creating a Mesh

Hi folks this has been one hell of a week where i had to bend my back alot for this task to make it work because it really creates some hard core issue as android doesn't by default allows adhoc mode.
But to make this happen i went across two free applications on market that does this job fairly well

1. barnacle wifi tether
2. wifi tether for root

To make the scenario i used 3 android devices and 2 PC running Ubuntu 12.04, 
now take any first device and run any of the application this will create our gateway for the adhoc mode and it will start broadcasting itself automatically, but as android doesn't allow adhoc mode connectivity there are 3 ways to make another android phone connect to the adhoc mode.

1. modify the data/misc/wifi/wpa_supplicant.conf

2. modify the system/bin/wpa_supplicant
3. install cyanogenmod 9 as a firmware which allows to connect to adhoc mode by default.

How to do the first one is listed as follows - 
In the conf file enter this,

ctrl_interface=wlan0
update_config=1
device_type=0-00000000-0
ap_scan=2
network={
ssid="your adhoc network name"
scan_ssid=1
key_mgmt=NONE
auth_alg=OPEN SHARED
mode=1
priority=1
}

save and exit, 
then do this in the terminal emulator

#chown system.wifi /data/misc/wifi/wpa_supplicant.conf

Turn on wifi you will see ur adhoc mode listed - make the IP static and it will connect 
but this doesn't work on all devices so chances are 50-50.

To do the second one is more tricky but works 100% - 
Download this file from here ,

http://forum.xda-developers.com/attachment.php?attachmentid=805983&d=1323095437

1. Unzip the file (wpa_supplicant.zip) and send wpa_supplicant to your phone.

2. Using Root Explorer go to the folder were you save it (wpa_supplicant) and copy the file.
3. Using Root Explorer, enter the /system folder and press the Mount W/R button (upper right corner)
4. Now go to /system/bin and backup your current wpa_supplicant, and paste the new one.
5. Set permissions of wpa_supplicant to 755, then go back to /system and press Mount R/O (upper right corner, so you leave everything exactly like it was) and reboot.

Now you can see the ad hoc mode connect to it - sometimes it its stuck on obtaining ip address in that case make the ip static then it will definitely connect.

The third option is a bit more complex , u need to go to cyanogenmod website find your device firmware download and flash it over the phone, but it will enable your device to connect to adhoc network out of the box - no modification of wpa binaries or wpa configuration.

To connect ubuntu is fairly easy all you need to do is see ur wireless networks available, you will see an adhoc netwrok listed - connect to it, if it get stuck on optainig ip address make it static by the network manager help.

This will create a mesh of multiple platform connected together in adhoc mode.

Compiling and executing OLSR for Android on Ubuntu 12.04

Hi all,

This is another start to yet another problem that i have faced during my thesis and this time is making OLSR run over an android Phone,
To achieve the said task i want you to follow the following steps carefully and in the end you will be running the OLSR protocol over an android phone.
The OS of android doesnt matter wether it be GB or ICS or JB.
This method is compatible for all ( Cross Checked )
The pre-requistes are listed as follows,
1. bison
2. flex
3. libc6
4. Android SDK
5. Android NDK
6. git-core

Download the SDK and NDK, untar them to /opt folder in the base directory otherwise you are gonna go thru lot of errors.

ok lets get down to business,

open terminal and start like this,

$sudo su
# apt-get install bison flex libc6 git-core
#git clone git://olsr.org/olsrd.git
#cd olsrd
#cd make
# gedit makefile.android

Edit it from these places -

NDK_BASE ?= /opt/android-ndk

Place the location of NDK here on this line - make it match your untarred location other wise u r gonna go thru lot of issues.

save it close it and go back to terminal

#make OS=android DEBUG=0 NDK_BASE=/opt/android-ndk
#sudo make OS=android DEBUG=0 install_all

Once this is done, the hunting for created files start -

Im listing down the location and files u need to place them in a separate folder of whatever name you like -

/bin/sgw_policy_routing_setup.sh
/bin/olsrd
/etc/olsrd.conf
/lib/ ( there are altogether 18 files that get created - sort them according to date modified, they shud cluster together because of the same time and same date creation and copy them to whatever desired folder you want )
/usr/share/doc/olsrd
/usr/share/man/man5
/usr/share/man/man8

now thats done put them together in some place more easily findable,

now push these files into the android phone

you will need a root explorer to do that with root privileges

put the contents of the bin folder to the /system/bin of the phone
put the contents of the etc folder to the /system/etc of the phone
like wise for the next two as well where lib contents goes to /system/libs and contents of /user/share goes to /system/usr/share

that's it - now u need to modify ur olsrd.conf file to suit the phone

open terminal emulator - its a small application available freely on the market

and start doing this,

$su
#netcfg

This will list down your interface which is responsible for wifi connectivity

i used this on three devices separately , im listing there names and the interface found and modified the olsrd.conf accordingly to adjust to your situation

1. Samsung Galaxy S2 - eth0 ( running Gingerbread 2.3.5 )
2. Samsung Galaxy Y - eth0 ( running Gingerbread 2.3.6 )
3. Ainol Tab Aurora II - wlan0 ( running IceCreamSandwich 4.0.3 )

Once the olsrd.conf is properly edited according to ur device just go back to terminal emulator and enter

#olsrd

Thats it - the olsrd will be up and running.

Sunday, 1 April 2012

Installing WICD on ubuntu 10.04 ( kernel 2.6.32-40 )

This tutorial is for those who are fed up with there UI network manager and want to try something more smarter and better!
WICD is an application i found to be extremly light and better then the usual NM - the default networking application.
to get started download the WICD source tarball frrom its legit website, the link is provided as follows!

https://launchpad.net/wicd/1.7/1.7.1/+download/wicd-1.7.1.tar.gz

This is the latest tarball till date.

Now im assuming to be in the Download folder, go there and untar it right away!
now lets get to work

Open the terminal and do this

#sudo su
#apt-get update
#cd Downloads
#cd wicd-1.7.1~b3
#python setup.py update_translations_py
#python setup.py get_translations
#python setup.py configure
#python setup.py install

Thats it - go to application and u will see WICD listed click on it let it have root priviliges and it will be working!


Configuring Tp-Link WN722N into Adhoc Mode On Ubuntu and running of OLSR

I start with this tutorial because i utterly felt that there has been lot of misconception about switching wireless adapters into ad hoc mode, On windows its very easy but on Ubuntu it  gets very tricky. When i started with this i came across lot of issue and mostly didn't find much help looking around so i figured out my own work around for this, i guess working on Ubuntu means being highly intuitive and offcourse your own ideas to play around with.
Anyways i will get to work, Now assume u must have installed Tp-Link WN722N on ubunbtu if not, im again listing  down the entire procedure which will work on ubuntu and its cross checked multiple times.
now i assume u must have inserted your USB device into the machine,still just to double check write this command in terminal,

#lsusb


as you can see there is device listed by the name of Atheros Communication,
thats your deal !

now to get this started i want you to go and download its drivers which can be found at a link listed below

http://www.orbit-lab.org/kernel/compat-wireless-2.6/2011/12/

now i assume you are working over kernel 2.6.32-40.

download the last tarball, which i will assume it is 

http://www.orbit-lab.org/kernel/compat-wireless-2.6/2011/12/compat-wireless-2011-12-31.tar.bz2

into the default Download folder.

go into that folder and untar it.

once done go back to the terminal and start hitting these commands

#sudo su
#cd Downloads
#cd compat-wireless-2011-12-31
#./scripts/driver-select ath9k_htc
#make 
#make install
#make unload

all this is done, i want to download the firmware file, i mean the latest one which has the link as below,

 http://linuxwireless.org/download/htc_fw/1.3/

get the file htc_9271.fw

now again assuming it to be in the download folder

in the terminal do this,

#sudo su
#cd Downloads
#cp htc_9271.fw /lib/firmware
#exit

now head towards the earlier terminal window im assuming u have not closed it,even if so thats arite ! 

now just load your new shiny driver by doing this

#sudo modprobe ath9k_htc

cross check if its properly loaded

#lsmod | grep ath9k

check its functioning by doing

#dmesg | grep ath9k

see if its listed into the hardware and is it working by doing this 

#ifconfig -a ( Or you can do this by - )
#iwconfig

it will list down it as wlan0

even if its not working then dont worry just hit a reboot

come back! log in back into your terminal hit the commands in terminal as sated earlier - your device would be working,

if not u have done something wrong. ( note : during compiling of drivers some warnings are ok - dont worry about it )

now gettin it into the adhoc mode is the most tricky part of the story!

if you try to put it in adhoc mode by the terminal even with root privileges, it wont let you. It will start throwing up errors as like device busy or unavailable and stuff like that. Dont worry here comes the inituitve part of the entire work !

After doing lot of research i figured out that it wont let u get into it because of  UI network manager locking it all up.

this can get nasty cause uptil now your network manager was handling your connectivity now its about time to go down to the basic!

now go to the terminal and enter this command ( be careful coz now you are about to lose your internet connectivity even if u r hard wired by eth0 )

#sudo apt-get remove --purge network-man*
#sudo reboot

once you come back to the screen, start hitting this in terminal

#sudo su
#gedit /etc/network/interfaces

it will open up a text file which you will have to edit like this

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto wlan0
allow-hot plug wlan0
iface wlan0 inet static
address 10.10.10.11
netmask 255.255.255.0
wireless-mode ad-hoc
wireless-channel 1
wireless-essid Dark1

keep it like this im assuming it your wireless card to be wlan0 and your Ethernet card to be eth0

now do this,

#sudo su
#/etc/init.d/networking restart

bingo! your are back on the Internet and you have your device on the adhoc mode aswell
( point to note - to achieve connectivity between two pc wireless in ad hoc mode assign the different ip on the other computer but keep the same subnet mask plus give it the same essid don't change the name and keep the channel same as well )

if u feel your device not working give yourself a reboot, when you come back in you wud have internet connectivity via your hard wire and your device wud be on adhoc mode which can be crossed checked by doing this in terminal

#iwconfig

it wills show your device being in adhoc mode. to run olsr refer to my manual earlier i have written in the same blog and you wud achieve the said task !
Hope this help someone out there doing this work !
running thru issues?
comment below and await replies :D
tc adios !

need a UI to check around your connectivity?
install wicd on ubuntu from ubuntu software manager....let it access your card
voila! a UI beside NM - better aswell ! or you can do it manually by visiting there website and downloading its source code tarball, i will write about its manual installing in the next blog !

Friday, 23 March 2012

Installing TPLINK TL-WN722N on ubuntu 10.04 ( kernel 2.6.32-40 )

This tutorial is for those who are trying to make a wirelss usb adapter of the above said origin work over ubuntu. When i started this i thought it will be easy work but as it turned out to be making the ubuntu recognize the adapter was one hell of a task. ( dont forget to plugin in your device right at the beginning and donot disconnect )
Plus to check that if its working
Open terminal and put this command

#lsusb

This will list down that your device is recognized or not,
If recognized it will show something like this


As you can see its listed at Bus 001 Device 002: Atheros Communication
Once this is confirmed lets move further.

I will straight get to work.
Once booted and inside the gnome i want you to follow these steps to get to work.
Open your browser up and paste in the following link

http://www.orbit-lab.org/kernel/compat-wireless-2.6/2011/05/

Now i downloaded the latest one which was > compat-wireless-2011-05-31.tar.bz2
I have no idea for the other version they might be compatible aswell, if someone else do this dont forget to comment below.

The testing link is provided below and try to work with this aswell

http://linuxwireless.org/en/users/Download/stable#compat-wireless_2.6.39_stable_releases

Now i assume u downloaded it to  /home/user/Downloads

Now open terminal up and start putting in these commands

#sudo su
#cd Downloads
#tar xvf compat-wireless-2011-05-31.tar.bz2
#cd compat-wireless-2011-05-31
#./scripts/driver-select ath9k_htc
#make
#make install

Once this is all done download these four files

Very Important : google these files up and save them to your download folder.

ar7010.fw
ar9271.fw
htc_7010.fw ( Version 1.3 )
htc_9271.fw ( Version 1.3 )

Or get the 4 files from here :

http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=tree

And once done go back to terminal and do this

#sudo su
#cd Downlaods
#cp ar7010.fw /lib/firmware
#cp ar9271.fw /lib/firmware
#cp htc_7010.fw /lib/firmware
#cp htc_9271.fw /lib/firmware

When all this is done

Run this command in the terminal

ifconfig -a

Note down the mac address of your wireless usb adapter

Now do this

#gedit /etc/udev/rules.d/70-persistent-net.rules

And add these lines underneath which are already there in the file that opens up

# USB device 0x0cf3:0x9271 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="54:e6:fc:94:91:35", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Remember to keep them in 2 lines, i have shortened them so to keep the format in the blog,
Dont forget to alter the mac address according to your own which i pointed you to note down earlier, i.e. paste down your own.

Now back to the terminal and run this,

#sudo modprobe ath9k_htc
#sudo reboot

When you will log back do the #ifconfig and you will see your wlan0 listed and working.

Troubleshooting Tips : if it doesnt show up in the interfaces run this in the terminal

#dmesg | grep ath9k

It will list down any problem faced by the adapter to load.

This completes the tutorial to make TL-WN722N work with ubuntu 10.04

I hope i have explained the steps well and it will be useful for anybody out there reading this.

Comments and Feedback will be appreciated.

Saturday, 10 March 2012

Installing And Configuring OSPF protocol on Ubuntu 10.04

This tutorial is for those who are interested in installing and configuring OSPF protocol on Ubuntu 10.04
I will try to make this tutorial as easy as possible.
To move on I will put them down as steps that should be followed one by one in successful accomplishment of the above said task.
To begin with I will assume you have installed Ubuntu 10.04 which is completely updated.
Now goto your Ubuntu software center and search for ospf , you will see something like this


As you can see I have installed the ospf routing deamon.
Now open Terminal , and start putting in these commands, which are as follows:

#sudo su
#nano /etc/quagga/daemons

Edit it like this,

zebra=yes
bgpd=no
ospfd=yes
ospf6d=no
ripd=no
ripngd=no 

Save it and close it, and keep going!

#cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
#cp /usr/share/doc/quagga/examples/ospfd.conf.sample /etc/quagga/ospfd.conf
#cp /usr/share/doc/quagga/examples/vtysh.conf.sample /etc/quagga/vtysh.conf
#nano /etc/quagga/debian.conf

Edit it like this,

# If this option is set the /etc/init.d/quagga script automatically loads 
# the config via "vtysh -b" when the servers are started. 
# Check /etc/pam.d/quagga if you intend to use "vtysh"! 
# 
vtysh_enable=yes 
zebra_options=" --daemon -A " 
bgpd_options=" --daemon -A " 
ospfd_options=" --daemon -A " 
ospf6d_options="--daemon -A " 
ripd_options=" --daemon -A " 
ripngd_options="--daemon -A " 
isisd_options=" --daemon -A " 

Save it - Exit, and keep moving forward,

#nano /etc/quagga/vtysh.conf

Edit it like this,

!
! Sample
!
! service integrated-vtysh-config
hostname quagga-router
username root nopassword
!

Save it,Exit - Keep moving !

#nano /etc/quagga/ospfd.conf

Edit it like this,

! Zebra configuration saved from vty
!   2012/03/10 05:06:34
!
hostname ospf
password zebra
enable password zebra
!
!
!
interface eth0
!
interface eth1
!
interface lo
!
router ospf
network 192.168.10.101/24 area 0.0.0.0 /* This was IP Address on eth1 - You should put your own*/
!
line vty
!

Save,Exit - Move on bro !

#echo VTYSH_PAGER=more > /etc/environment
#echo "1" > /proc/sys/net/ipv4/ip_forward
#echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf

Log out and log back in !
Open the terminal and get to work !

#sudo su
#chown quagga.quaggavty /etc/quagga/*.conf
#chmod 640 /etc/quagga/*.conf
#/etc/init.d/quagga restart
#vtysh - c "write" ( save all your configuration )
#vtysh - c "show ip forwarding" ( this should indicate as being on if its correctly done )
#vtysh - c "show ip route" ( this should tell you that your ospf is working via ethX )
#vtysh - c "show ip opsf neighbor" ( shows the neighbor if any )
#vtysh - c "show ip ospf database" ( shows the entire activity )

Thats ends my tutorial of how to configure and install and run the OSPF protocol on ubuntu 10.04 LTS. I hope i have explained all the step as in detail and as easy as possible. If you are running through problems comment below and i will try to answer back your queries as early as possible, i hope it helps anybody out there !!!