Results tagged “/etc/resolv.conf” from CLICK

When dynamic IPs and /etc/resolv.conf don't play well together in OpenBSD

| | Comments (0) |

I don't begin to fully understand how computer networking works, but I can pretty much hack my way through it. (My networking "goal" is to set up VNC over the Internet ... but that's light years ahead of where I am today.) And I'm sure I've had this very same problem before (and should probably just try to find an earlier blog entry with the very same problem/solution instead of reinventing a very squeaky, annoying wheel with all you dear readers.

But if I'm having this problem again, chances are some of you might have it, too. And I don't think it's confined to OpenBSD. This could potentially crop up in any number of Linux distributions.

Here's the problem: For the past few days, my OpenBSD laptop has been slow as sludge in the browser (Firefox and Opera are the same in this regard).

But a speed test or a download of a large file shows no connection problem or speed problem at all.

So what is making my Web browsing so slow?

The answer: A bad nameserver in my /etc/resolv.conf file.

You see, I don't use this laptop in a single location. I have it at home, at the office, at Starbucks, and any number of places in between where I connect either wirelessly or with wired Ethernet.

And I usually do it with dynamic IPs, meaning I have OpenBSD set to get a dynamic IP address from the router providing me with networking, be it my home router or any other.

And my home router, a recent Netgear model, doesn't just pass through the two nameservers from my ISP that I have programmed into it. Instead it gives my laptop the nameserver address 192.168.1.1 (the same IP address as the router itself). I assume that the router is making some kind of translation and pushing the nameserver data through the 192.168.1.1 IP address to my laptop.

For the most part this works. And forgive me if the following explanation is either totally wrong or just incomplete. I'm explaining it the way I understand it, and I welcome your clarification and correction:

Usually when a router sets up a dynamic connection, it sends the router's gateway IP to the local machine, assigns the machine its own IP address and provides nameserver data (i.e. the IP address of the nameserver) as well.

So the local machine now knows the router/gateway address (and subnet), local IP address and nameserver address.

But ... one of the networks to which I connect is a bit old school. The router gives me a dynamic IP but doesn't send nameserver data. It assumes that the local machine already has nameserver data entered into the system and doesn't modify /etc/resolv.conf at all. Hence my old nameserver IP address — 192.168.1.1 — is still at the top of /etc/resolv.conf, with my "real" DNS nameserver IPs below it.

And the reason it takes so long for Web pages to appear is that the system is trying to resolve every alphanumeric HTTP address through a DNS server that on this other local network doesn't even exist.

Once I deleted the nonexistent nameserver address from my /etc/resolv.conf and had two "good" nameservers at the top of the file, everything started flowing as fast as it should.

Analysis: This problem stems from using DHCP to connect at multiple physical sites, and the slight differences in the DHCP protocol at those various locations is what's making my Web browsing slow down when /etc/resolv.conf is not properly configured for a given location.

The best "solution" is to always connect with a static IP on the router that doesn't transmit new nameserver IPs to my client computer.

In OpenBSD as I have it configured, I do all my network "tweaking" with text files, principally /etc/resolv.conf and /etc/hostname. (in my case /etc/hostname.rl0 /etc/hostname.wi0 and /etc/hostname.rum0 for the three wireless interfaces I have, one wired and two wireless; yes, the BSDs deal with networking a bit differently than Linux, and I've learned a lot by doing all of this manually).

I generally have each "hostname" file filled with a few lines for the various routers I use (with appropriate DHCP or static IP info and any SSID names and WEP or WPA keys needed), and I "pound out" (or "comment out") the lines I don't need. The problem is that I don't keep as close of an eye on /etc/resolv.conf, which is being changed by some of these DHCP servers and not by others.

Without any GUI tools such as the NetworkManager in GNOME, which I've used in Ubuntu and Debian, I either need to be much more mindful of what my configuration files contain at any given time, or I need to write/beg/borrow/steal some shell scripts that allow both the /etc/hostname.X files and /etc/resolv.conf to be modified by me when I decide to connect to one network or another. For instance, I could have the script give me a menu of networks and then modify the configuration files appropriately.

As it is, in Debian and Ubuntu, I often had to go to the NetworkManager to pick a new "location," of which I had many set up just like in this script I envision.

If only there was such a tool already in OpenBSD that would do this for me without needing GNOME, KDE or .... It could already be there and I just don't know about it.

I fondly remember the netconfig script in Slackware, which is one of the simple but supremely useful things I love about that Linux distribution. I'd love something like that in OpenBSD, but hacking into the text files isn't that big of a deal.

And I'll probably avoid the one local network that has DHCP but doesn't send its own nameserver IPs to the client.

Tech Talk column

Steven Rosenberg's weekly Tech Talk column, which appears Saturdays in the Los Angeles Daily News, is now available on the Daily News Technology page.

About this blog

New ways to sign in to comment: I just added the ability for prospective commenters on this blog to sign in using their AOL, Yahoo! and Wordpress.com accounts (for the past 200 posts anyway ... more than that will take an extensive, middle-of-the-night rebuild). That's in addition to the other sign-in choices, which include starting a Movable Type account on this blog, Typekey, OpenID, Live Journal and Vox. If you have trouble getting your Movable Type account verified, or any of the other sign-in options are not working properly, please e-mail me. With these added ways of signing in, there's more reason than ever for you to make a comment (or several!).




Steven Rosenberg aims to learn what he does not know. He writes about it here.



Recent Comments

Powered by Movable Type 4.25

Tags

LXer

Links

Daily News technology
LXer
Distrowatch
Linus' Blog
David Pogue
BoingBoing
Linux Today
TuxRadar
Linux.com
Linux Planet
The Open Road
Linux Outlaws podcast
Dan Lynch
Fabian Scherschel
The VAR Guy
Larry the Free Software Guy
Chess Griffin
Linux Reality podcast
Desktop Linux
Practical Technology
Linux Devices
ZDNet
ZDNet U.K.
iTWire
CNet News
Webware
Beyond Binary
TechCrunch
The Register
Ars Technica
Reg Developer
Computerworld
Computerworld blogs
Steven J. Vaughan-Nichols at Computerworld
Debian
Planet Debian
Debian Forums
Debian News
debianHELP
debiantutorials.org
The Debian User
Wolfgang Lonien
Debian-News.net
Debian Administration
Debian Admin
Debian Weather
Aaron Toponce
Ubuntu
Xubuntu
Kubuntu
Edubuntu
Planet Ubuntu
Ubuntu Forums
Ubuntu Geek
Works With U
OMG! Ubuntu!
I' Been to Ubuntu
Tanner Helland
Dustin Kirkland
Ubuntu UK Podcast
Popey
gNewSense
CrunchBang Linux
OpenBSD
OpenBSD Journal
OpenBSD Ports
OpenBSD 101
Planet.OpenBSD.nu
jggimi's OpenBSD live CD
DaemonForums
BSDanywhere
Marc Balmer
Denny's OpenBSD blog
Polarwave's OpenBSD Tips and Tricks
Binary Updates for OpenBSD
Puppy Linux
Damn Small Linux
Tiny Core Linux
Lucky 13's Linux blog (lots of Tiny Core)
Lucky 13's BSD blog
PCLinuxOS
Mandriva
Red Hat
Red Hat News
Red Hat Blogs
Red Hat: Truth Happens
Red Hat Magazine
CentOS
Planet CentOS
Fedora
Slackware
Slackbuilds
Robby's Slackware Packages
Slackblogs
dropline GNOME for Slackware
GNOME Slackbuild
GWARE - GNOME for Slackware
Wolvix
Zenwalk Linux
Vector Linux
Slax
Splack Linux — Slackware for Sparc
Nonux
How to Forge
marc.info BSD and Linux mailing list archive
FreeBSD
FreeBSD, the Unknown Giant
A Year in the Life of a BSD Guru
NetBSD
hubertf's NetBSD Blog
PC-BSD
DesktopBSD
DragonFlyBSD
DragonFlyBSD Digest
DesktopBSD
BSD Talk podcast
BSD Magazine
OpenSolaris
MilaX
BeleniX
DeLi Linux
Linux Loop
Electronista
Engadget
Gizmodo
xkcd – A webcomic of romance, sarcasm, math and language
Nixie Pixel
Technology for Mortals

Advertisement

Other blogs

A YouTube Kind of Love in Friendly Fire
Tale of two cities, a decade later in The Sausage Factory
The Early Words: UCLA hoops notebook in Inside UCLA with Jon Gold
Tuesday Kicks: Chivas USA Win & More in 100 Percent Soccer
Answer Tuesday! (Part 7) in Inside USC with Scott Wolf