Why won’t terminal let me ssh in to the lan server when Windows/Putty works fine

sshterminal

I have a development server on my LAN with a static IP address. My DD-WRT flashed router assigns the domain 'server.local' to the static IP of the server. Everything worked fine with my setup. I could connect to the server via ssh, ftp, http, ping, or even samba.

I just did a clean install of CentOS on the server, and everything is working fine when I connect to it from any of my Windows machines. However my Macbook won't connect any more. I can view my development versions of my websites in a browser, but I can't ssh in to the server.

I cleaned out ~/.ssh/known_hosts to make sure the old server's information wasn't mucking things up. How are the Windows machines and Mac browsers able to find the server, but Terminal can't?

Edit #1:

~: ssh root@server.local
ssh: Could not resolve hostname server.local: nodename nor servname provided, or not known
~: ssh root@192.168.1.200
root@192.168.1.200's password:

Edit #2:

I already tried flushing the DNS cache by dscacheutil -flushcache.
I'm on OS 10.6.

Ok, so why is Terminal confused about the domain name when browsers are not?

Adding 192.168.1.200 server.local to /etc/hosts fixes the problem. I'm just wondering why it's not able to rely on the router's DNS.

Best Answer

Mac OSX 10.6 does not respect DNS responses with a TTL (time to live) of 0 (which is what DD-WRT based routers are set to by default). You will need to go into the DD-WRT router and into the Administation -> Services tab. You will see a box called Additional DNS options. Add the following value to this box :

local-ttl=5

Save and reboot your router and your Mac, and you should be able to see server.local in terminal (without having it in your hosts file).