-   Linux - Networking (
-   -   Dns Question ..... (

har5ha 07-23-2004 03:07 AM

Dns Question .....
Hi All,

I am connected to the Internet through a winxp machine [internet connection sharing DHCP].

Every time I try to access any website the Dns request goes to the winxp box [as it should as it has the name server]

My Question is

Is there any way i could make the dns resolver look on the local system before it tries to access external dns server???

I mean by editing a file and providing static host name to ip mappings like

i edited resolv.conf and hosts.conf and provided mappings as above.. but it doesnt seem to be workin...

i found this out by running ethereal... the dns requests are still goin to the external dns server [winxp box].

Am i missing something??????

Please enlighten me......


Donboy 07-23-2004 07:40 AM

You can setup the mappings you want in the /etc/hosts file... note this is NOT the /etc/hosts.conf file. However, you're wanting to put sites like Seems a bit too much trouble for that. Maybe if we knew what you're trying to accomplish it would be easier to suggest something more meaningful. From the sound of things you just want to make things more efficient by not having to connect to another machine to lookup domains???

har5ha 07-23-2004 11:41 PM

Thanks for ur input...

I put some [ip - name ] mappings into /etc/hosts file ..

It seems to work!!!!!!

NO DNS LOOKUPS R happening for those......


ppuru 07-24-2004 05:15 AM


You cannot put the IPs of all the websites in the world in your /etc/hosts. Edit your resolv.conf and put the IP of an external dns server ... preferably the one that your XP system uses.

edit /etc/resolv.conf and put

nameserver < ip of external DNS>

If you are getting your IP from the XP system, edit your /etc/sysconfig/network-scripts/ifcfg-eth0

and set PEERDNS=no.

This will stop resetting your resolv.conf.

har5ha 07-24-2004 11:12 AM

hi ppuru

thanks for ur input..

but i have a question

when u said --> You cannot put the IPs of all the websites in the world in your /etc/hosts.

r u telling me its not [ feasible/possible ] to add [ip to name sever mapping] into my /etc/hosts file..

But i have written a script which parses my mozilla firefox [history.dat] for URL's and does a name server lookup and write's the mappings into a file --> which i can paste into my /etc/hosts file..

I have done this as i deem it unnecessary for my system to do a dns lookup for these limited number of website's that i browse daily.


ppuru 07-24-2004 11:20 AM

It is extremely tedious and a waste of your time. ... you can run a cacheing dns server on your system and points it forwarders to your XP machine...

I was under the (wrong) impression that you are unable to access any dns server and are trying to do the host-ip mapping using your /etc/hosts. My apologies.

iantri 07-24-2004 01:42 PM

I agree with ppuru. What, exactly, is the point of adding numerous addresses to your hosts file when the time it takes to contact your ISP's DNS server and get a response is <100ms?

The other problem, and the fact that you bring up yahoo is a good one, is that many sites use round-robin DNS to balance load, which means that there is no guarantee that the server on the IP address you have set will provide the best service. Also, if a site changes their IP address, it will suddenly stop working.

There is absolutely no benefit to doing this.

If you are insistant on doing this, look up "caching dns" on and you will find a simple caching DNS server that will store ip addresses for a limited period of time to speed up DNS requests (the time they take is insignifigant anyway, unless you are on satellite internet).

har5ha 07-24-2004 03:34 PM

Thanks Once again..

Appreciate all ur thoughts regarding DNS.. .

Will definitely look up the [dns caching] thing....

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