xp hosts file

Discussion in 'Home Networking' started by andrew, Apr 26, 2008.

  1. andrew

    andrew Guest

    I'm experimenting with blocking certain sites on my wife's xp sp2 computer,
    I wanted to divert all requests to a certain domain to google's ip address
    but for some reason the hosts file does not seem to get read on boot up, is
    there another service that takes priority over the hosts file?

    AJH
     
    andrew, Apr 26, 2008
    #1
    1. Advertisements

  2. andrew

    deKay Guest

    Do you have any anti-spyware, anti-virus or firewall software running?
    Some of these intercept host file calls. Some will even let you do what
    you're trying to achieve with the hosts file.

    deKay
     
    deKay, Apr 26, 2008
    #2
    1. Advertisements

  3. andrew

    Bernard Peek Guest

    The hosts file is read when the machine needs to do a DNS lookup rather
    than at boot time. Post details of what you are adding to the hosts file
    so that we can see what is going wrong.
     
    Bernard Peek, Apr 26, 2008
    #3
  4. andrew

    Mortimer Guest

    I've found that the hosts file on XP does get read, but on one PC, Internet
    Explorer seems to divert to a search page instead of obeying the name to
    address translation in the hosts file: I add an entry "router" with the IP
    address of my router on all my PCs as this is easier to type when I want to
    bring up the router's config pages. Firefox and Opera use the hosts entry
    correctly, and IE works fine on the other PCs (XP and W98). I wonder what
    has got misconfigured there, becaue it used to work fine.
     
    Mortimer, Apr 26, 2008
    #4
  5. andrew

    Rob Morley Guest

    Sounds like you've picked up a "Browser Helper Object" from something
    you've installed on the machine. Run a spyware/adware scanner to
    identify it. Most can be removed manually without problems.
     
    Rob Morley, Apr 27, 2008
    #5
  6. andrew

    sylva Guest


    I thought it was read at boot up and the table looked up before the
    dns was called.

    Anyway I added the last line to her hosts file in
    system32/drivers/etc:
    *************
    # Copyright (c) 1993-1999 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host
    name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    # 102.54.94.97 rhino.acme.com # source server
    # 38.25.63.10 x.acme.com # x client host

    127.0.0.1 localhost
    64.233.183.147 bbc.co.uk
    ************

    Just to see if I could divert get calls to bbc.co.uk to google

    It simply did nothing, I am posting from her pc and it has both Kerio
    and a very out of date Kapersky virus scanner running.

    AJH
     
    sylva, Apr 27, 2008
    #6
  7. andrew

    news Guest

    Which is why the from address was a very old one!

    AJH
     
    news, Apr 27, 2008
    #7
  8. andrew

    LR Guest

    The "hosts" file is loaded into "Memory cache" on start up.
    Clear your browser cache and then try going to bbc.co.uk
     
    LR, Apr 27, 2008
    #8
  9. andrew

    Bernard Peek Guest

    The problem is that there is no host called bbc.co.uk so the entry is
    being ignored. You need an entry for each host, not one for the domain.
    Try creating an entry for news.bbc.co.uk and try it again.
     
    Bernard Peek, Apr 27, 2008
    #9
  10. andrew

    LR Guest

    On my XP and vista machines putting his entry into my hosts file does
    work and redirects to Google, this was using FF and I didn't try IE.
    http://www.bbc.co.uk/
     
    LR, Apr 27, 2008
    #10
  11. andrew

    Mark Goodge Guest

    Yes, there is:

    bbc.co.uk. 300 IN A 212.58.224.131

    Mark
     
    Mark Goodge, Apr 27, 2008
    #11
  12. andrew

    andrew Guest


    Thanks for that, I'll have to run through the other programs on startup and
    see which ones may be bypassing the hosts file.

    If this is the right track any other suggestions are welcome, my
    grandaughter is 12 now so I may find the need to do this in earnest, rather
    than as a prank ;-)

    AJH
     
    andrew, Apr 27, 2008
    #12
  13. andrew

    LR Guest

    Did you try clearing your Browsers "cache" and then trying to see if the
    redirection worked?

    Are you running a "Proxy Server"? If so you will need to bypass it for
    local addresses.
     
    LR, Apr 27, 2008
    #13
  14. andrew

    Bernard Peek Guest

    The problem is that the hosts files refers to hosts not domains. You
    need an entry for each of the servers you want to block.
     
    Bernard Peek, Apr 27, 2008
    #14
  15. andrew

    news Guest

    Not to the best of my knowledge!

    Pc was inherited.

    AJH
     
    news, Apr 27, 2008
    #15
  16. andrew

    LR Guest

    when you edited the hosts file did you save it as "hosts" or "hosts.txt"?
    If "hosts.txt" you will need to rename it back to "hosts" for it to work.
     
    LR, Apr 28, 2008
    #16
  17. andrew

    andrew Guest

    Yes it was correctly saved as just hosts. I'm still floundering around
    trying to see why it doesn't work, I think I need to remove some of the
    resident processes from start up but I don't often get the opportunity to
    mess about with it whilst she's also logged on as a user.

    AJH
     
    andrew, Apr 28, 2008
    #17
  18. andrew

    LR Guest

    I have just about run out of ideas as I have nearly covered all the
    problems I have encountered. The only other thing I can think of at the
    moment is if you have more than 1 "hosts" file then the DNS query is
    looking at the wrong file.
     
    LR, Apr 29, 2008
    #18
  19. andrew

    Rob Morley Guest

    There can be only one, it is always called 'hosts' and it is always in a
    particular (OS-dependant) location.
     
    Rob Morley, Apr 29, 2008
    #19
  20. andrew

    LR Guest

    One of my relatives edited his hosts file then did a save as instead of
    just a save and ended up with "hosts" and "hosts(2)" and all DNS queries
    went to "hosts" and his attempts to do redirection failed.
     
    LR, Apr 29, 2008
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.