4

Is it possible to have more than one ".local" address per machine using Bonjour on OSX? I would like to add x.local and archive.x.local so that I can run multiple apache vhosts.

System Preferences > Sharing > Computer Name only allows me to have one currently.

mike
  • 41
  • 2

2 Answers2

2

There is no GUI in OS X to have more than one .local hostname for a machine.

However, you can register programmatically any number of name and service combinations in the mDNS .local domain.

If you're looking to do this from a script (or on a temporary basis, manually), there is a command-line utility dns-sd, which you can use to register services. (man dns-sd for the man page).

To register a web server, you'll want to use something like:

dns-sd -R <name> _http._tcp local <port>

so:

dns-sd -R myserver _http._tcp local 8080

The service will remain registered as long as the command is active, so you will need to run it in the background to keep it running (add the & to the end to background the task).

The documentation explicitly states it can only register in the .local domain, so you likely won't be able to do archive.x.local, but you should be able to do archive-x.local.

gaige
  • 210
  • 3
  • 8
1

After a lot of searching without any solution, I eventually wrote my own MDNS listener that would respond to additional .local hostname requests. I've been using it some moths now for the exact same purpose.

You can find it here:

https://github.com/Richie765/mdns-listener

barney765
  • 171
  • 3