Sunday, 1 April 2012

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 !

1 comment:

  1. Good Job!

    BTW how does one give themselves a reboot ;) ?

    ReplyDelete