Monthly Archives: January 2010

Wireless Ad-Hoc Network – Linux

Long time back, I actually did peer-to-peer with RJ232 connector using mine and my friend’s laptops. Its really simple and straight forward. Choose a local subnet( probably 192.168.2.0/24), assign 192.168.2.1 to one machine and assign 192.168.2.2 to another machine. Thats all, connection established and I used ‘nc’ to transfer files.

This time, its the same old thing, but without RJ232 wire. Also I just configured my system as a gateway so that my friend can access Internet through my laptop.

Before starting, I conformed that my wireless is working,

$ su -c'iwconfig'
lo        no wireless extensions.

eth1      no wireless extensions.

eth3      IEEE 802.11bg  ESSID:""  
          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated   
          Bit Rate:54 Mb/s   Tx-Power:off   
          Retry min limit:7   RTS thr:off   Fragment thr:off
          Power Managementmode:All packets received
          Link Quality=5/5  Signal level=0 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

pan0      no wireless extensions.

eth0      no wireless extensions.

First I announced a Wireless Ad-Hoc with a good name(ESSID “Dark”), here, there is something called WEP, but I’m still not able to set WEP passphrase through iwconfig. If someone had success through ‘iwconfig’ please help me to learn. The below ad-hoc network will not use WEP or any authentication.

$ su -c'iwconfig eth3 essid "Dark" mode ad-hoc channel 1'

waited for 2 – 10 seconds, and then tried to connect to that “Dark” network.

$ su -c'iwconfig eth3 essid "Dark" mode ad-hoc channel 1'

I tried the above command more than one time till I’m associated with a Cell. If you get a mac address in ‘Cell’, it means you are now connected to the ‘Dark’ Network.

$ su -c'iwconfig eth3'
eth3      IEEE 802.11bg  ESSID:"Dark"
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: F6:A5:B9:E6:37:E3
          Bit Rate=54 Mb/s   Tx-Power:32 dBm
          Retry min limit:7   RTS thr:off   Fragment thr:off
          Power Managementmode:All packets received
          Link Quality=5/5  Signal level=-57 dBm  Noise level=-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Now, my link-layer is configured, next is to configure the ip layer,

$ su -c'ifconfig eth3 192.168.2.1 netmask 255.255.255.0'
$ su -c'ifconfig eth3; route'
eth3      Link encap:Ethernet  HWaddr 00:1a:73:9f:d3:47  
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:73ff:fe9f:d347/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:2
          TX packets:0 errors:6 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:19 

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth3
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1000   0        0 eth0
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

Now I configured IP layer, the next part is to configure my debian to route packets,

$ su -c'sysctl -w net.ipv4.ip_forward=1'
$ su -c'iptables --verbose --table filter --policy FORWARD ACCEPT'
$ su -c'iptables --verbose --table nat --append POSTROUTING --jump MASQUERADE'

Note, that the above steps are just for current running kernel, if I want my changes to be permanent, I need to edit /etc/sysctl.conf and I need to save my current iptables using ‘iptables-save/iptables-restore’.

Thats all from the gateway machine(that is, my laptop), now I need to add my friend’s laptop to this ‘Dark’ Network.

$ sudo iwconfig wlan0 essid "Dark" mode ad-hoc channel 1
$ sudo ifconfig wlan0 192.168.2.2 netmask 255.255.255.0
$ sudo route add default gw 192.168.2.1
$ sudo echo "nameserver 192.168.1.1" >> /etc/resulv.conf

Thats all from my friend’s machine, now he just opened firefox and happily browsed from the balcony. No more wires.

Whenever my friends come to my room, they have some bit of tough time accessing internet, becuase most of the time, my laptop will be connected with internet through ADSL. Obviously they have shyness to ask me for stop my surfing. But now, I can happily share my internet connection with my friends. I don’t need to buy a wireless router. My laptop itself with the ADSL router doing what a wireless router can do.

Thanks linux.

Support for nVidia GeForce graphics card – Debian – Testing

As you can see in my previous article, this is about getting my nVidia card to work with Debian.

By default Xorg provides ‘nv’ driver. Its unfortunate that nVidia not even working with Xguys for basic compatibility for ‘nv’ driver. As a result, the default ‘nv’ driver is not usable in my machine.

I’m not left alone here. Debian have a package called ‘nvidia-glx’ which will install full support for nvidia cards with proprietary ‘nvidia’ driver.

$ su -c'aptitude install nvidia-glx'

But currently, this is not working in Debian Testing. I got a bug, last x11 update breaks things with nvidia-glx.

Now also I’m not left alone, using ‘module-assistant’ I can still get the nvidia driver.

$ su -c'aptitude install module-assistant'
$ su -c'module-assistant prepare'
$ su -c'module-assistant'

After the above steps I will get ncurses interface for module-assistant, choose ‘nvidia kernel’ in the wizard and compile the nvidia-kernel package. If everything goes right, I will get ‘nvidia’ driver in ‘lib/modules/$(uname -r)/kernel/drivers/video/nvidia.ko’. Also my ‘/etc/x11/xorg.conf’ file will be modified to use ‘nvidia’ driver. Thats all, I can now start X session.

Unfortunately, this method is also not working currently, while compiling I’m getting this error.

So there is no other way for me then to go for nvidia’s own builder. You can download the driver+installer from this location.. Now we need to make our system capable for compilation.

$ su -c'aptitude install module-assistant'
$ su -c'module-assistant prepare'

Then, the next step is just run the nvidia’s installer

$ su -c'chmod 755 NVIDIA-Linux-x86_64-190.53-pkg2.run'
$ su -c'./NVIDIA-Linux-x86_64-190.53-pkg2.run'
$ su -c'aptitude install nvidia-kernel-common'
$ su -c'depmod -aeF /boot/System.map-$(uname -r)'
$ su -c'update-initramfs -u'

The above step will automatically compile and install the ‘nvidia.ko’ driver in ‘/lib/modules/$(uname -r)/kernel/drivers/video/nvidia.ko’. Also my ‘/etc/x11/xorg.conf’ file will be modified to use ‘nvidia’ driver. Thats all, I can now start X session.

Support for Broadcom Wireless Devices – Debian – Testing

Got some time to post this one, I thought I should log my experience, installing wireless support for my broadcom PCI card in debian, so that next time, I will not miss the methods.

Debian provides three way to get support for BCM43XX devices. One is the reverse engineered ‘b43xx’ driver comming with the default kernel image. Its opensource and mainly, it works. To get it work, first we need to check whether our device have support from this driver,

squeeze@Debian:~$ lspci | grep BCM
03:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 02)
squeeze@Debian:~$ 

My card have support for b43, I just checked with the list of PCI cards they provided in their site. Now all I need to do is, install the firmware,

$ su -c'aptitude install b43-fwcutter'

This will automatically install the firmware. Thus, in your next boot, you will get ‘wlan(x)’ interface provided by ‘b43’ opensource driver.

If your card is not supported by opensource b43xx driver, still debian provides a good way, its ‘broadcom-sta-common’ package. This will install the proprietary ‘wl’ driver in a way that it will perfectly sync with debian packaging system.

Before starting this, don’t forget to have your backports ready, because debian testing repos have the habit of removing important packages, I had an experience that I was not able to find ‘kernel-headers-2.6.30-amd64’ in testing repo, after some googling, I came to know that its available in backports.

$ su -c'echo "deb http://www.backports.org/debian/ lenny-backports main non-free contrib" >> /etc/apt/sources.list.d/backports.sources.list'
$ su -c'echo "deb-src http://www.backports.org/debian/ lenny-backports main non-free contrib" >> /etc/apt/sources.list.d/backports.sources.list'
$ su -c'aptitude update'
$ su -c'aptitude install debian-backports-keyring'

Now make sure ‘module-assistant’ is fully prepared and ready to compile source codes for you.

$ su -c'module-assistant prepare'

Now we can start our proceedings,

$ su -c'aptitude install broadcom-sta-common'

Now, we need to compile the proprietary driver using ‘module-assistant’ command. This command will download packages to compile source codes on behalf of you using GNU Tools, Debian Build tools etc. Its ncurses based interface will clearly tell you what its doing. select ‘broadcom-sta’ in the wizard, ‘module-assistant’ will compile and install ‘wl’ dirver in this path ‘/lib/modules/$(uname -r)/kernel/drivers/net/wireless/wl.ko’

$ su -c'module-assistant'

Thus, in your next boot, you will get ‘eth(x)’ provided by ‘wl.ko’ properitory driver. This method is called “The Debian Way”.

Final method is so simple, Download the driver from broadcom’s website. Prepare your system to compile source codes. You can do this by installing gcc,autotools,libtool,build-essential etc., or just install and prepare ‘module-assistance’ so that your system will be fully capable to compile source codes.

$ su -c'aptitude install module-assistant'
$ su -c'module-assistant prepare'

Now just extract, make and make install,

$ su -c'tar xvzf hybrid-portsrc-x86_64-v5.10.91.9.3.tar.gz'
$ su -c'make'
$ su -c'make install'
$ su -c'echo "blacklist b44" >> /etc/modprobe.d/wl.conf'
$ su -c'echo "blacklist b43legacy" >> /etc/modprobe.d/wl.conf'
$ su -c'echo "blacklist b43" >> /etc/modprobe.d/wl.conf'
$ su -c'echo "blacklist ssb" >> /etc/modprobe.d/wl.conf'
$ su -c'depmod -aeF /boot/System.map-$(uname -r)'
$ su -c'update-initramfs -u'

Finally you can see ‘wl’ driver in this path ‘/lib/modules/$(uname -r)/kernel/drivers/net/wireless/wl.ko’. In next boot you will get ‘eth(x)’ wireless interface provided by proprietary ‘wl’ driver. In this method, debian will not update this driver for the next kernel updates, you need to do it on your own. This is the main drawback in the final method.

Sakleshpur Trekking – A thrilling story

Aah!! at last I got some time to blog, I was stuck up nearly two month doing RHCE and i’m happy that I did it in first shot itself. In the mean time, one of unforgettable moment happened in my life.

Dec 17, A serious discussion happened in my team, everybody want to go to their home inviting team members as their guest saying that there are nice places to go nearby. I also invited colleagues to vellore (What?? are you cracy?? – I know… I know.. a big laugh around my teammates..). Srinath surfed like anything to find a new, unpopular, best place in karnataka. Finally he saw a blog about “Sakleshpur”. Nobody knows this untill that night.

Dec 18, We decided to go wherever in karnataka, on that night, srinath arranged a car, took lot of maps routing to sakleshpur from chennai, everyone finished their work, at 11.30, I started my journey with srinath. After we reached our office, we took manju, karthik, saravanan and sridhar heading to sakleshpur.

Karthk, Saravanan, Srinath, Sridhar and Manju

Dec 19, 6:00 am, We are at banglore – tumkur outer ring road, wow!! top class roads!!

Banglore - Tumkur outer ring road

Dec 19, 11.00 am, our first stop for morning breakfast, moving towards hassan,

First stop for breakfast with this beautiful baby!!

Dec 19, 12.00 pm, our second stop, just to see a village which impressed saravanan,

villages - True India !!

Dec 19, 2.00 pm, we are at outer side of hassan, moving towards sakleshpur, one of the best journey in my life, full of greenery.

Hassan to Sakleshpur

Dec 19, 3.00 pm, we reached sakleshpur, booked a room, everyone want to take a nap, but no time for us, heading to the “Green Track” immediately. Till now we don’t know what kind of place that is.

We took auto from sakleshpur to dhonigal, after giving money to that driver, he advised to be careful, trains will come at any time and you will not have space to stand aside every-time. Also he asked us to watch out for elephants, jaguars and forest beasts, because previously two men went inside this deep forest and came back as skeletons !!!!!!!!!!!!!!! :0

After this initial fear, we started our treking, its a small mountain climb, we reached the track, its “Dhonigal” railway station, darkness taking raise !!

Donigal railway station

Even though its risky, we had no other choice now, heading towards “Yedakumeri” railway station. Fully covered by trees, everywhere is green, just amazing!! and thrilling !!

no wonder why its called green track!!

Dec 19, 6.00 pm, its almost dark, we heared some kind of sound, its a train!! heading towards us, here we got a place to step aside and captured that train in our cameras

First train !!

Dec 19, 6.30 pm, its fully dark, we stuck in a middle of deep forest, everybody got some kind of uncertainty and discussed about dropping the plan and back to sakleshpur, but there is no choice for us. Even going back to sakeleshpur is as dangerous as going to “Yedakumeri”.

At that time, we saw someone coming towards us. Manju asked that person “who are you?”, because he only know kannada, with initial fearness solved, that person is the one god sent to save us. It seems he is heading towards his home near dhonigal railway station, and scolded us for unplanned journey. He called his friend who is staying in one of the railway workers quarters and explained the situation. His friend is also helpful that he promissed to come here and take us to his home, also asked this person to stay untill he come.

As he said, his friend came and took us to his home. Near his home, there is another abandoned home, he broked those locks and gave it to us saying “If somebody asks!! I will tell that its thiefs work!! they broken this locks”. We thanked him a lot. at last our fears came to somewhat minimal.

Walking in a railway bridge!!

Savior!!!

Dec 19, 7.30 pm, sridhar’s airtel got some thin signal, everybody started to call and inform to their beloved ones, I took it and sent a message to kesavan “Machi, mohan here, I’m in middle of deep forest situated between dhonigal – yedakumari, If i’m not calling to you before morning 10.00 tomorrow, please inform to police, also tell to my father, please dont panic, don’t tell it now to my father, I’m safe here!!”. Kesav behaved as I said.

After this, everyone got some relax, talked freely and cracked jokes !! thinks came normal !! and we started a camp fire outside that home. Its full of dark we don’t know how much beautiful that place is untill morning.

Dec 20, 6.30 am, After amazed by the place we slept, everyone went to take bath even in that freezing temperature. At last we thanked everyone in that place and started our journey to “Yedakumari”. Also we saw few people (most of them are railway contract workers) using that track for transporting. While walking we asked another person how long is “Yedakumari”? he said another 10km, we already passed 7km, he also said, there is one small station nearby within 4km from the current place. So we decided to stop in that small station and back to dhonigal. Everything went as we planned this day and we witnessed a beautiful paradise !!!

Helping hands!!

Camp Fire!!!

nearby railway workers house

First Tunnel

Second Train - at this time we are inside a tunnel - run!! run!! - amazing moments :) !!

Longest and Deepest bridge we crossed !! - legs will defenately shake!!

Mountain View!!

Did you see any rocks here??

We reached The Next Small Station!!!

Back to pavilion - Sakleshpur hotel!!

I’m a person who didn’t get opportunity to witness nature’s gifts to human, but after visited this place, I just want to spend my life there, people living there love their world, money is not much important to them (we learn that when we gave money for staying one night, that person refused).

There is something which we are gifted, we should protect that gifts till our time and give it to our descendants.

Finally, thanks to hyundai for producing quality product. I love that car which we traveled, its as perfect and gave no trouble in our journey. Even riding it is as enjoyable as nature.

Dec 21, 7.30 am, we are here!! chennai !!. with lot of energy!! happiness!! and full of beautiful memories!! :)

Thanks Santro !!

Here is the map