hosts file wildcard setting??
Results 1 to 10 of 10

Thread: hosts file wildcard setting??

  1. #1
    Join Date
    Mar 1999
    Location
    mpls
    Posts
    408

    hosts file wildcard setting??

    Is there a way to put in a wild card setting in the hosts file? (WinNT/2000).

    ie- can I remove the DNS settings from a machine, then in the hosts file add the specific ip addresses and URL names a user should be able to contact, and then have a setting like:

    10.0.0.1 www.*.com

    So that any other URL entered will hit 10.0.0.1?

    This would make it possible to lock down a machine from entering unauthorized websites (unless the user was savvy enough to use a specific IP address for a site - I'm not concerned about that just yet).

    (Oh, and I tried the above example, it doesn't work).
    ...this one goes to 11...

  2. #2
    Join Date
    Jun 2001
    Location
    Albuquerque, NM USA
    Posts
    14,686
    RingoSaturn--I do not believe the HOSTS file accepts wildcards. You might learn here
    http://www.smartin-designs.com/
    Jim
    WIN7 Ultimate SP1 64bit, IE 11, NTFS,
    cable, MS Security Essentials, Windows 7 firewall

  3. #3
    Join Date
    Sep 1998
    Location
    Albuquerque, NM
    Posts
    2,546
    Actually you don't need to use wildcards. Just leave off the part that is supposed to be wildcarded. If you want to direct ALL .com sites to 10.0.0.1 then you just need to put this:

    10.0.0.1 .com

    If you're trying to block ALL websites, then be sure to add seperate entries for .org, .net, etc.

    I believe (someone correct me if I'm wrong) that the rules are applied in order. That is, if there is a specific site you want to direct access to you need to put it BEFORE the generic ".com" entry. It may work such that any address entered is matched against the first entry and if it does not apply, it keeps moving on down the line until it hits ".com" and is thus redirected to 10.0.0.1.

  4. #4
    Join Date
    Mar 1999
    Location
    mpls
    Posts
    408
    Thanks for the idea sourdaisy, unfortunately it didn't work. I tried a couple of derivations of what you suggested and nothing seemed to work. It looks like the hosts file is using a literal text translation of whatever gets typed in there. In other words, I can put the letter "a" after an IP address, and then type "a" into the browser, and it will come up with the site. In other words, putting ".com" in will only take care of the instance of someone typing in ".com" in the address field in there browser, with no other text.

    So, I'm losing hope that there is a solution for this.
    ...this one goes to 11...

  5. #5
    Join Date
    Dec 2000
    Location
    Dallas, TX USA
    Posts
    2,916
    I can't find the documentation at the moment but I'm sure I read that the hosts file does not support wild cards. Only exact matches work.

  6. #6
    Join Date
    Mar 2001
    Location
    East Coast
    Posts
    641
    Hosts files can not use wildcards. But, Contnet Advisor can and does use wildcards, It is worth a look.

    p.s. You should try using 0.0.0.0 as your hosts file block IP. If you use 127.0.0.1, the website will be search for a server on your local computer since it is a valid IP. If you use 0.0.0.0, it is immediatley recognized as a valid format, yet an invalid IP and your computer does not search for the site (windows only).

    ...dauf

  7. #7
    Join Date
    Mar 1999
    Location
    mpls
    Posts
    408
    I'll have to look into content advisor. I'm actually directing it to the IP address of a specific web-site, not just blocking the page. That way, it redirects requests back to that specific site. It sounds a little screwy, but I do have my reasons.


    And it looks like you guys are right about no wildcard setting. Which is too bad, but oh well.

    Thanks
    ...this one goes to 11...

  8. #8
    Join Date
    Aug 2000
    Location
    Hayward, CA, USA, EARTH
    Posts
    1,852
    A very simple method of disabling the browser is to make the PROXY server the address of a web server (or not). What I do is set the proxy server to = the Intranet server. Then the user can get to our Intranet but nowhere else (no matter what URL they type in they get the Intranet).
    AsusA7N8X, AthlonXP2200
    gForce4600+ti & Audigy Platnium, FPS SOUND. AKA- The ultimate gaming machine (well it WAS three years ago anyway).

  9. #9
    Join Date
    Mar 1999
    Location
    mpls
    Posts
    408
    Patweb - I just recently ran accross that suggestion elsewhere, as well. I haven't had time to try it yet, but it sounds like the way you're using it is exactly what I had in mind.

    Thanks for the info.
    ...this one goes to 11...

  10. #10
    Join Date
    Apr 2009
    Posts
    1
    Quote Originally Posted by sourdaisy View Post
    Actually you don't need to use wildcards. Just leave off the part that is supposed to be wildcarded. If you want to direct ALL .com sites to 10.0.0.1 then you just need to put this:

    10.0.0.1 .com

    If you're trying to block ALL websites, then be sure to add seperate entries for .org, .net, etc.

    I believe (someone correct me if I'm wrong) that the rules are applied in order. That is, if there is a specific site you want to direct access to you need to put it BEFORE the generic ".com" entry. It may work such that any address entered is matched against the first entry and if it does not apply, it keeps moving on down the line until it hits ".com" and is thus redirected to 10.0.0.1.
    Sorry for replying this old dead topic - just stumbled upon while I was searching for the answers to the same problem. sourdaisy's solution works quite well, guess the original poster of the question missed to clean his/her DNS cache, say with command such as "ipconfig /flushdns" . Anyway, the solution above works 100%.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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