/etc/hosts is ignored

I configured my computer to use tor and dnsmasq to resolve dns queries exactly how the arch wiki said to. This seems to work fine, however, when I try to add a entry into /etc/hosts it is ignored. To fix this I tried commenting out no-resolv but it did no good. Why is it ignoring my /etc/hosts file?
Here is my /etc/hosts file:
# /etc/hosts: static lookup table for host names
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
0.0.0.0 facebook.com
# End of file
Facebook.com still works...
Last edited by SteveDeFacto (2013-12-21 21:20:47)

WonderWoofy wrote:If you are using dnsmasq, why not just put it in your dnsmasq.conf?  The formatting will obviously be different, but if that is what is resolving the dns, it would make more sense to put it there.
Actually, the main reason I was trying to modify /etc/hosts is because I am wanting to build a decentralized peer-to-peer service. I need to redirect the user to localhost upon entering a url with ".mydomain" The only way I can think to do this is to add an entry into /etc/hosts.
I just happen to be using tor/dnsmasq so my thought is that modifying /etc/hosts won't always work for people with abnormal dns configurations. I would like to understand why it is not working more than just finding a work around.

Similar Messages

  • /etc/hosts.deny ignored

    Hey all!
    I've tried to secure my sshd by running denyhosts (http://www.archlinux.org/packages/search/?q=denyhosts).
    denyhosts works perfectly and adds alot of adresses to /etc/hosts.deny
    But my system ignores /etc/hosts.deny: I still got my sshd-logs full of connections from the same IP.
    Don't worry, I've tried it with my PC: same result.
    I've added my IP by hand: same result.
    Why is my /etc/hosts.deny ignored? What can I do?
    Regards,
    Moritz

    i.e.
    Sep 1 20:38:10 linux sshd[9343]: Invalid user brand from 219.254.35.183
    Sep 1 20:38:13 linux sshd[9345]: Invalid user client from 219.254.35.183
    Sep 1 20:38:16 linux sshd[9347]: Invalid user corp from 219.254.35.183
    Sep 1 20:38:19 linux sshd[9349]: Invalid user content from 219.254.35.183
    Sep 1 20:38:21 linux sshd[9351]: Invalid user contact from 219.254.35.183
    Sep 1 20:38:24 linux sshd[9353]: Invalid user coach from 219.254.35.183
    Sep 1 20:38:27 linux sshd[9355]: Invalid user career from 219.254.35.183
    Sep 1 20:38:30 linux sshd[9357]: Invalid user chat from 219.254.35.183
    Sep 1 20:38:33 linux sshd[9359]: Invalid user dibalo from 219.254.35.183
    Sep 1 20:38:36 linux sshd[9361]: Invalid user download from 219.254.35.183
    Sep 1 20:38:39 linux sshd[9363]: Invalid user complainst from 219.254.35.183
    Sep 1 20:38:42 linux sshd[9365]: Invalid user sales from 219.254.35.183
    Sep 1 20:38:45 linux sshd[9367]: Invalid user email from 219.254.35.183
    Sep 1 20:38:48 linux sshd[9369]: Invalid user emails from 219.254.35.183
    but
    # grep 219.254.35.183 hosts.deny
    # DenyHosts: Fri Jun 30 11:46:20 2006 | ALL: 219.254.35.183
    ALL: 219.254.35.183

  • /etc/hosts is ignored by everything

    Here is the current `/etc/hosts`
    # 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
    # couchapps
    127.0.0.1    projects board
    I've tried all the possible solutions:
    restarts
    resetting it to "factory state"
    clearing browser cache
      (ping and curl have no caches, but they also ignore it)
    dscacheutil -flushcache
    sudo chmod 664 /etc/hosts
    sudo chown root:wheel /etc/hosts
    Nothing. Only the `localhost` is working.
    No idea why.

    The question is answered!
    the blame goes to old orthodox line-breaks (CR)
    i've switched to Unix-style (LF) and it's fine.
    // SublimeText2 Menu: View –> Line Endings –> Unix

  • /etc/hosts entries ignored

    My Mac Pro, OSX 10.5.8, is ignoring entries in the /etc/hosts/ file. I have been all over the net and not found the definitive solution to this for 10.5.8
    I know that 10.5.8 does not use /etc/resolv.conf in the expected way, so adding at the top of resolv.conf the line 'order hosts/bind' does not work.
    This is a super handy trick for the work I do (I do lots of conversions and migrations of websites and databases) and I have come to depend on my Mac resolving from the hosts file first, before going on to normal DNS.
    Any pointers would be very helpful.
    -Bosco

    That is probably because the *NetInfo Manager* application is no longer used. I use host file entries for ad blocking (in Snow Leopard, too), and it works just fine.
    The OP may have improper entries or is doing something like using a text file with non-Unix line endings, but without further feedback it is hard to say.

  • /etc/hosts file ignored

    I'm having a strange problem with the hosts file
    I've edited my hosts file so I can work with a local machine for testing.
    The entry in the hosts file is honoured for about 30 seconds or for as long as I ping it.
    As soon as I stop pinging it, it reverts to the DNS entry and ignores etc/hosts
    If I then touch hosts, it wil honour the entry again for 30 odd seconds.
    Any ideas?

    When it reverts to the DNS entry, I'm not 100% sure DirectoryService is making a request out to our DNS servers or if it's cached somewhere, but it's certainly not using what's in hosts.
    Wow, this is odd. WRT DirectoryService making requests, you can use the "dscacheutil" command to look at syscall stats. This utility will track cache hits, cache misses and external calls for each standard system call it monitors. So, you care about gethostbyname(), so by periodically running dscacheutil, then doing name lookups (i.e. with ping or whatever), you can see where the system is getting the data. You'd want to run something like this:
    dscacheutil -statistics | grep gethostbyname

  • Sshd ignores /etc/hosts.allow and /etc/hosts.deny

    Hello everyone,
    I've just found out that sshd ignores /etc/hosts.allow and /etc/hosts.deny completely on my machine. It doesn't make use of tcp_wrappers. I am using the standard Arch package. Either my settings are wrong, or this is a severe security problem. It was a terrible surprise to find out that my server is under severe dictionary attacks all the time, despite the denyhosts script I am using.
    These are my settings:
    /etc/hosts.deny:
    ALL: ALL
    /etc/hosts.allow:
    # some nfs daemons: 192.168.1.0/255.255.255.0
    sshd sshd1 sshd2: ALL EXCEPT /etc/hosts.evil
    mysqld: 192.168.1.0/255.255.255.0
    /etc/hosts.evil:
    195.113.21.131
    60.10.6.53
    A simple experiment to verify the settings:
    [root@charon etc]# tcpdmatch -d -i /etc/xinetd.conf sshd 195.113.21.131
    warning: sshd: no such process name in /etc/xinetd.conf
    client: address 195.113.21.131
    server: process sshd
    matched: hosts.deny line 5
    access: denied
    [root@charon etc]# tcpdmatch -d -i /etc/xinetd.conf sshd 195.113.21.130
    warning: sshd: no such process name in /etc/xinetd.conf
    client: address 195.113.21.130
    server: process sshd
    matched: hosts.allow line 10
    access: granted
    This seems to be fine. But when I go to the machine 195.113.21.131, I can simply log in with no trouble at all.
    This is really strange. Does it have something to do with the xinetd warning? I am not using xinetd... Maybe I'm doing something wrong. If you have experienced such a trouble, please give me a hint.

    elasticdog wrote:So should our package not have the ListenAddress 0.0.0.0 line uncommented by default?  My guess would be that since it listens on all local addresses by default, we're just overwriting that when specifying 0.0.0.0, which isn't valid.  That was users don't have to specify their local IP address.  Unless I'm wrong, shouldn't this be a bug/feature request for the packager?
    This doesn't seem to be a package bug... IMHO, sshd must respect all the settings in hosts.deny and hosts.allow, regardless the IP address it listens on. The behaviour I noticed seems to be much more complicated. Basic settings (daemon name mentioned in hosts.*) worked, as far as I didn't want a "per IP" configuration. For example, including the daemon in hosts.allow really enabled remote connections, but any closer specifications (subdomains, EXCEPT operator...) were ignored. Access was simply granted without further evaluation. Excluding sshd from hosts.allow worked as one would assume. When I specified ListenAddress, everything started to work properly. This is mysterious. There are millions of computers using tcp wrappers and ssh, so it's hard to believe there could be a bug.

  • Pacman ignores /etc/hosts

    I use csslayer-aur-repo which is placed on googlecode.com server, however csslayer-aur-repo.googlecode.com sometimes returns IP of server which doesn't seem to have csslayer-aur-repo.db.tar.gz file. As a workaround i've put csslayer-aur-repo.googlecode.com in /etc/hosts with an IP which works just fine. I've tested it with wget and ping, and both of them seem to use this "new" IP address. However pacman seems to ignore /etc/hosts and picks that random IP which mostly leads to "404 not found" error when doing pacman -Syu/Syy/Sy.
    Here is my /etc/hosts
    # /etc/hosts: static lookup table for host names
    #<ip-address> <hostname.domain.org> <hostname>
    127.0.0.1 localhost.localdomain localhost Archie
    209.85.135.82 csslayer-aur-repo.googlecode.com
    # End of file
    and here is the repo entry from pacman.conf:
    [csslayer-aur-repo]
    Server = http://csslayer-aur-repo.googlecode.com/files

    Yup, wget fetches http://csslayer-aur-repo.googlecode.com … .db.tar.gz just fine and it uses the IP specified in /etc/hosts.
    Surely pacman does not deploy its own DNS server, but seems to ignore /etc/hosts. If i remove csslayer line from /etc/hosts then wget also will fail.
    [hash@Archie ~]$ wget http://csslayer-aur-repo.googlecode.com/files/csslayer-aur-repo.db.tar.gz
    --2010-07-26 18:54:29-- http://csslayer-aur-repo.googlecode.com/files/csslayer-aur-repo.db.tar.gz
    Translacja csslayer-aur-repo.googlecode.com... 209.85.135.82
    Łączenie się z csslayer-aur-repo.googlecode.com|209.85.135.82|:80... połączono.
    Żądanie HTTP wysłano, oczekiwanie na odpowiedź... 200 OK
    Długość: 1190 (1,2K) [application/x-gzip]
    Zapis do: `csslayer-aur-repo.db.tar.gz'
    100%[=============================================================================================================================================================================>] 1.190 --.-K/s w 0,02s
    2010-07-26 18:54:30 (72,5 KB/s) - zapisano `csslayer-aur-repo.db.tar.gz' [1190/1190]
    [hash@Archie ~]$ pacman -Syu
    :: Synchronizing package databases...
    kde-unstable is up to date
    core is up to date
    extra is up to date
    community is up to date
    error: nie udało się pobrać pliku 'csslayer-aur-repo.db.tar.gz' z csslayer-aur-repo.googlecode.com : Not Found
    error: failed to update csslayer-aur-repo (Not Found)
    Last edited by hash (2010-07-26 16:55:47)

  • Leopard: /etc/hosts is ALWAYS ignored

    Hi all. I can't seem to find an answer to this anywhere on the net. Can anyone tell me why, in Leopard, my /etc/hosts file would be completely ignored. It doesn't matter what I put in it, it seems to never be read. I've tried using dnscacheutil to empty the cache and all that. Nothing seems to help. And I can't find anywhere how I can tell Leopard the order in which to try hostname lookups (hosts first, then DNS). Any ideas?
    Thanks
    --Dan

    can you post your /etc/hosts file, or a subset (maybe replace IP addresses with nn.nn.nn.nn).
    If you use
    file /etc/hosts
    do you see
    /etc/hosts: ASCII English text
    or
    /etc/hosts: ASCII text, with CR line terminators
    or
    /etc/hosts: ASCII text, with CRLF line terminators
    Have you tried to install and/or run your own DNS server on your Mac?

  • How to save etc/hosts

    Hi all,
    Please help sorting my terminal, I'm having problem with my iTune everytime I want to update or restore my ipad or iphone, it keep saying "this device isn't eligible for the requested build"
    Now I tried to edit the etc/hosts using the Terminal, but suddenly all the script
    # 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
    #74.208.10.249 gs.apple.com
    #127.0.0.1 gs.apple.com
    are all gone i think i accidentally deleted it. so what I did was I copy this from forum and paste it to terminal.
    But i'm having problem how to save it, when I press ^O it goes like this:
    # 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
    #74.208.10.249 gs.apple.com
    #127.0.0.1 gs.apple.com
    File Name to Write: etc/hosts                                                
    ^G Get Help         ^T To Files         M-M Mac Format      M-P Prepend
    ^C Cancel           M-D DOS Format      M-A Append          M-B Backup File
    and I dont know how to save it. when I press ^X doesn't save at all.
    Please Help me.
    Thank you in advance.

    Well lets make things easier, get out of Terminal by just Quiting it or Force Quit.
    Download the free TextWrangler here
    http://www.barebones.com/products/textwrangler/download.html
    Now under the File Menu >Open File by Name
    /etc/hosts
    It should look like this, if not then just copy and paste it in.
    # 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
    Now save it and give it your admin password and that's it. Easy as pie.
    Terminal's pico and vi editing programs have a lot to be desired, but serve the basic puposes.
    With Terminal you need to enter
    sudo pico /etc/hosts
    then enter your admin password to access a system file.
    It can only be done via a Admin account, however with TextWrangler not only is it much easier, you can also access system files from a Standard user account.
    the two lines
    #74.208.10.249 gs.apple.com
    #127.0.0.1 gs.apple.com
    You have there are "commented out" with the "#" symbol, basically your telling the computer to "ignore this line"
    Why you think messing with your /etc/hosts file is going to solve your primary issue with iTunes/iPad/iPhone is beyond me.
    Did you ever think that perhaps your two devices are too old for the "requested build"?

  • Tcp wrappers /etc/hosts.allow format

    since most of the services that were originally run from
    the /etc/inet/inetd.conf file on pre-Solaris 10 systems
    are now run from smf, what are the "in.*" service names
    that should be placed in the /etc/hosts.allow file?
    also is there a "safe_finger" available for use that can
    be used in the /etc/hosts.deny file or should the
    "standard" Solaris 10 finger be used?
    Thanks

    elasticdog wrote:So should our package not have the ListenAddress 0.0.0.0 line uncommented by default?  My guess would be that since it listens on all local addresses by default, we're just overwriting that when specifying 0.0.0.0, which isn't valid.  That was users don't have to specify their local IP address.  Unless I'm wrong, shouldn't this be a bug/feature request for the packager?
    This doesn't seem to be a package bug... IMHO, sshd must respect all the settings in hosts.deny and hosts.allow, regardless the IP address it listens on. The behaviour I noticed seems to be much more complicated. Basic settings (daemon name mentioned in hosts.*) worked, as far as I didn't want a "per IP" configuration. For example, including the daemon in hosts.allow really enabled remote connections, but any closer specifications (subdomains, EXCEPT operator...) were ignored. Access was simply granted without further evaluation. Excluding sshd from hosts.allow worked as one would assume. When I specified ListenAddress, everything started to work properly. This is mysterious. There are millions of computers using tcp wrappers and ssh, so it's hard to believe there could be a bug.

  • Entries in /etc/hosts are being ingored.

    I added 
    209.132.176.175 bugzilla.gnome.org
    to /etc/hosts and restarted Xserver, network service and my pppoe connection.
    And the entry in /etc/hosts is is being ignored. Any idea how to debug this weird behavior?

    Ah, now I see what your problem is :-)
    What if you ping bugzilla.gnome.org? Does that reach 209.132.176.175?
    -edit-
    It seems that Firefox simply doesn't use /etc/hosts at all. Solution (if don't want to wait for your DNS servers to get updated): install dnsmasq, cp /etc/resolv.conf /etc/resolv.conf.2, change nameserver in resolv.conf to 127.0.0.1, change resolv-file to resolv.conf.2 and add bugzilla.gnome.org to address field in dnsmasq.conf and start /etc/rc.d/dnsmasq. You'd have to make sure ppooe doesn't overwrite resolv.conf (it'd have to write to resolv.conf.2). Additional benefit: local caching of DNS queries (=> faster browsing).
    Last edited by lucke (2007-10-21 23:23:42)

  • Certain files excluded (e.g. /etc/hosts) ?

    On our network we have several machines that we just put in our local /etc/hosts file. A coworker recently restored from a Time Machine backup and it didn't restore his /etc/hosts file. That's fine since others have that same information.
    Leaving aside the question of whether we put those servers in our dns server...
    I am a .mac subscriber and am used to using Backup which is predictable. Does anyone know if there are certain default exceptions for Time Machine - that it does not back up? That might be useful in case I have system files that I actually want to keep the way they are or back up separately.

    There are certain files/file_types that TM ignores, like things in the trash and, I think, caches. Exactly which ones, I don't know.

  • SCAN LISTENER runs from only one node at a time from /etc/hosts !

    Dear all ,
    Recently I have to configure RAC in oracle 11g(r2) in AIX 6.1 . Since in this moment it is not possible to configure DNS, so I dont use SCAN ip into the DNS/GNS, I just add the SCAN ip into the host file like :
    cat /etc/hosts
    SCAN 172.17.0.22
    Got the info from : http://www.freeoraclehelp.com/2011/12/scan-setup-for-oracle-11g-release211gr2.html#ORACLE11GR2RACINS
    After configuring all the steps of RAC , Every services are ok except SCAN_LISTENER . This listener is up only one node at a time . First time when I chek it from node1 , it shows :
    srvctl status scan_listener
    SCAN listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is running on node dcdbsvr1
    now when I relocate it from node 2 using
    "srvctl relocate scan -i 1-n DCDBSVR2" , then the output shows :
    srvctl status scan_listener
    SCAN listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is running on node dcdbsvr2
    Baring these , we have to try to relocate it from the node2 by the following way, then it shows the error :
    srvctl relocate scan -i 2 -n DCDBSVR2
    resource ora.scan2.vip does not exists
    Now my question , How can I run the SCAN and SCAN_LISTENER both of the NODES ?
    Here is my listener file (which is in the GRID home location) configuration :
    Listener File OF NODE1 AND NODE 2:
    ==================================
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON
    LISTENER_SCAN1 =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER_SCAN1)
    ADR_BASE_LISTENER_SCAN1 = /U01/APP/ORACLE
    2)
    Another issue , when I give the command : " ifconfig -a " , then it shows the SCAN ip either node1 or node2 . suppose if the SCAN ip is in the node1 , and then if I run the "relocate" command from node2 , the ip goes to the Node 2 . is it a correct situation ? advice plz ... ...
    thx in advance .. ...
    Edited by: shipon_97 on Jan 10, 2012 7:22 AM
    Edited by: shipon_97 on Jan 10, 2012 7:31 AM

    After configuring all the steps of RAC , Every services are ok except SCAN_LISTENER . This listener is up only one node at a time . First time when I chek it from node1 , it shows :If I am not wrong and after looking at the document you sent, you will be able to use only once scan in case you use /etc/host file and this will be up on only one node where you added this scan entry in /etc/hosts file.
    Now my question , How can I run the SCAN and SCAN_LISTENER both of the NODES ?Probably you can't in your case, you might run only one i think and on one node only
    srvctl status scan_listener
    SCAN listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is running on node dcdbsvr1
    now when I relocate it from node 2 using
    "srvctl relocate scan -i 1 -n DCDBSVR2" , then the output shows :
    srvctl status scan_listener
    SCAN listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is running on node dcdbsvr2You moved scan listener from node 1 to node 2, OK
    Baring these , we have to try to relocate it from the node2 by the following way, then it shows the error :
    srvctl relocate scan -i 2 -n DCDBSVR2
    resource ora.scan2.vip does not exists
    --------------------------------------------------------------------------------Since you have only one scan, you can't relocate "2". So ise "1" instead here also
    FYI
    http://www.oracle.com/technetwork/database/clustering/overview/scan-129069.pdf
    Salman

  • Adding the /etc/host.deny file like linux in solaris 10.

    Dears,
    I need to add a file which will works like the file of /etc/hosts.deny of Linux in Solaris.
    If it is possible in the same manner please let me know that, and if it need some other trick to deny a specific host to access the system please tell me the way to do that.
    Eagerly waiting to hear from you.
    BR//
    Sohel.

    IPfilter can deny a specific IP address access to the host - enable IPFilter with svcadm and edit the /etc/ipf/ipf.conf file to add the IP to block. An example could be:
    block in log quick on bnx0 proto tcp from 192.168.1.5/32 to any
    I use IPfilter to pass and block all sorts of specific IP addresses as well as block/allow specific ports (like only specific hosts can use port 22, ssh).

  • 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

Maybe you are looking for

  • Report for Average Cost of Inventory?

    Is there a report which can be run to see the average price of all inventory? Or even for inventory which in considered historical (already sold a few months ago). thanks, Mike

  • How does the license work? Confused here

    Ok this is a dumb question. But please tell me if my understanding is correct. 1. SAP Business One 2005 and 2007 have similar license method based on hardware key? We got hardware key, give to SAP, and we got license key back to us and install? 2. Wh

  • Short dump in r/3 in delta extraction

    Hi all, Today we got short dump in R/3 for delta extraction of data source 2LIS_13_VDITM.We want these data to do month end analysis. I have tried to run extraction checker (rsa3) still it gives me short dump for the same. SAP r/3 4.6c and bw 3.5 Reg

  • JPA EntityManager connection

    Hi, I'm trying to get into the Java Persistence Api, so I came up with these questions: I'm planning to use it in a existing db desktop application, currently using java.sql.connection object to query the mysql server. May I share the connection betw

  • Problem LR 5 Using HDR

    I just installed LR 5 and want to process an HDR photo in CS 5.  When I select CS 5 on the "Edit In" the HDR option is greyed out.  If I try to just process a photo in CS 5 I get a message that "This version of Lightroom may require the Photoshop Cam