Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Dynamic subdomains with /etc/hosts

  • 22-01-2008 05:05PM
    #1
    Registered Users, Registered Users 2 Posts: 304 ✭✭


    Hi all,

    For local development purposes I want to set up a fake domain on /etc/hosts, and preferably some subdomains.

    I.e. if I setup beaker.test in /etc/hosts to point to 127.0.0.1 I'd also like a way to have it automatically redirect phantom.beaker.test and muppet.beaker.test and www.beaker.test to my machine. In fact, I want every subdomain of beaker.test to point to 127.0.0.1

    Is this possible or do I have to do some funny things with a local dns server?

    I'm running ubuntu, and this is the relavent extract from nsswitch.conf:
    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
    

    Thanks
    Aoife


Comments

  • Registered Users, Registered Users 2 Posts: 16,287 ✭✭✭✭ntlbell


    You can do it with the hosts file.


  • Registered Users, Registered Users 2 Posts: 304 ✭✭PhantomBeaker


    Ok, cool. The next trick is how.

    I've tried
    127.0.0.1 beaker.test
    and
    127.0.0.1 *.beaker.test

    If I try to go to notInHostFile.beaker.test I still don't connect to 127.0.0.1

    So I'm probably missing something painfully obvious, but I can't find it in hosts(5) and I can't quite find the right term for google.

    Thanks,
    Aoife


  • Registered Users, Registered Users 2 Posts: 16,287 ✭✭✭✭ntlbell


    sorry I missed the "dynamic" part my bad.

    With /etc/hosts you will have to add each subdomain you want as a separate entity within the hosts file.

    Sorry for the confusion.

    or you could setup bind.


Advertisement