Bloodrule
asked on
Cannot ssh using domain name, only IP address
I have a small LAN running Ubuntu on several machines. I can login using SSH from one to another, but only if I use the IP address. Assume I am trying to ssh to a machine with an IP of 192.168.0.10 and a hostname of Desktop.
If I enter "ssh me@192.168.0.10" it logs me into Desktop to a prompt me@Desktop:~$
But if I try
"ssh me@Desktop" I get a message "ssh: Desktop: Name or service not known" even though I know that the hostname Desktop exists.
What am I missing?
If I enter "ssh me@192.168.0.10" it logs me into Desktop to a prompt me@Desktop:~$
But if I try
"ssh me@Desktop" I get a message "ssh: Desktop: Name or service not known" even though I know that the hostname Desktop exists.
What am I missing?
What happens if you ping Desktop? Maybe it's not resolving the NetBIOS name.
@stany0
Good idea. Keep in mind that's for *nix. Windows users will have to edit the hosts file in c:\Windows\system32\driver s\etc (assuming C is the Windows drive).
stany0's suggestion isn't a long-term fix; however, but does let us know if the problem is network based or application-based.
Good idea. Keep in mind that's for *nix. Windows users will have to edit the hosts file in c:\Windows\system32\driver
stany0's suggestion isn't a long-term fix; however, but does let us know if the problem is network based or application-based.
ASKER
If I ping Desktop I get a "Unknown host Desktop" error.
ASKER
Would you mind telling me exactly what I might enter using your suggestion?
127.0.0.1 localhost.localdomain localhost
If the IP address of my machine is 192.168.0.10 (static) and If the hostname is Desktop, what exactly should I enter using your example above as the template?
127.0.0.1 localhost.localdomain localhost
If the IP address of my machine is 192.168.0.10 (static) and If the hostname is Desktop, what exactly should I enter using your example above as the template?
@Bloodrule
That's your problem then...your computer isn't resolving "Desktop" to it's IP address. You can follow stany0's advice to make it work, but it will only work until it's IP changes. The long-term fix is to figure out why your computer isn't seeing it advertising it's name, or why the ssh server isn't advertising it, or if something is blocking the traffic.
Some question that can help identify the exact problem:
1) Can other computers on the same network get to it via "Desktop"?
2) Can you ping any computers on your network by their computer names?
3) Does the workgroup (or domain?) name on your computer match the workgroup name on the ssh server PC?
That's your problem then...your computer isn't resolving "Desktop" to it's IP address. You can follow stany0's advice to make it work, but it will only work until it's IP changes. The long-term fix is to figure out why your computer isn't seeing it advertising it's name, or why the ssh server isn't advertising it, or if something is blocking the traffic.
Some question that can help identify the exact problem:
1) Can other computers on the same network get to it via "Desktop"?
2) Can you ping any computers on your network by their computer names?
3) Does the workgroup (or domain?) name on your computer match the workgroup name on the ssh server PC?
@Bloodrule
If your workgroup/domain name was WORKGROUP:
192.168.0.10 Desktop.WORKGROUP Desktop
If your workgroup/domain name was WORKGROUP:
192.168.0.10 Desktop.WORKGROUP Desktop
ASKER
Thanks for your helpful advice. Here comes a dumb question: How do I determine what my workgroup/domain name is?
is it available in dns? check your dns server
Windows:
Right-Click "My Computer"
Choose Properties
Choose "Computer Name" tab
Look where it says "Workgroup"
*nux:
hostname (actually hostname -s gives just the workgroup)
Right-Click "My Computer"
Choose Properties
Choose "Computer Name" tab
Look where it says "Workgroup"
*nux:
hostname (actually hostname -s gives just the workgroup)
ASKER
Sorry but I don't know how to check my dns server? Is that I command I issue in Linux or is it a setting in my router?
from the system you are trying to ssh from, run
nslookup Desktop
and see if you get error message or resolved ip. What is your client OS?
nslookup Desktop
and see if you get error message or resolved ip. What is your client OS?
ASKER
When I run nslookup Desktop, I get this response:
Server: 192.168.0.1
Address: 192.168.0.1#53
** server can't find Desktop: NXDOMAIN
Not sure what to make of this. Your help is appreciated.
Server: 192.168.0.1
Address: 192.168.0.1#53
** server can't find Desktop: NXDOMAIN
Not sure what to make of this. Your help is appreciated.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When I run nslookup Desktop.domain (I hope that's what you meant for me to try) I get exactly the same error message, namely
Server: 192.168.0.1
Address: 192.168.0.1#53
** server can't find Desktop: NXDOMAIN
Server: 192.168.0.1
Address: 192.168.0.1#53
** server can't find Desktop: NXDOMAIN
Please put your domain name for the domain part. What OS are you running ?
ASKER
I am running Ubuntu 8.10 on each machine. I am not sure what you mean by "put your domain name for the domain part". Sorry.
can you show the content of the following files:
/etc/hosts
/etc/resolv.conf
/etc/hosts
/etc/resolv.conf
ASKER
/etc/hosts:
127.0.0.1 localhost
192.168.0.10 Desktop
/etc/resolv.conf
nameserver 192.168.0.1
127.0.0.1 localhost
192.168.0.10 Desktop
/etc/resolv.conf
nameserver 192.168.0.1
can you show also /etc/nsswitch.conf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
example:
127.0.0.1 localhost.localdomain localhost