Ok, once again I have tried to search for an answer, and once again I have learned everything except how to fix the problem I have.
I am just trying to get SSH working between 2 local machines on OpensSuse 11.4 boxes. I have the SSHD daemon running, the firewall is configured to allow SSH to pass, and I am using SSH’s password authentication. However, my machines cannot see each other. Anytime I try to SSH, I get “Could not resolve hostname<hostname>: Name or service not known.”
Of course, that leads me to believe I need an entry in my /etc/hosts file. However, I use DHCP, and therefore have a dynamic IP address. Therefore, my hosts names will only be good until the next IP renewal. How in the world do I configure SSH with a DHCP assigned address?
Some routers will provide a simulated DNS service for this, if you are using the DNS service provided by DHCP (typically the router itself). My router allows me to assign preferred IP addresses, so I don’t have a problem. I just use “/etc/hosts”.
My previous router always gave the same IP, until I rebooted the router. What I did in that case, was assign a hostname in $HOME/.ssh/config. I used something like:
Then, whenever the router was rebooted, I would have to edit that file and change the IP. If I put all local host definitions in the one file, I can then use “scp” to copy the first one to the other machines and thus update those. I do use public key authentication so that I am not having to enter passwords for such copying.
Come to think of it, I also had to edit $HOME/.ssh/known_hosts, to avoid getting annoying error/warning messages. I also set
so that the known_hosts lines are editable. I guess I could have done that in $HOME/.ssh/config instead.
The other obvious solution being… don’t SSH by DNS name (since you
don’t have DNS setup for it) or by hostname (since you don’t have your
hosts files hacked for it) but rather just SSH by IP address. The others’
responses about setting your IP “statically” via DHCP BootP-ish
configuration is the best way to go and every router I’ve seen in the last
several years supports this.