Hostname resolution in Mac OS X (since ~10.3) has roughly spoken - i exclude various cache mechanisms - the following operating sequence:
- 'Files' (e.g. /etc/hosts) ->
- mDNS ->
- DNS (search domains) ->
Valid names for the different name resolution methods:
for 1: almost arbitrary names
for 2: name.local
for 3: name (+ search.domain in your network prefs) A Start Of Authority (SOA) record for the top level domain is obligatory.
for 4: fqdn
In your first scenario (
myserver.local) you only use 'Files' and mDNS. 'Files' fails because there is no entry
myserver.local in your hosts file. mDNS succeeds resolving it because it's a valid and resolvable mDNS name.
In your second scenario (
myserver & search.domain
local) you use 1, 2, 3 (and 4). 'Files' fails because you have no entry
myserver, mDNS fails because it's no valid mDNS name. DNS (search domains) fails because you don't have a DNS-server with a SOA record for .local in your network (as well as DNS).
So just enter
sudo nano /etc/hosts in Terminal and add the line:
(a.x.y.z= IP-number of your server) and it should work. If you are really lazy even an 'a' as name might be sufficient. But don't use single numbers (like 1 or 123) because then ssh might try to connect to 0.0.0.1 or 0.0.0.123. At least ping connects to 0.0.0.1 or 0.0.0.123.