Category Archives: Linux

My tweet you just read says the long story short. In case you didn’t come across, Google made DNS a buzzing topic again with Google Public DNS. So I felt like trying a dns cache again. The logic is “If a better DNS server makes things better, DNS cache makes it even better.”

This is more of a note to self than a HOWTO. If your use case atches with mine, feel free to use this.

My use case: I use an HSDPA, mobile broadband connection on Ubuntu 9.04 Jaunty Jackalope.

Install pdnsd with,

$sudo apt-get install pdnsd

Now launch the text editor you hate and add following to /etc/pdnsd.conf

(By default all the parts are commented so just adding this was fine enough for me)


server {
ip=208.67.222.222 , 8.8.8.8;
timeout=5;
interval=30;
uptest=ping;
ping_timeout=50;
purge_cache=off;
}

global {
 perm_cache=5120;
 cache_dir="/var/cache/pdnsd";
 min_ttl=15m;       // Retain cached entries at least 15 minutes.
 max_ttl=1w;        // One week.
 timeout=10;        // Global timeout option (10 seconds).
}

I copied this piece from here and edited ;). Added the global field because defaults were not cool enough for me. And in ip field I’ve put respectively OpenDNS and Google DNS addresses. You can just add one address there. ‘man pdnsd.conf’ will teach you more about the content in the file.

Once you are done editing the configuration file restart pdnsd with

$sudo /etc/init.d/pdnsd restart

Now you should tell the network manager to look for pdnsd for it’s DNS needs.

Right click network manager icon and then follow Edit Connections > Mobile Broadband and choose to edit your preferred network connection.

In Editing <Your Network Connection> dialog box,
[1] Choose IPv4 Settings tab
[2] Choose Automatic Addresses (ppp) Only in Methods Dropdown box.
[3] Set DNS Servers field to 127.0.0.1 (which refers to pdnsd in our case)

And obviously, Apply Changes :P .

If everything went fine, you are now ready to enjoy DNS cache goodness with pdnsd.

You can check how good is it with dig command.

ex:
$dig yahoo.com

run this command twice and compare Query time field.

Note: If you followed all the steps but still it doesn’t work, try restarting pdnsd. If you get following error refer this page

/etc/resolv.conf must be a symlink

Update: Added the global settings for config file.

SinhalenFOSS, Sri Lankas very first tech related podcast, the podcast that I proudly feature in, turned one year yesterday(9th April 2009). We didn’t have big plans for the day but it was truly a big milestone for me. I’m sure the story is same for the other two co-hosts Bud (geekaholic) & Seejay.

We had the episode 21 recorded on last sunday (5th April 2009) but due to my busy schedule I couldn’t finish editing & upload it. Finally there was a hope for uploading it on SinhalenFOSS birthday. But I’m really sorry that I couldn’t make it on time since my father was sick & I had to go to the doc with him. Added to that, I couldn’t stay up all night & finish it off since I was tired of fairly a long journy. Actually I tried to stay awake but failed. However my computer stood awake when I find it on my bed in mid night (Poor thing!).

Anyway I’ll try to finish things up & put the final product in our loving listeners hands As Soon As Possible!. The bits are running in to interwebz right now :) .

It was a pleasant year passed giving me lots of experience, introducing lots of nice people to me, taking my life to another level & best of all, making me very happy for being a part of. It’s all thanks to you dear SinhalenFOSS, I really love you. Wishing you a very happy birthday!

Update: SinhalenFOSS episode 21 is on interwebz now :)

Ok here comes early fruits of my dialog experience. You already know that I had too much of connection drops lately. The story is changed now. I don’t have that much of connection drops. NO I don’t have good connectivity either :P . I have this new problem. I get the bogus DNS address 10.11.12.13 & 10.11.12.14 assigned in err… every 10-15 minutes, or even less. Ah I have stats I guess :)

uptime – 1hr32mins
Connection dropouts 2
bogus DNS allocations – 15

This is at the time I checked. After that things turned even worse. I use OpenDNS since I’m not happy with Dialogs nameservers (Unfortunately I can’t use all the features of Open DNS coz Dialog don’t give us at least a dynamic unique IP). But since these annoying DNS allocations I had to manually set OpenDNS settings all the time. For that I wrote following bash script. This was so quick & is so dirty. And this might not be the best way to do that.

create a file called /etc/resolv.conf.odns & put OpenDNS settings in it.

nameserver 208.67.222.222
nameserver 208.67.220.220

And then put following code in setodns.sh, chmod 755 it  & run (as super user).


#!/bin/bash

## setodns.sh
## Override Dialogs fucking DNS settings with OpenDNS settings.

while true ; do
 cp /etc/resolv.conf.odns /etc/resolv.conf
 sleep 45
done

To get rid of this you have to press Ctrl-C , since it’s in an infinite loop.
That’s how I make the future less shitty, for now. I said that because Dialog says The Future. Today. Today is shitty, I fix it means I fix future ;) .

New update available HERE

This was a big headache for me. Portable Firefox is a great piece of work but I couldn’t experience it’s ease with my OS love GNU/Linux (there is Gnu/Linux installed in our campus). So the bad old hacker in me wanted some way to make it happen. Even after few Googlings, didn’t find a How-to to do this. So I thought of hacking it for myself. This is what I got ultimately. Once thinngs are ready it takes maximum 4 easy steps(2 steps are optional). So let’s fire it up.

Hope You got Portable Firefox on your USB stick.

What you have to do is adding few lines in to profiles.ini file. To make it bit easy for you I have created fxp.txt file for you.
Download & edit fxp.txt :

[Profile1]
Name=portable
IsRelative=0
Path=/media/disk/FirefoxPortable/App/DefaultData/profile

Critical update: You better use

Path=/media/disk/FirefoxPotable/Data/profile to get the same profile on Window$ and GNU/Linux.

Name=
You can use any string made of letters & numbers for this. Make sure the name you use is unique for your profile.ini file.
IsRelative=0
This is nothing you have to deal with.
Path=
This is the exact path to portable Firefox profile folder [what you see on the address bar when you browse in to profile folder].

And remember to change [Profile1] to the appropriate profile number according to the profile.ini file if necessary. The very first line of fxp.txt is empty. Please remain it unchanged to keep profiles.ini tidy & headacheless.

Now open a terminal & put
cat >> /path/to/profiles.ini /path/to/fxp.txt

ex: cat >> /home/chanux/.mozilla/firefox/profiles.ini /media/flashdrive/fxp.txt

this will append the content of fxp.txt in to profiles.ini. Ofcourse you can do this with GUI lameware with more pain in back. if you like loads of clicks & copy & pastes go that way.

You’ll find profile.ini at
~/.mozilla/firefox

well it’s the home folder :
ex: /home/chanux/.mozilla/firefox/profile.ini

once you update the profile.ini file you are ready to feel the home on the road.

Type firefox -ProfileManager in to the terminal or “run command” box. If you prefer terminal, you have to keep it open as long as you want to use firefox. Once you get profile manager box, choose your portable profile & rejoice.

The four steps in brief:

Check profiles.ini
Edit profiles.ini if needed.
Append fxp.txt to profiles.ini
Start firefox through profile manager.

Update: Make sure Firefox is closed when you try firefox -ProfileManager. I did dumbness & Twittered too. Seejay reminded me to close Fx :D

E-live is a new (for me at least) Linux distro which I found on last Software Freedom day event. I was stunned when I saw the e-live desktop for the first time. Once I saw that laptop with a cool, dark, glassy, high tech looking background, I couldn’t resist myself from walking to the guy who was with the laptop & ask him what the Linux distro he is using is.

I was really impressed by the look. It was like love at first sight. I wanted to get a copy of it & when I found a break I asked Gayal to burn me e-live. Yes it was Software Freedom day so Gayal burnt me e-live & I didn’t even pay or the blank CD.

I used e-live live CD for the first time 1GHz AMD Athlon XP machine with just 128MB RAM. e-live warned me that it won’t work well with 128MB. It’s good I ignored that message & waited biting nails to find e-live working on that machine. The performance was great for 128MB RAM.

MP3s, DVDs & everything I tried worked just fine. It identified the NTFS drives easily & let me read/write on them without any headaches. Soon I forgot that I was working with 128 MB memory. I played a little game & was really impressed with the whole e-live experience.

Once I came home I installed it on ma old 60GB hard drive which is used as a ‘data traveler’, leaving 4 partitions to be NTFS (don’t ask me why ;) ). There were no problems until this moment but my friends were amazed of the thing. The night-sky looking background is great. I can see stars glowing & sometimes meteors flashing across the screen.

e-live is debian based, comes with ‘Enlightenment’-a lite window manager. I’m really happy with the performance & find it really hard to go back to those *popular* Linux distros. If you use Linux live CDs as a recovery tool, e-live will just work fine.

Wanna give it a try? Check here. [wikipedia]