LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   DNS issues with wireless? (https://www.linuxquestions.org/questions/linux-newbie-8/dns-issues-with-wireless-499740/)

question_box 11-08-2006 09:07 AM

DNS issues with wireless?
 
So I recently installed madwifi to work as a driver for my wireless card on Linux. For awhile, this was working fine, as long as I opened a root shell on startup and entered:

ifconfig ath0 up (bringing the ath0 interface online??)
iwconfig ath0 ap any (configuring ath0 to pick the nearest access point???)
dhclient (bringing up a dhcp client, which should configure IP and DNS addresses???)

However, after awhile, I was noticing that when I worked on a non-work network, I would have about 1 minute of happy internet access, but then firefox would hang (seemingly forever) in "looking up URL".

This would appear to be a DNS problem, but what does one do about it? I learned (out of necessity) that killing and restarting dhclient would get me another minute of access (helpful because I get my info from google!). I also learned that the contents of resolv.conf should include the IP addresses of the nameservers. OK, so here was the contents of resolv.conf:

; generated by /sbin/dhclient-script
search work.domain
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx

OK - so it makes sense that DNS should have a problem - the IP addresses were DNS servers on the network at work, but wouldn't be accessible from my cable modem router at home. So... in the 1 minute where DNS was working, I used nslookup to determine the IP address of the DNS server that worked at home:

192.168.10.1

(the address of the router - acting as a nameserver? forwarding DNS requests to someone upstream?)

OK - so this is fine - I just need to add it to the resolv.conf file, right?

I also find out on this forum that the "search" line can cause problems, so I commented it out for now. (What does the "search" line do? is it evaluated before the "nameserver" lines? wouldn't a search be slower than looking up a known server?)

So - I added it to the end of the list, like this:

; generated by /sbin/dhclient-script
#search work.domain
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
nameserver 192.168.10.1

And... lo and behold, ping, nslookup and firefox begin to work - but response is slow (but nearly constant delay). So - I guess that the delay is waiting for timeout from the two inaccessible servers listed earlier in the file, so I change the order:

; generated by /sbin/dhclient-script
#search work.domain
nameserver 192.168.10.1
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx

Lo and behold - lightning quick, reliable access!

But, I'm left with some questions:

#1 - why does running dhclient make DNS work for a short period of time, but then futz out afterwards? I assume that it caches the newly discovered DNS name somewhere, but then renews that information from resolv.conf periodically. Why didn't dhclient add the new DNS address to resolv.conf?

#2 - if I move this new resolv.conf file back to work, won't I have to wait for 192.168.10.1 to timeout (not on the work network) before accessing the work DNS servers? Can I somehow configure DNS to look for the right set of servers straight away based on which network I'm connected to?

Confused...

MS3FGX 11-08-2006 10:38 AM

This is a strange problem, as /etc/resolv.conf should get it's servers from the DHCP client. It shouldn't hold servers from a previous DHCP session like that. The only time I am aware that it would do that is if the the computer failed to get a DHCP lease on the new network. In that case it would still use the servers from the last lease, but clearly that is not the case since you get an IP and are able to connect for awhile.

Unless I am not thinking of something, this sounds like it might be a distro-specific issue. You didn't say (or at least I missed it) what distribution you were running, perhaps that would help.

question_box 11-08-2006 11:38 AM

Distro is FC4
 
with standard install from ISO images.

Thanks for any insight you can provide!


All times are GMT -5. The time now is 05:48 PM.