Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ssh to dns server ends up in 127.0.0.1 [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 309
Location: Stockholm, Sweden

PostPosted: Sat Jun 04, 2016 7:12 am    Post subject: ssh to dns server ends up in 127.0.0.1 [Solved] Reply with quote

I reinstalled my desktop, and have run into a problem that I don't understand.

I have a server named 'xenon' which is dns.

If I ping xenon, get what I wolud expect;
Code:
ata.
64 bytes from xenon (10.1.200.1): icmp_seq=1 ttl=64 time=0.161 ms
64 bytes from xenon (10.1.200.1): icmp_seq=2 ttl=64 time=0.221 ms


I can also browse to it, mount shares etc.

However, if I want to ssh into the same, I end up in localhost.

Code:
ssh -v xenon
OpenSSH_7.2p2lpk, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xenon [127.0.0.1] port 22.
debug1: Connection established.


my /etc/resolv contains only has
Code:
# Generated by net-scripts for interface eth0
nameserver 10.1.200.1


And there's nothing strange in the hosts file either.

I I ssh using ip address, it works as expected.

So why is this happening??


Last edited by vespaman on Sat Jun 04, 2016 9:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 844

PostPosted: Sat Jun 04, 2016 9:15 am    Post subject: Reply with quote

What's in /etc/hosts?
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 309
Location: Stockholm, Sweden

PostPosted: Sat Jun 04, 2016 9:18 am    Post subject: Reply with quote

only

127.0.0.1 localhost
::1 localhost6
10.1.200.50 hush hush.bxxxxs.com
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14180

PostPosted: Sat Jun 04, 2016 5:06 pm    Post subject: Reply with quote

Perhaps you have an ssh config option which sets the effective address of name xenon. What is the output of grep -En '^[^#]' /etc/ssh/ssh_config ~/.ssh/config?
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 309
Location: Stockholm, Sweden

PostPosted: Sat Jun 04, 2016 7:01 pm    Post subject: Reply with quote

This gives me;

Code:
grep -En '^[^#]' /etc/ssh/ssh_config ~/.ssh/config
/etc/ssh/ssh_config:53:SendEnv LANG LC_*
grep: /home/micke/.ssh/config: No such file or directory
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 844

PostPosted: Sat Jun 04, 2016 8:11 pm    Post subject: Reply with quote

I think something on your DNS system is assigning 127.0.0.1 to xenon. You say xenon is the DNS server, but you haven't described the DNS software that you have running on xenon.

I have no idea why ping would find the right address, and ssh not.

The file /etc/ssh/ssh_config (which your ssh is referring to) allows configuration on a per-host basis, but I don't know that it is able to change the IP address of any host.
Back to top
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Sat Jun 04, 2016 8:59 pm    Post subject: Reply with quote

If you don't already have it on your desktop you could install bind-tools and run nslookup.
Back to top
View user's profile Send private message
vespaman
Guru
Guru


Joined: 28 Aug 2002
Posts: 309
Location: Stockholm, Sweden

PostPosted: Sat Jun 04, 2016 9:49 pm    Post subject: Reply with quote

Weird!

Thanks Guys! Using nslookup showed xenon on two addresses. Turns out that xenon (with dnsmasq) had xenon as an alias for localhost in its hosts file.

But the weird thing is that I have not changed that box in years, and it has been, and was working on all other computers, even this desktop before reinstalling gentoo.
And why only ssh?

The laptop next to it has the exact same version of ssh, ~arch and 64bit, yet it worked.

I would never had expected the server config... . 8O


Code:
nslookup xenon
Server:         10.1.200.1
Address:        10.1.200.1#53

Name:   xenon
Address: 10.1.200.1
Name:   xenon
Address: 127.0.0.1
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14180

PostPosted: Sat Jun 04, 2016 10:05 pm    Post subject: Reply with quote

cboldt wrote:
The file /etc/ssh/ssh_config (which your ssh is referring to) allows configuration on a per-host basis, but I don't know that it is able to change the IP address of any host.
The ssh directive HostName can override the address associated with a name. It is intended for establishing nicknames for systems where the authoritative DNS has no name, the wrong IP address, or an inconvenient name. See man ssh_config for usage details. Using it does not technically change the IP address of the host, but it does change the target to which ssh will connect.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 844

PostPosted: Sun Jun 05, 2016 12:01 am    Post subject: Reply with quote

Hu wrote:
cboldt wrote:
The file /etc/ssh/ssh_config (which your ssh is referring to) allows configuration on a per-host basis, but I don't know that it is able to change the IP address of any host.
The ssh directive HostName can override the address associated with a name. It is intended for establishing nicknames for systems where the authoritative DNS has no name, the wrong IP address, or an inconvenient name. See man ssh_config for usage details. Using it does not technically change the IP address of the host, but it does change the target to which ssh will connect.


Now that you mention that, I actually use that, but for the purpose you mention, a nickname, not to override the IP address associated with a domainname. It takes two lines in ssh_config (or equivalent) ...

Code:
Host            home
Hostname        domain.com


I agree with you, if the named "Host" was "xenon," and the "Hostname" was "localhost," then `ssh xenon` would effectively run `ssh localhost` instead.

Thanks much for the brief tutorial! I wonder sometimes, how I can forget more than I learned. Glad to see the OP found the problem, of course, and much enjoy the side lessons.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum