/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

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

    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.

  • /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?

  • 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.

  • /etc/hosts

    I guess this belongs here, if not, mods, I apologize :)
    I set up a Centos server and was browsing logfiles and noticed that instead of the usual 'localhost' string that I see in my Arch logs it had my hostname in all of the log files. After a little digging I found this on the Debian forum. I've edited my /etc/hosts how the post describes and lo and behold, after restarting syslog-ng, I get my pretty hostname in my logs. My question is, this runs contrary to how the Beginners Guide directs to set up that file and contrary to how the Arch installer sets up /etc/hosts. Did I just mess something up or is this an oversight? I didn't want to go editing wiki pages not knowing for sure. It seems like everything is running just fine on my machine now.
    For reference, here is how my /etc/hosts was:
    127.0.0.1 localhost.localdomain localhost archdesk
    This is how it is now
    127.0.0.1 archdesk localhost
    Thanks.

    The hosts file has three parts on each line. First is the ip, second the canonical (full) hostname and the third part is an optional list of aliases. In your old situation this means that the first alias (which was used for the logfile) was localhost.
    With either:
    127.0.0.1 localhost.localdomain archdesk localhost
    or:
    127.0.0.1 archdesk.localdomain archdesk localhost
    I would expect you get the desired behaviour (not 100% sure though).
    Read
    man hosts
    to learn more.

  • /etc/hosts, /etc/hostname.bgeN configuration

    I am writing this to get help.
    I have a Solaris 10 box.
    bash-3.00$ uname -a
    SunOS soft19 5.10 Generic_125100-10 sun4u sparc SUNW,Netra-240
    I have the following stuff on this box,
    bash-3.00$ cat /etc/hosts
    # Internet host table
    127.0.0.1 localhost
    10.9.48.244 soft19-bge1 Secondary
    10.9.16.121 soft19 loghost
    #10.9.48.244 soft19 Secondary
    bash-3.00$ cat /etc/hostname.bge0
    soft19
    bash-3.00$ cat /etc/hostname.bge1
    soft19-bge1
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 10.9.48.244 netmask ffffff00 broadcast X.X.X.255
    In our code base, we have the following,
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    hp->h_addr_list[0] will give 10.9.16.121
    Everything is correct here!!
    Now I change the configuration a bit,
    bash-3.00$ cat /etc/hosts
    # Internet host table
    127.0.0.1 localhost
    #10.9.48.244 soft19-bge1 Secondary
    10.9.16.121 soft19 loghost
    10.9.48.244 soft19 Secondary
    and now
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    but when I reboot the system, I get the following,
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 0.0.0.0 netmask ffffff00 broadcast X.X.X.255
    And I know this is because
    bash-3.00$ cat /etc/hostname.bge1
    soft19-bge1
    Now I change /etc/hostname.bge1 to have just soft19
    and I reboot the system and what I see is this
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    Which is correct again!
    Now my question is
    With this
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    I want to have the following,
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    How can I get this even if the system reboots?

    Hi, Thanks, but I know this. And was expecting the same.
    But my question still remains unanswered..
    How to tweak /etc/hosts and /etc/hostname.bgeN files for....
    With this code
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    I want to have the following,
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    One more thing, I want to get this all the time, even my system reboots.
    I know a method to get below [by modifying /etc/hosts file]
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    but this will not work when the system reboots? I am looking for a permanent solution.
    Thanks,
    Atul

  • 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"?

  • /etc/hosts.allow versus iptables/firewall?

    What's the relation between the /etc/hosts.allow and /etc/hosts.deny files, on the one hand, and a host firewall on the other? If I'm going to configure iptables on a machine, is there any point to having any non-trivial rules in /etc/hosts.allow and /etc/hosts.deny too? Or should I just set them to let everything connect and do all my configuration through iptables?
    (Well, really, I'm going to use some iptables-for-dummies tool like ufw or firehol.)

    I cannot agree that hosts.{allow,deny} are 'a lot more basic' They're different from iptables, they work on different level and offer different capabilities, but it would be much harder with iptables to grant/deny access according to:
    - ident lookup
    - NIS netgroup
    - domain name
    - consistent ip->name and name->ip mapping
    and so on; man 5 hosts_access and man hosts_options contain some examples. On the actions side, in addition to granting or denying access, arbitrary command can be run in parallel or instead of called service, with some useful informations about connection available as %variables.
    Tcp_wrappers do not have to be called by protected service itself; they can be used with everything that uses TCP and can be run via (x)inetd, with a little help from tcpd(8).
    I prefer iptables myself (no use in letting unwanted traffic pass any further than strictly necessary), but tcp_wrappers make a really nice and useful complementary solution.

  • 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.

Maybe you are looking for