SSH into a namespace, connection refused
For those interested, I found the solution from here: https://blog.bofh.it/debian/id_446.
The trick is to start a separate sshd server in each namespace:
ip netns exec mynamesapce /usr/sbin/sshd -o PidFile=/run/sshd-mynamespace.pid
Of course firewall must allow tcp/ssh
From what I can tell from your post, you probably only have your SSH daemon listening on one interface. In your /etc/ssh/sshd_config
file, make sure you have ListenAddress
listed as this: #ListenAddress
. If it is enabled, the OpenSSH server will only listen for incoming connections on the specified address(es). If you want to use ListenAddress for multiple IPs, then you will need to have them on separate lines, like this:
ListenAddress 192.168.1.1 ListenAddress 192.168.1.2