LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-09-2016, 09:08 AM   #1
sumncguy
Member
 
Registered: Jun 2013
Posts: 76

Rep: Reputation: Disabled
Can ssh to hostname but not the ip


The subject line basically says it.

I am able to ssh to a network device using its hostname, but am unable to do so with the ip .. The ip is not in the private space.

I am using :
Quote:
ssh -q -o StrictHostKeyChecking=no $unam@$ip
Thanks for the help
sumncguy
 
Old 11-09-2016, 10:16 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,162

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
It sound like the digit keys on your keyboard are not working.

Of course there is the remote possibility that the actual error message that you are getting would be helpful, but you decided not to post that. Make sure you include '-v' in the ssh command. Also make sure you include the output of
Code:
host <hostname>
 
Old 11-09-2016, 10:17 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,387
Blog Entries: 3

Rep: Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776Reputation: 3776
Well, by turning off StrictHostKeyChecking, you are turning off the ability to verify that you are connecting to the right SSH server.

What error are you actually getting?

Does the host name resolve to the same IP number that you are trying directly?
 
Old 11-10-2016, 10:46 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,712
Blog Entries: 4

Rep: Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949
Also, use a command such as (on Linux ...) dig hostname to request DNS-resolution of the name that you are using. It may well be that it is not the IP address that you think it is.

(Another easy way to do it, most of the time, is to use "ping." Notice which IP-address replies ...)

You do not need to use a hostname with ssh. In fact, I almost never do.
 
Old 11-10-2016, 03:19 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,027

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
Host name could resolve from a number of sources also.

Wonder if the key and ip/name are somehow related or mapped?
 
Old 11-10-2016, 04:33 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,712
Blog Entries: 4

Rep: Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949
Quote:
Originally Posted by jefro View Post
Host name could resolve from a number of sources also.
Quite frankly, "it's always a bit of a mystery" just how (and by whom ...) a particular [non-existent ...] domain name might be resolved.

For example, in a recent project, I decided that, ("surely ...") the domain "blah-blah.cloud" must be available. Uh uh...

Little did I know that there are name servers in Czechoslovakia ...
 
Old 11-10-2016, 07:13 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,027

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
I didn't really get OP's full topology on their problem so we are guessing.

I'd think that the dig command should have been a good first choice too.
 
Old 11-10-2016, 07:51 PM   #8
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,676

Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
Quite frankly, "it's always a bit of a mystery" just how (and by whom ...) a particular [non-existent ...] domain name might be resolved.

For example, in a recent project, I decided that, ("surely ...") the domain "blah-blah.cloud" must be available. Uh uh...

Little did I know that there are name servers in Czechoslovakia ...
There is no Czechoslovakia ...

I told to a friend of mine how I used to have good time in Czech Republic when I was living in Europe. It was what ... 8 years ago? Now he is driving me nuts every time we meet asking if I miss my beer trips to Czechoslovakia ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
SSH Troubles: ssh: Could not resolve hostname: Name or service not known -Xubuntu12 reklaimer Linux - Networking 4 06-03-2012 02:53 AM
FC13 install can ping by hostname, ssh by hostname fails jeffk42 Linux - Networking 4 11-14-2011 11:27 AM
Hostname for SSH llagunocap Linux - Newbie 10 05-16-2008 07:57 AM
can't ssh using hostname deepesh1081 Linux - Networking 1 05-06-2007 07:11 AM
can't ssh through hostname romel Linux - Networking 4 07-25-2004 01:54 PM

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

All times are GMT -5. The time now is 02:06 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