6

I would like to set one IP for a zone (livejournal.com)

currently I am having to directly type the subdomains like:

11.11.11.11 sub1.livejournal.com
11.11.11.11 sub2.livejournal.com
11.11.11.11 sub3.livejournal.com

etc.

I tried

11.11.11.11 *.livejournal.com

and

11.11.11.11 .livejournal.com

didn't help.

So I want to have only one line and resolve missing subdomains to IP like: sub1000.livejournal.com without explicitly specifying it

2
  • The word you are looking for is domain.
    – Steve-o
    Commented Aug 25, 2011 at 8:58
  • ok, that's not possible. Got it.
    – bakytn
    Commented Aug 25, 2011 at 9:04

3 Answers 3

8

No, it is not possible to use wildcards in /etc/hosts.

It is, however, possible to list multiple hosts on a single line so you don't have to keep copying the IP part, just append new hosts to the line:

11.11.11 sub1.livejournal.com sub2.livejournal.com sub3.livejournal.com
5

Not possible. Each entry in /etc/hosts maps an address to one or more specific hostnames. There is no way to do a wildcard mapping as you desire; use a DNS server instead.

4

This can be implemented with a DNS forwarder than acts like a very basic DNS server. The popular implementation is Dnsmaq, however this might be possible with services like OpenDNS that can perform DNS filtering for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .