Odd question. I have a hosts file in place, but it...
# cfml-general
d
Odd question. I have a hosts file in place, but it doesn't seem to be having any effect. Entries (lines in the file) look like this, verified by closing the file and reopening it:
Copy code
10.10.8.37 <http://testdev.something.org|testdev.something.org>
(That's not real info.) In an admin cmd prompt I did this:
Copy code
ipconfig /flushdns
nslookup <http://testdev.something.org|testdev.something.org>
That gave me:
Copy code
can't find <http://testdev.something.org|testdev.something.org>: Non-existent domain
What am I missing here?
m
Can you ping testdev.something.org? I can ping my local hosts file entry. I can't do a nslookup either. Get same result. I think nslookup uses DNS and not the hosts file
1
d
You're right. Our networking guy said "Nslookup does not look to the local hosts file, only name servers, try ping instead."
e
its not entirely accurate, it depends upon the OS and the bind order of the network. if you are trying it from a router, sure the router maybe ignoring your request, but if you are doing it from a laptop / or pc then you would just need to change your DNS priority (Windows) or Bind order (mac, NIX) to make nslookup work as you wanted. on windows you would need to ipconfig/flushDns and nbtstat -R and depending on your sack ops you should be able to use nslookup as you like.
d
Thanks for that info, but I don't need to make nslookup work, I just wanted to verify that my hosts file was being honored, and ping gets me there.
a
127.0.0.1 should get you there instead of having specific IP.
e
Dave, NSLOOKUP is bound by the rules of the network stack. The network stack is controlled by your OS configuration. if you really want nslookup to work for mytest.fakedomain.com then your host order priority needs to be HOST, so open up regedit, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider\ there set *LocalPriority=4 (default is 400) HostsPriority=5 (Default is 500) change or add those dword values and restart. Then go to winroot\system32\drivers\etc\host file and add 127.0.0.1 mytest.fakedomain.co*m be careful of spacing as do not use tabs, its a weird and known bug. Save the file (you will need administrator-level access to do this) and now nslookup will resolve to mytest.fakedomain.com
🙂 1