Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

currently I am having to directly type the subdomains like: sub1.livejournal.com sub2.livejournal.com sub3.livejournal.com


I tried *.livejournal.com

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

share|improve this question
The word you are looking for is domain. – Steve-o Aug 25 '11 at 8:58
ok, that's not possible. Got it. – bakytn Aug 25 '11 at 9:04
up vote 4 down vote accepted

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.

share|improve this answer

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
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.