Human Readable   

 

     
   
     

dnsmasq—Day 49

© Copyright Darrell Anderson.

Because GNU/Linux is far more versatile than Windows, I want to find a way to improve my dial-up sessions. I realize that I am limited by certain boundaries, but nonetheless I know there ways I can improve dial-up.

I have already noticed that despite connecting at the same speeds in either Windows or Slackware, my Slackware dial-up sessions seem a wee bit snappier. Possibly this is an optical illusion with the way Firefox renders web pages versus Windows. I don’t know, but pages do seem to load faster. The problem might also be that in Windows I still use the Proxomitron web filtering proxy. I will have to experiment without Proxomitron, but I doubt this is the difference. Regardless, what I want to do with my dial-up session is cache as much as possible.

Yes, browsers can cache pages. However, browsers are known to crash, and particularly with Firefox, a crash often destroys the cache. Very frustrating. Thus, I want to create a cache of my dial-up sessions upstream of my browser. No, I do not want to install and configure a separate box as a gateway and router. That would be overkill. I want to configure my stand-alone box to do all of this caching for me.

There are two items to cache: domain names and actual content. For the former I looked at a utility called dnsmasq. At first this program seemed to help, but two things eventually caught my eye. One, my systme booted noticeably slower after I installed dnsmasq. My system requires about 65 seconds to boot fully into KDE. Installing dnsmasq added another 30 seconds. I also noticed that for about five minutes my system was acting more slowly.

Investigating was straightforward. I disabled the dnsmasq rc script and noticed the improvement. Now to troubleshoot. Back to the web!

I tried various dnsmasq.conf settings all to no avail. Then, on a hunch, I edited my huge hosts file to include only necessary information about my box. I use my hosts file to cache all of my bookmarks as well as blocking thousands of sites. My hosts file is more than 800KB in size and has worked well for me in Windows for many years.

With my temporary hosts files, I enabled dnsmasq and rebooted. My boot time was still about 65 seconds and quickly glancing at top I noticed that dnsmasq was using only about 1.5% of my resources. With my larger hosts files dnsmasq consumed more than 90% of my resources for five to ten minutes. Now everything was behaving “normally.”

I restored my original hosts file and rebooted. All of my previous problems reappeared. So now I know the cause but not the solution. Additional dnsmasq.conf changes have no effect.

However, another thing about dnsmasq bothers me. This handy utility obviously was designed for dedicated routers and gateways. That is, boxes that tend to remain on all the time. Dnsmasq caches domain name in memory, not to the hosts file or any other file. Thus, dnsmasq is limited in helping somebody like me who powers up and down each day. Dnsmasq works as advertised, but caching is good only for each boot session.

dnsmasq is supposed to be able to modify the hosts file (although I haven’t yet figured out how), but as I just described, a large hosts file introduces a huge performance hit for 10 minutes or so after booting. I also realize that IP addresses change continually and tend to render some hosts file entries obsolete. I experience this usually once or twice a month in Windows and the solution is manual but easy. I disalbe the domain name in hosts, then perform a whois command to discern the new IP address. I don’t know if dnsmasq can perform this same routine automatically to update a hosts file.

Additionally, dnsmasq provides no solution about caching content and is not intended to. Thus, I need to look for another solution. Possibly Squid.

Another area I want to resolve is a way to verify my browser bookmarks. In Windows I use an old utility that checks every bookmark entry and adds the IP address to my hosts file. The process is manual in that I have to remember to run this program, but at least all of my bookmarks remain current in my hosts file. I would like to automate this process in the far more vesatile world of GNU/Linux. There is a Firefox extension that verifies bookmarks, but provides no automated way to repair discrepancies. The extension only looks to see if any bookmarks have gone stale. The extension provides no way to automatically update the hosts file. Are there any clever bash script writers up to this task?

Finis.

Table of Contents