![]() |
Can I use my /etc/hosts file as a person DNS server?
I only normally visit around 10 sites tops when surfing the net. Can I just include all the entries in the /etc/hosts file? So in theory, if I did this, and I only visited those 10 sites for the rest of my life, my computer would never access my ISP's name servers to resolve one of the domain names that I have listed in my /etc/hosts file? Also, if I connected wirelessly to my router, would there be any need for
echo "nameserver 192.168.1.1" > /etc/resolv.conf ? Also, if the /etc/hosts file does do what I'm thinking it does, is there a file equivalent to the hosts file but on windows xp? |
why not just use " OpenDNS " http://www.opendns.com/
|
If I just use those 10 sites, then wouldn't I get better performance on resolving?
|
Quote:
that should work just fine. Quote:
router to be a server... how come you have to echo this, though? Is it not handing out a new resolv.conf as part of dhcp? Is it overwriting it with non-sensical data? Quote:
somewhere, but I'm not a windows guy ... |
I think the windows version is is just hosts as well. Just search for it, since it's location seems to vary
|
If I'm using dns and I have all the domain entries in /etc/hosts for that computer, then there's no need to use my router for dns right?
Yea the echo thing is just a habit, hehe. Also, let's say the above is true, can I setup all my other computers in my network to use ip address of this computer with /etc/hosts file for dns? I would just make sure port 53 is open on the computer with the /etc/hosts file. |
Quote:
lookups. If you want the machine to serve IPs to other boxes on the local network you'll need some sort of DNS server process. Quote:
trying to connect to using the info in your hosts file). Cheers, Tink |
Quote:
If you run squid on the 'server' as a proxy, dns look up occurs local to squid rather than local to your browser and if squid is running on the machine with the doctored hosts file, that should give you what you seem to want. Plus caching, of course, which may not be a big win, but it is probably a small win all on its own. Note that this would only work with things like the browser that use squid's proxying capabilities; this doesn't include things like command line utilities (ping, etc) and might not include some utilities that have similar ca[pabilities to ping or even some browser-like things that can't be set up to use the proxy (rss viewers?). |
You can use /etc/hosts for a lot more sites then 10. With web browsers doing their caching anyway, you could use even hundred entries in /etc/hosts, and still not notice a difference. It is more likely to wait for the remote server to respond, then to wait for your local PC to look-up domains/IPs from /etc/hosts.
I use /etc/hosts entries for local testing of websites, that I'm working on. It's an easy way to switch between the remote server and the local development version, without messing up anything on the production. Having 20-30 such entries hasn't caused problems. Linux Archive |
| All times are GMT -5. The time now is 02:57 AM. |