Ssh – Binding to 0.0.0.0 only picked up local addresses

arch-linuxnetworkingssh

I'm not a server guy, and my network skills are a little rusty, so this may be a simple question. On a brand-new archlinux machine, I setup sshd, and told it to bind to 0.0.0.0:9223. Once it was running, I used netstat to confirm that it was listening on *:9223.

Running "ssh -p 9223 localhost" connected fine, but remote connections failed. I then tried "ssh -p 9223 [REMOTE_IP]" on the server, and this failed.

After trying to find the source of the problem, and failing, I set sshd to bind to [REMOTE_IP], and suddenly everything worked.

So my question is, what would cause a socket bound to 0.0.0.0 to ignore connections from the ip address of the eth0 interface?

Best Answer

The case might be that your eth0 interface is using IPv6 protocol. When you configure ssh server with ListenAddress 0.0.0.0 in /etc/ssh/sshd_config you turned off IPv6 protocol. netstat then have only one entry for ssh starting with tcp. Add a line ListenAddress :: to also listen on tcp6. netstat should report you two entries for ssh server one on tcp6 :::9223 and one on tcp 0.0.0.0:9223