Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Ubuntu ignoring /etc/hosts file 10.04

  1. #1
    Join Date
    Apr 2009
    Beans
    11

    Ubuntu ignoring /etc/hosts file 10.04

    I'm trying to use the /etc/hosts file for adblocking, but both firefox and opera seem to ignore it on my setup. I've messed around with this install a bit, but nothing with the networking.

    I've searched the forums for a few reasons this might be happening - I've verified that the permissions on hosts and nsswitch.conf file allow them to be read by everyone (644).

    I can successfully ping localhost, if that matters.

    My hosts file looks like this, truncated of course, and it terminates in a blank line. The blank line didn't make a difference, but I read a post that suggested it would, so I added that. I also added the third entry 'test' just to verify that the hosts file wasn't being looked at at all, and it was unable to resolve through ping.

    127.0.0.1 localhost
    127.0.1.1 inazuma-desktop
    127.0.0.1 test

    # The following lines are desirable for IPv6 capable hosts
    ::1 localhost ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts

    #start of lines added by WinHelp2002
    # [Misc A - Z]
    127.0.0.1 fr.a2dfp.net
    127.0.0.1 m.fr.a2dfp.net
    127.0.0.1 ad.a8.net
    127.0.0.1 asy.a8ww.net
    127.0.0.1 abcstats.com
    127.0.0.1 a.abv.bg
    The contents of my nsswitch.conf
    # /etc/nsswitch.conf
    #
    # Example configuration of GNU Name Service Switch functionality.
    # If you have the `glibc-doc-reference' and `info' packages installed, try:
    # `info libc "Name Service Switch"' for information about this file.

    passwd: compat
    group: compat
    shadow: compat

    hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
    networks: files

    protocols: db files
    services: db files
    ethers: db files
    rpc: db files

    netgroup: nis
    resolv.conf
    # Generated by NetworkManager
    domain austin.rr.com
    search austin.rr.com
    nameserver 192.168.0.1
    hosts.conf
    # The "order" line is only used by old versions of the C library.
    order hosts,bind
    multi on
    I'm a newbie to all of this, all the above information I got from searching the forums for this same request.. none of the resolutions I found helped me, though. If anyone has any ideas on how to fix this, please let me know!

  2. #2
    Join Date
    Apr 2008
    Location
    Australia
    Beans
    228
    Distro
    Ubuntu Development Release

    Re: Ubuntu ignoring /etc/hosts file 10.04

    Another suggestion would be to install adblock plugin in firefox

  3. #3
    Join Date
    Apr 2009
    Beans
    11

    Re: Ubuntu ignoring /etc/hosts file 10.04

    I don't want to use firefox; if and when I do I'd still like to be able to use the hosts file for an added layer of security. Any ideas on why my system isn't using the hosts file?

  4. #4
    Join Date
    Apr 2009
    Beans
    11

    Re: Ubuntu ignoring /etc/hosts file 10.04

    I'm still having this problem. I've read since I posted that if I have windows carriage returns in the file it could keep it from being read properly.. is there a way I can check to see if that's the case?

  5. #5
    Join Date
    Jan 2010
    Location
    opposing reality (VIC AU)
    Beans
    990
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu ignoring /etc/hosts file 10.04

    Open the file using gedit
    Code:
    gksudo gedit /etc/hosts
    and then choose 'File'->'Save As'. In the dialog box that opens look along the bottom line and see 'encoding' and 'line-ending' options ->choose-> "Current Locale ()" & "Unix/Linux" and then click the 'save' button.

    Does that make the difference?

    You may need to close your browser (check "System"->"Administration"->"System Monitor"=>"Processes" to make sure it quit) and then re-open to clear it's DNS cache.
    NEED HELP? | [SOLVED] | MS hide
    A little nonsense now and then...
    .
    If this is a game thread and you are going to post I hope you have read the Original Post.

  6. #6
    Join Date
    Apr 2009
    Beans
    11

    Re: Ubuntu ignoring /etc/hosts file 10.04

    Now that's interesting.. navigating to the file by selecting the partition, then /etc , and then 'hosts' gives me my file as I expected to see it, while gksudo gedit /etc/hosts gave me the unedited file! I completely restarted my system since I made the change, and I was certain it had been saved.. in fact, through the file browser, it still shows the size at 600 k.

    Editing the file through that view, I was able to add the test line and it pinged fine, and adding my adblocking entries there worked.

    Now I'm really stumped though! I've left different entries in both files to verify they are different, and they are.. the hosts file I reached through the command lines entries work, the ones I reached through the GUI do not.

    ANY idea why that might be?

  7. #7
    Join Date
    Jan 2010
    Location
    opposing reality (VIC AU)
    Beans
    990
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu ignoring /etc/hosts file 10.04

    I can only suggest that perhaps you have an extra partition with an /etc in it

    How/where are you selecting this partition you speak of?
    NEED HELP? | [SOLVED] | MS hide
    A little nonsense now and then...
    .
    If this is a game thread and you are going to post I hope you have read the Original Post.

  8. #8
    Join Date
    Apr 2009
    Beans
    11

    Re: Ubuntu ignoring /etc/hosts file 10.04

    Yeeeep, that's the case. Of all the things I looked at.. that was it. Thanks for the help!

  9. #9
    Join Date
    Sep 2008
    Beans
    1

    Re: Ubuntu ignoring /etc/hosts file 10.04

    Quote Originally Posted by robsoles View Post
    I can only suggest that perhaps you have an extra partition with an /etc in it

    How/where are you selecting this partition you speak of?
    Rob this response you gave another user closely resembles my problem. I open terminal window and type sudo gedit /ect/hosts to add a line. When gedit opens it is a blank page. I'm wondering if maybe this is because I run a dual boot system with winXP. If I have to direct the command to the partition and then the file system of Ubuntu I'm going to need help as I've never done this. I'm just trying to add a line for the iesnare mpsnare, but so far haven't found any advice that will make the edit work.

  10. #10
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Ubuntu ignoring /etc/hosts file 10.04

    Quote Originally Posted by LoneWolf218 View Post
    ...

    I open terminal window and type sudo gedit /ect/hosts to add a line. When gedit opens it is a blank page...
    Try /etc/hosts.
    -BAB1

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •