You are not logged in.

#1 2010-03-23 08:27:02

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

[SOLVED] globbing in /etc/hosts or something similar

Is there any way to glob addresses in /etc/hosts?
If not, which seems to be the case, is there something else that could achieve a similar effect?

Example:

127.0.0.1 *.localhost # enable subdomains on localhost (with Apache virtual hosts)

It's not that tedious to manually add them and I could probably write a script, but it would be useful for other things (127.0.0.1 *.google.* tongue)

Last edited by Xyne (2010-03-24 09:04:25)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#2 2010-03-23 11:00:40

chpln
Member
From: Australia
Registered: 2009-09-17
Posts: 361

Re: [SOLVED] globbing in /etc/hosts or something similar

BIND supports DNS wildcards, which seems to be what you're after.

Just for fun I went through the process of setting this up, and it's not too difficult.  I did need to do a bit of research to figure out the syntax for the DNS zones.  Fortunately, there are plenty of resources which describe this.

Briefly, the process I went through for wildcard domain resolution:
1) Install bind and invoke named
2) Ensure the nameserver is included in resolv.conf and that the DNS service is in the host DB of /etc/nsswitch.conf
3) Edit /etc/named.conf and the corresponding zone file.

There's an article on debian-administration which focuses on exactly the case you proposed.

Last edited by chpln (2010-03-23 11:04:56)

Offline

#3 2010-03-24 09:04:10

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] globbing in /etc/hosts or something similar

Thanks chpln.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB