LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-31-2006, 10:59 PM   #1
gonzojd7
Member
 
Registered: Oct 2005
Location: Florida, USA
Distribution: Ubuntu 8.04, 9.04
Posts: 37

Rep: Reputation: 15
ssh name or service not known?


When I try to ssh <hostname> I get an error " name or service not known"

But when I login ssh 192.168.1.10 , I am able to login. I've searched on the net but I came up empty handed. Any suggestions???
 
Old 08-31-2006, 11:21 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Are you running a local DNS that maps 192.168.1.10 to <hostname>, or do you have <hostname> in your /etc/hosts file? Can you 'ping <hostname>'?

If the answer to both is no, then you can only ssh by IP address.
 
Old 08-31-2006, 11:24 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
EDIT: Nevermind, posted too slowly
 
Old 09-02-2006, 09:18 AM   #4
gonzojd7
Member
 
Registered: Oct 2005
Location: Florida, USA
Distribution: Ubuntu 8.04, 9.04
Posts: 37

Original Poster
Rep: Reputation: 15
Thanks it worked!

Macemoneta,

Thanks for the reply. I had to add the ip/hostname in the local computer /etc/hosts file. Everything is working now. Once again thanks...
 
Old 09-02-2006, 09:19 AM   #5
gonzojd7
Member
 
Registered: Oct 2005
Location: Florida, USA
Distribution: Ubuntu 8.04, 9.04
Posts: 37

Original Poster
Rep: Reputation: 15
Thanks.

Thanks gilead anyways!
 
Old 09-08-2006, 07:02 AM   #6
daking27
LQ Newbie
 
Registered: Jul 2005
Location: Knoxville, TN
Distribution: SimplyMEPIS 6.0
Posts: 4

Rep: Reputation: 0
Question

I'm getting this same error message in a way that strikes me as weird.

I'm on a home network with a router that provides DNS service. I updated to SimplyMEPIS 6.0 last week on a dual boot computer. I had not used linux on that particular computer in a long time, but I'm convinced ssh <computer name> worked before. The annoying thing is that on the Windows side simply entering the hostname for the computer works, so somewhere (I'm assuming on the router) the DNS mapping is working. I hate it that Windows can do this but linux (and, of course, I) can't figure it out, especially since it seemed to work before.

I can't just put the IP address in the hosts file because the IP address changes depending on the order things boot up. I figure I'm doing something wrong somewhere, though. Is there something I need to do to tell linux to use the DNS on the router?

Thanks!
 
Old 09-08-2006, 09:40 AM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Take a look at your /etc/resolv.conf. It should have an entry:

nameserver <router's IP address>

If not correct it.
 
Old 09-08-2006, 06:07 PM   #8
daking27
LQ Newbie
 
Registered: Jul 2005
Location: Knoxville, TN
Distribution: SimplyMEPIS 6.0
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by macemoneta
Take a look at your /etc/resolv.conf. It should have an entry:

nameserver <router's IP address>

If not correct it.
I appreciate the help! I didn't know to check that. Unfortunately (since that would have been a simple fix), there are IP addresses there. They are the IP addresses that show up in my router's config as DNS 1 and DNS 2. That is different from the router's own IP address, though. Which should it be?

I notice that the first octet is the same in both the DNS addresses and the router address (and the default gateway), but the second octet (and of course the third and fourth) are different. Does that make any difference?

(For clarity: router IP address and default gateway only vary in the fourth octet, as they should. DNS varies from them in the second and third octets also.)

Additional information: I remembered about, and found information on, a setup issue with Mepis, detailed at http://www.mepis.org/node/8656. Basically, you have to ensure the ssh daemon starts. I checked mine and found no startup scripts and ran the fix. Here's the essential info from that post.

As root, type:

# cd /etc
# find ./ -name "*ssh"

If the daemon hasn't started, the readout will look like:

./ssh
./default/ssh
./pam.d/ssh
./rc1.d/K20ssh
./rc2.d/K20ssh
./rc3.d/K20ssh
./rc4.d/K20ssh
./rc5.d/K20ssh
./init.d/ssh

(possibly in a different order).

The fix is to then type:

# rm /etc/rc*.d/*ssh
# update-rc.d ssh start 20 2 3 4 5 . stop 20 0 1 6 .

The result will look like:

Adding system startup for /etc/init.d/ssh ...
/etc/rc0.d/K20ssh -> ../init.d/ssh
/etc/rc1.d/K20ssh -> ../init.d/ssh
/etc/rc6.d/K20ssh -> ../init.d/ssh
/etc/rc2.d/S20ssh -> ../init.d/ssh
/etc/rc3.d/S20ssh -> ../init.d/ssh
/etc/rc4.d/S20ssh -> ../init.d/ssh
/etc/rc5.d/S20ssh -> ../init.d/ssh

You then have to configure your firewall to allow SSH.

I did the fix, but still have the problem, with this difference. I had not thought to try SSH to the machine by IP address, simply because the IP can change, and I don't want to depend on it. But it was worthwhile as troubleshooting, with the result that I can, indeed, login via explicit IP address, but still can't log in via hostname, even after the fix above.

I wondered if it could have anything to do with an improperly configured SSH daemon on the target machine, since it is also running Mepis. But I think the problem has to be somewhere in my machine's Linux setup, since I am able to SSH into the same target machine from Windows. I will check the target's daemon regardless. In the meantime, any other ideas?

More possibly helpful info: through Konqueror, I am able to reach the machine via smb and the hostname, no problem. When I try to use the ssh protocol through Konqueror with the hostname, I get the same error. When I use ssh through Konqueror with the IP, I am able to get through.

Thanks again!

Last edited by daking27; 09-08-2006 at 06:56 PM.
 
Old 09-08-2006, 07:41 PM   #9
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
If your /etc/resolv.conf already contains the IP addresses of your ISP's DNS, then you don't have to change /etc.resolv.conf.

When you run servers (like an SSH server), you generally do not use dynamic IP addresses. In that case, you manually configure a static (unchanging) IP address that is outside the range that the DHCP server will offer.

For example, if the DHCP server (usually in your router for home users) is configured to offer IP addresses in the range 192.168.1.50 through 192.168.1.100, then you can manually assign an address to the machine with the server starting at 192.168.1.101 (.102, .103, ...). In this way, the address of your server never changes. You can then add the server name and IP address to the hosts file on Linux or Mac OSX (/etc/hosts) and Windows:

Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC\HOSTS
Win 98/ME = C:\WINDOWS\HOSTS

This lets you access the server by name, instead of IP address.
 
Old 09-08-2006, 09:12 PM   #10
daking27
LQ Newbie
 
Registered: Jul 2005
Location: Knoxville, TN
Distribution: SimplyMEPIS 6.0
Posts: 4

Rep: Reputation: 0
Lightbulb

I'm starting to understand more, and I apologize for my ignorance. This is helping in ways beyond just this one problem. I'm not completely certain if we're talking about the same thing.

Quote:
Originally Posted by macemoneta
When you run servers (like an SSH server), you generally do not use dynamic IP addresses. In that case, you manually configure a static (unchanging) IP address that is outside the range that the DHCP server will offer.
I had thought about just turning off DHCP on the router altogether, but one of the computers is a laptop that has to be capable of getting an IP from a DHCP server at work. I do know about hardware profiles, and how to set up alternatives in the networking stuff (I can't remember what it's called now), but it's just easier to have DHCP for the laptop. Your brief tutorial made a lightbulb go on regarding how to accomplish that. Thanks!

That would also certainly solve the problem on accessing the target machine, because I would just put the IP address in the hosts file after giving it a static IP address.

There are still two things that bug me that I want to figure out to raise my understanding of Linux.

The primary one is why Windows can connect using ssh and the hostname (and I know about the hosts file on both Windows and Linux (use a customized one to block ads, etc.), so I know that the problem isn't simply that the Windows hosts file has the target computer name in it and the Linux hosts file doesn't) and Linux has to have the IP address, or have the target put in the hosts file? I get the feeling I'm missing something important about Linux.

The other (whether we're talking about the same thing) centers on the whole idea of the SSH server. Basically, I'm trying to ssh into my daughter's computer from my computer. Hers is also running SimplyMEPIS. It would be nice to be able to ssh into other computers on our home network (we have three others), but this is the one computer I'm concerned about. "Server" would suggest to me that one of these five computers would be used for connecting to other computers on the network, right? Or is it just a matter that before I can SSH from my computer into any other (call it the target), a server has to be running on that target (and, therefore, needs a static address)? But even as I write that, it doesn't sound right, because then Windows shouldn't be able to find the target either. So I'm confused. If I've inadvertently left the impression I'm setting up a server when I'm not, it may negate the advice to give the machine a static address.

Again, thanks for your patience.
 
Old 09-08-2006, 09:40 PM   #11
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
I expect that your Linux distribution does not include Zeroconf services (usually provided by Avahi). One of the functions this provides is DNS-like facilities for the local network. It is available in several desktop oriented distributions, like Fedora Core.

The context I'm using the term 'server' in is as a function, not as a physical machine. People sometimes refer to a machine as a server when it is dedicated to providing functionality to other machines. In the case we are discussing, the ssh server is any machine that is running the sshd daemon. In other words it is providing ssh login services to other machines.
 
Old 09-08-2006, 11:17 PM   #12
daking27
LQ Newbie
 
Registered: Jul 2005
Location: Knoxville, TN
Distribution: SimplyMEPIS 6.0
Posts: 4

Rep: Reputation: 0
Smile

Quote:
Originally Posted by macemoneta
I expect that your Linux distribution does not include Zeroconf services (usually provided by Avahi).
Good call! It wasn't included. I have installed it, and now a function of the Mepis network panel that wasn't working is working. I still have to figure out how to set it up though. I'll keep at it. Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to enable ssh service on suse 10? ArthurHuang SUSE / openSUSE 8 09-15-2017 06:33 AM
allow SSH service securely cynick Linux - Security 4 04-21-2006 10:22 PM
Starting SSH service jordanfang *BSD 3 04-03-2006 02:49 AM
a question about ssh service sumargin Linux - Networking 4 12-16-2005 04:03 AM
Can't SSH until restart service Da Puff Mandriva 4 09-14-2005 08:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration