wrap-up: [TriLUG] KDE, switching networks, delays starting apps

Alan Porter porter at trilug.org
Tue Oct 19 20:22:01 EDT 2004


Last week, I asked a question about launching X apps on a laptop
that I carry from work to home.  The gist of the problem: when I
moved the laptop to a new network, something was causing a long
delay whenever I launched X-windows applications.

The TriLUG group quickly narrowed the problem down to DNS.  The X
server caches the DNS information that it had when it fisrt started,
but those DNS servers are not available when I move to a new
network.

The two solutions that were suggested:

   (1) Enter something like this in /etc/hosts:

      127.0.0.1 localhost laptop laptop.workdomain.com 
laptop.homedomain.com

   (2) Install a caching DNS server on my laptop and put 127.0.0.1
       in /etc/resolv.conf.

Here's what I have learned in the week since then.

(1)

When I change my /etc/hosts file as shown above (on Debian), I ran
into problems with the "hostname" command.  I have a backup script that
uses the hostname command to name the backup files, and I found that
my files were being named "localhost_20041018.tar.gz" instead of
"laptop_20041018.tar.gz".

I tried several permutations of this solution, including:

   127.0.0.1 localhost laptop

and

   127.0.0.1 laptop localhost

In the first case, hostname reports "localhost".  In the second case,
hostname correctly reports "laptop", but "hostname -d" does not report
my domain name.  Instead it just gives "".  My backup scripts were
still failing.

So I don't think this is the solution that I want.

By the way, a buddy of mine tried this under Mandrake and had no
problems.  ???

(2)

I installed dnsmasq, a very simple caching DNS server with a built-in
DHCP server.  Basically, the configuration that I wanted was the
default (an empty configuration file).  This simple configuration
does caching DNS, but not DHCP.

Then I added my own machine to the list of DNS servers.  My dhclient.conf
looks like this:

   send host-name "laptop";
   prepend domain-name-servers 127.0.0.1;

That way, no matter which network I connect to, my resolv.conf looks
right.

   search homedomain.com
   nameserver 127.0.0.1
   nameserver 192.168.1.1     <-- home DNS server

or

   search workdomain.com
   nameserver 127.0.0.1
   nameserver 10.1.1.1        <-- work DNS server

In either case, DNS requests go to dnsmasq, which will look in its own
cache first, and then go to the other DNS servers in resolv.conf.  This
could also potentially speed up web surfing, email, etc, since DNS entries
are cached locally.

Now when I launch X apps, the X server tries to lookup my own name,
"laptop".  It asks dnsmasq, which in turn asks the DNS server wherever
I am.  It will return my DHCP-assigned IP address very quickly, and
the X app starts up normally.



So my vote is for option #2.

Thanks again to everyone who threw in their ideas.  This has been a fun
learning experiment.  If anyone wants help with dnsmasq, let me know.


Alan







More information about the TriLUG mailing list