Weird SSH problem, connects to different IP than specified

Asked by Just some naab on 2018-09-13

Hi all!

I'm having weird problem on one of my Ubuntu servers. When I try to connect with SSH from one server to another, it connects to a different IP. This would make more sense to me if I was connecting with hostnames, but not with IP addresses.

So basically running command from ubuntu server:


...connects to! This makes absolutely no sense to me and I have no idea how to troubleshoot this! Any ideas what's happening in here???

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Just some naab
Last query:
Last reply:
Manfred Hampl (m-hampl) said : #1

What response do you get if you ping that address?

Just some naab (naab) said : #2

If I ping x.x.x.46 IP I get response from that same IP. However if I ping x.x.x.22 IP I don't get response.
When I SSH (and login) to .46 IP and check server IP config with ifconfig, I see that the IP is .22.

This makes no sense to me.

Manfred Hampl (m-hampl) said : #3

If you can't ping the server, then there seems to be something wrong with your address scheme.
Check your DHCP settings (if used), /etc/hosts files, etc.

Just some naab (naab) said : #4

sudo ip addr flush ens160 && sudo systemctl restart networking

This command when ran on connecting server solved problem!