Make nslookup read /etc/hosts file

Dear,
OS: OUL5x64
my nslookup resolve the name thru dns server.
question :
how to make nslookup resolves name through /etc/hosts file.
i do have /etc/resolv.conf and /etc/nsswitch.conf file
here is my nsswitch.conf
/etc/nsswitch.conf
#hosts: db files nisplus nis dns
hosts: files
but it never uses the file to resolve the name.
how can i force it to read /etc/hosts file first
Thanks in advance!

Perhaps it would help to elaborate on WHY you want nslookup to use the /etc/hosts file?
If you look at the the name of the nslookup utility, it quite probably is an abbreviation of "nameserver lookup". That strongly suggests it is a tool for querying nameservers.
NOT a tool to debug the name lookups of your operating system.
On the platforms I use (I don't use HPUX), you can query and set the nameserver nslookup uses. I would consider it a bug if the nslookup tool uses /etc/hosts if set in nsswitch.conf.
this is how I lookup what server is set for the utility:
$ nslookup
serverDefault server: 10.0.1.1
Address: 10.0.1.1#53this is how nslookup responds to a query:
nu.nlServer:        10.0.1.1
Address:     10.0.1.1#53
Non-authoritative answer:
Name:     nu.nl
Address: 62.69.184.53
Name:     nu.nl
Address: 62.69.179.198(I don't know how the "jive quote" comes in, it is supposed to be a "bigger than" sign)

Similar Messages

  • Re-read /etc/hosts file

    Solaris 9 SPARC
    How to get system to re-read /etc/hosts file w/o rebooting
    Thanks

    There is no need for that, it will be instant.

  • Blocking Ad servers via etc/host file not working

    In Snow Leopard I add a list of ad servers and direct them to 127.0.0.1 via the /ect/host file.
    I've configured the host file on my mac mini server and it doesn't work.
    i just want to block ads when using browsers ON the Mini.
    How can I achieve this?

    Yeah; that's an old-time Windows and Unix hack.
    There are ad-blocking extensions for all major web browsers, and those are easier to manage and maintain.
    Off the top, I'd have to check the search order to see if I was getting a response from remote DNS or from /etc/hosts here.
    If you're running a Mac OS X Server box, you're hopefully also running DNS services, and if you're running DNS services, then that's going to be where this hackery gets implemented. Add bogus zones. And if DNS gets an answer from its cache, I wouldn't tend to expect it to go read /etc/hosts (for performance reasons), for that matter.
    There may well be an ad-blocking DNS server around you can forward queries to, too; I haven't looked for that.
    If you make changes to your local /etc/hosts setup, try issuing the following to clear the cache:
    dnscacheutil -flushcache
    I'd recommend installing an ad-blocker. /etc/hosts is an old-school approach and can end up causing weirdnesses on errors, particularly if your box is (also) a DNS server for your LAN. (Also realize that Apple isn't documenting the /etc/hosts file in the Mac OS X Server 10.6 networking manual.)

  • Which localhost line shuold be used in the /etc/hosts file on Solaris Sparc

    Hi There,
    I would like to know which line should be use in the /etc/hosts file:
    127.0.0.1 localhost
    127.0.0.1 localhost.localdomain localhost
    Thanks :-)
    J

    user560159 wrote:
    Hi There,
    I would like to know which line should be use in the /etc/hosts file:
    127.0.0.1 localhost
    127.0.0.1 localhost.localdomain localhost
    Thanks :-)
    JThe format for the hosts file is
    ipaddress alias1 alias2 alias3 alias4 Most shops will just have two aliases, one with just the machine name, one with the fully qualified domain.machine name. In reality, you can do whatever makes sense:
    [root@vmlnx01 ~]# cat /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality wil fail
    127.0.0.1       localhost.localdomain localhost
    [root@vmlnx01 ~]# ping localhost
    PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=1.96 ms
    [root@vmlnx01 ~]# ping localhost.localdomain
    PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.094 ms
    [root@vmlnx01 ~]# vi /etc/hosts
    <<<< adding an alias 'fred' >>>>>
    [root@vmlnx01 ~]# cat /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality wil fail
    127.0.0.1       localhost.localdomain localhost fred
    [root@vmlnx01 ~]# ping fred
    PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.306 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.093 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=3 ttl=64 time=0.092 msDoes the order of the aliases have any meaning? I leave that quick experiment as an exercise for the student.

  • How to use /etc/hosts file

    how to get Mac OS "X" 10.6.x to use /etc/hosts file and/or /etc/resolv.conf file(s) (ala Unix-style); instead of using some other mechanism?

    I 'thought' that SnowLeopard (somewhere in the "Support" arena) told me that 10.6 (SnowLeopard) did NOT use /etc/hosts, but I am corrected, and now understand through a number of replies here (Apple-Support-Discussions) and other responses that SnowLeopard (10.6 (I'm at 10.6.7) DOES USE /etc/hosts... - AND YES _ I'm attempting to prevent some things, and have some web-site-development-things go to a local-server, etc. etc. etc. - but - I guess my 'answer' was supplied by a number of people and that my ...nix background and my familiarity with /etc/hosts is fine and working well...
    thanks to one and all who helped! - I'm now also well-acquainted with dscl, dscacheutil, and other such utilities...
    THANKSSSSS!!!!!!!

  • Do I need to provide the physcial hostname to iAS during installation or can I just that installed name into the /etc/hosts file?

     

    Hi,
    Pls confirm if you are using Windows 2000 Pro, in this O/S the
    hostname is the name of the computer itself. Check the
    MyComputer->Properties->Network Identification->Properties, the name you
    find under the computer name will be automatically taken while
    installation, if it doesn't then there is some error. However the
    C:\Winnt\System32\Drivers\Etc\hosts doesn't matter much while installing
    iAS 6.0 SP1 or above. Hope this helps
    Regards
    Raj
    Hazel Seow wrote:
    Do I need to provide the physcial hostname to iAS during installation
    or can I just that installed name into the /etc/hosts file?
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Solaris10.. need to remove "::1 localhost" from /etc/hosts file

    I know i have IPV6 disabled (through install options) but i still see "::1 localhost" entry in the /etc/hosts file.. This is related to localhost with IPV6 address ::1.. why it is still there.. what is it's impact.. how can i remove it if i decide to remove..
    Thanks, appreciate help.
    S.

    It could be there if you linked /etc/hosts (or /etc/inet/hosts to /etc/inet/ipnodes). Or recreated the hosts-file from ipnodes (or it could be there by default and removed by my jumpstart, which means i would be unaware of it :-)
    And no, you don't need it if you are not running IPv6, in fact removing it will eliminate a few error messages.
    On all non-IPv6 systems i install i link /etc/inet/ipnodes to /etc/inet/hosts, in order to eliminate errors when changing IP addresses of the host and odd resolv-conflicts (which also removes any reference to ::1), and so far i have never experienced any issue with that.
    .7/M. x2000 :)

  • How could a java process bypass etc\hosts file while doing dns lookup ?

    Hi,
    I am developing a java web proxy and developer tool [http://www.tcpcatcher.org|http://www.tcpcatcher.org] .
    Right now it is working as a none transparent web proxy.
    In some situation and for some hosts, I would like to turn it into a transparent web proxy.
    Suppose, user's browser and java proxy are running on same host (typically on localhost). An entry is added in etc\hosts file, for example:
    127.0.0.1 google.com
    So without any change in browser config , if user visits google.com with its browser , http request is received at proxy level.
    Now my proxy has to get the actual ip address of google.com bypassing the etc\hosts file (right now the proxy is doing a loop on itself).
    Any idea how this could be achieved ?
    Am I searching in wrong direction ?
    thanks !

    This is a shot in the dark, but I'll try anyway.
    Take a look at dnsjava (open source, I never played with it).
    My understanding is that using this to resolve names instead of normal Java API's would allow you to bypass etc/hosts in the java code
    (see [http://old.nabble.com/DNS-Resolve-from-hosts-file-first-then-DNS-Server-td15431381.html]).

  • Is SID allowed to show up in /etc/hosts file?

    Experts:
    I am looking into a /etc/hosts which has something I never saw before.
    Every entry in that /etc/hosts file has a format as follows:
    123.23.456.678 CHERRY CHERRY.RIO.COM SID CHERRY.BRAVO.NET
    For example:
    123.23.456.678 CHERRY CHERRY.RIO.COM PRO CHERRY.BRAVO.NET
    Observation:
    0) WHY SID (here is PRD) gets into the hosts file? Would it cause some issues?
    1) each entry has 2 aliases ;
    2) "nslookup CHERRY.RIO.COM "
    2a) will return the correct IP address IF I run this nslookup on the server
    2b) will say "non-exist domain" on my PC
    3) "nslookup CHERRY.BRAVO.NET"
    3a) will say "non-exist domain" IF I run nslookup on the server
    3b) will give the correct IP address on my PC
    Thank you for help.

    Hi,
    If your system in domain than the entries look like below
    192.192.192.192    prdserver        prdserver.na.jjjjjjj.com 
    Prd server is an host name where your SAP application is running/installed &    prdserver.na.jjjjjjj.com is a hostname  in domain
    Thnaks
    Karan

  • Can SID show up in /etc/hosts file?

    Experts:
    I am looking into a /etc/hosts which has something I never saw before.
    Every entry in that /etc/hosts file has a format as follows:
    123.23.456.678   CHERRY      CHERRY.RIO.COM  SID  CHERRY.BRAVO.NET
    For example:
    123.23.456.678   CHERRY      CHERRY.RIO.COM  PRO  CHERRY.BRAVO.NET
    Observation:
    1) each entry has 2 aliases ;
    2) "nslookup CHERRY.RIO.COM "
          2a) will return the correct IP address IF I run this nslookup on the server
          2b) will say "non-exist domain" on my PC
    3) "nslookup CHERRY.BRAVO.NET"
          3a)  will say "non-exist domain"  IF I run nslookup on the server
          3b) will give the correct IP address on my PC
    4) WHY SID (here is PRD) gets into the hosts file?  Would it cause some issues?
    Thank you for help.

    Hi,
    The nslookup is trying to resolve the address via the DNS. If you are not using a DNS, you cannot resolve this hostname via your local machine.. In order to do that, you should add the entry to your local hosts file.
    I don't think there is any harm in using aliasses in that way, but it looks rather strange though..
    Ask your system administrator why the setup of the hosts file is like this. He is responsible for this..
    Kind regards,
    Mark

  • /etc/hosts file

    I was in sudo mode and wiped out my /etc/hosts file. anyone have any idea what i did, or better how to rewrite the proper text there?

    edge.it wrote:
    I was in sudo mode and wiped out my /etc/hosts file. anyone have any idea what i did, or better how to rewrite the proper text there?
    Here's what mine has in it:
    # Host Database
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    127.0.0.1 localhost
    255.255.255.255 broadcasthost
    ::1 localhost
    fe80::1%lo0 localhost
    (Remove the space at the beginning of each line. I had to add those to keep the board software from scrambling the content.)
    Here are it's permissions settings:
    -rw-r--r-- 1 root wheel 236 Jun 23 2009 /etc/hosts
    I wasn't watching you type, so I don't have any idea what you did to delete that. In Terminal the history command will show you a large number of the last commands you typed. Perhaps that will give you a clue.

  • The new entries made in /etc/hosts file is not picked up by Weblogic.

    Hi All,
    I have come across a scenario where i have changed the IP address of a particular host name (which was already present in etc/hosts) to point to a new IP address.
    After i did this change, when i do a telnet test to the same hostname, i can see it is getting connected to the new IP to which i changed. But my service which is deployed on weblogic 10.0 still keeps sending requests to the old IP which i commented in the etc/hosts file instead of the new IP address.
    My question is will weblogic cache the data in etc/hosts file somewhere?
    Thanks in anticipation..
    Madhu

    Application deployed on weblogic server will pick the IP address of the server on which the application is deployed .
    IP address or listen address for weblogic server can be configured in 3 different ways :
    Listen Address : Blank --- This means that the server will listen to all the interfaces available on the Machine .
    Listen Address : IP address or Hostname --- The server will listen only to the specified IP address or the hostname .
    Listen Address : : localhost --- The server will be listening only on localhost address and will not be accessible remotely .
    Please check what it the listen address specified at you end.
    Thanks,
    Sandeep

  • Editing etc\hosts file on windows xp for apps. problem post installation.

    Hi all,
    I was able to install 11.5.10.2 apps on my win xp prof machine. During that process I had to edit the etc/hosts file in windows directory as a work around for that domain name field during installation. Also added the primary DNS suffix as 'suneel.com' . I gave the domain name as 'suneel.com' during installation. The RapidWiz is taking localhost as the system name and referring to this system as localhost.suneel.com, though the actual system name is 'websoft-xp' .
    The host file on Apps machine has the following entries:
    127.0.0.1 localhost
    127.0.0.1 localhost.suneel.com suneel.com
    127.0.0.1 websoft-xp.suneel.com
    So when I connect to apps login server from other systems in lan, I've to edit their hosts file and add an entry for localhost.suneel.com to point to its ip address or else the apps throws an error after logging in as operations/welcome using a different url say 192.168.1.4:8000 . Is there a way to get around this issue?
    More over I'm not able connect to VIS db from other systems. The oracle clients give an error 'No listner' at this address. (The original listener was listening at localhost.suneel.com:1521). So I tried to create a new listerner from Net Manager that actually listens at websoft-xp (the real system name) but it throws me an error 'A valid log file is required' while saving the network configuration and prevents me from saving the network configuration.
    Did I do something wrong with the hosts file during installation or did i miss any entries in that file thats causing this? Any solutions for the above problems will be appreciated?
    Thanks
    Suneel
    Message was edited by:
    suneelgv

    Well I tried that option but for some reason it didn't work for me. It kept giving the tns:connection closed error. Then I searched in metalink and found this note : Note:333158.1
    It suggested setting tcp.validnode_checking = no
    in sqlnet.ora. in
    F:\oracle\visdb\9.2.0\network\admin\VIS_websoft-xp
    And it works. Hope this helps someone facing a similar problem. Good luck.
    BTW how do I run autoconfig?
    Thanks,
    Suneel Gundlapalli

  • Strange entry in the /etc/hosts file

    Hi,
    While doing some testings with my network this afternoon, I noticed that there's this strange line in my /etc/hosts file:
    ::1 localhost
    Anybody has any idea what the "::1" is for? The only thing related to network that I had recently installed is VPN Tracker. Could it be VPN Tracker that added that line to the hosts file?
    Thanks in advance for your help!
    Frank
    PowerBook G4   Mac OS X (10.4.8)  

    It's supposed to be there, here's a fresh install's complete hosts file...
    # Host Database
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    127.0.0.1 localhost
    255.255.255.255 broadcasthost
    ::1 localhost "
    Not sure what it means... may be a 16 bit number though! :-D

  • Trying to figure out how this got into my /etc/hosts file!

    Hello,
    I recently upgraded to 4.3.3 and since then I've had problems with "No Service" where my AT&T service indicator usually sits.
    Since I know that they're just going to restore my device when I take it to the apple store, I decied to start the process myself.
    I tried several times but got the "iphone could not be restored. This device isn't eligible for the requested build."
    Checked around and found that my /etc/hosts file on my mbp had been altered and now included the following:
    # Below is to bypass Apple iPhone software
    # signature server. For unlocking iPhone
    74.208.105.171  gs.apple.com
    I have no idea how this got there!  And I am concerned.  Anyone have any ideas?  Perhaps from some Mac app I downloaded?
    Thanks.

    1. Click your Finder icon from your dock.
    2. Choose "Go" from your top menu and choose "Go To Folder"
    3. Type "/etc/" and then click "go"
    4. Delete the "hosts" file and reboot the system.
    The hosts file will repopulate from system defaults during the reboot process.
    EE

Maybe you are looking for