0

I connect to local servers on the same network as "staging.local" (where staging is the hostname on the local server).

Is it possible to do the name in os x hosts file like this:

staging.local  mydomain.com

That doesn't seem to work. Referencing the ip address directly does work but it can change often (192.168.0.196 mydomain.com).

Any help would be greatly appreciated.

Hopstream
  • 5,893
  • 9
  • 47
  • 77

1 Answers1

2

No, this cannot be done with unix hosts files.

This can be done with DNS/bind using CNAME, but the hosts file is basically like using A/PTR -- No aliases allowed.

You can create aliases for using by ssh if this is what you will be using them for in ~/.ssh/config

Host staging.local
 HostName mydomain.com
David Houde
  • 4,687
  • 1
  • 15
  • 27