This is how things are by default. I did not set anything up. My debian server has a network connection on eno2 with ip Internet, sshd, Everything works fine.

Now I've added a second connection to eno4. It's a direct link (no router or switch) to another computer for management purposes. Let's call this one client. On the client, this automatically showed up as I can ping from the client.

On the server, there was no ip address assigned. But I could netcat from the client just fine, because I only needed the client ip address.



$ echo "Some big ZFS pool here" | nc -l -p 5555


$ nc -w 10 5555 | cat
Some big ZFS pool here

Now I want to connect to sshd on the server using this connection.

However, connection is refused. I can connect via LAN and internet over the default eno2 connection just fine. Just not over this direct link.

By default sshd listens to all incoming connections on all interfaces. Perhaps eno4 just needs an IPv4 address. So I did:

$ sudo ip addr add dev eno4
$ ip addr show eno4
5: eno4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 0a:a5:6a:1b:a2:22 brd ff:ff:ff:ff:ff:ff
    inet scope global eno4
       valid_lft forever preferred_lft forever

I can ping from the server. I can netcat. However, I can not ssh.

There are a lot of long long reads with a lot of work addressing all kinds of routing tables and stuff on the web. But I really don't know anything about routing, it's necessity, alternatives, and I'd probably spend the entire day trying it out. But is it really that complex? I can ping. I can netcat. What is the absolute simplest way to get ssh to work on interface? Might even be temporary, so I can get stuff done now?

And, optionally, what is a better permanent solution?

Note that sshd is already supposedly listening to everything, and I don't want it to stop listening. I'd prefer not to change the sshd configuration or even restarting sshd, because the server is in active use.

The only thing initially changed on this server is the port:

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

Port 22222
#AddressFamily any
#ListenAddress ::

... snip ...
  • Does the server have a firewall on it? – Simon Greenwood Nov 30 '17 at 14:37
  • @SimonGreenwood yes but no, ACCEPT all -- anywhere anywhere – Redsandro Nov 30 '17 at 14:56
  • Hmm, IP level security in sshd_config? What sort of output does ssh -v give you on the connected machine? – Simon Greenwood Nov 30 '17 at 16:36
  • @SimonGreenwood not as far as I know. -v shows a simple debug1: connect to address port 22222: Connection refused – Redsandro Nov 30 '17 at 16:43
  • Dumb question, but did you restart ssh since adding the eno4 ip address? – Simon Greenwood Nov 30 '17 at 16:47

Apparenly, after adding the ip address, it does work. I made a mistake in ssh_config where I assumed later entries overruled earlier entries, but it's the other way around!

Simplified example; this does not work:

Host SomeServer
    User admin
    Port 22222
Host SomeServer
    # Some temporary overwrite parameters

However, this does work:

Host SomeServer
    # Some temporary overwrite parameters
Host SomeServer
    User admin
    Port 22222

I feel a bit silly, and am not sure how I should handle this case:

  1. Vote to delete my question
  2. Update my question and explain that it actually does work as expected
  3. Answer my own question with this clarification

I chose the latter so I can close the case, and apologize for asking an unsolvable question (because actually it already worked).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.