0

This is how things are by default. I did not set anything up. My debian server has a network connection on eno2 with ip 192.168.1.40. 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 10.0.0.2. 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.

E.g.:

Client:

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

Server:

$ nc -w 10 10.0.0.2 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 192.168.1.40 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 10.0.0.1/8 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 10.0.0.1/8 scope global eno4
       valid_lft forever preferred_lft forever

I can ping 10.0.0.1 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 0.0.0.0
#ListenAddress ::

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

1 Answer 1

0

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
    Hostname 192.168.1.40
    User admin
    Port 22222
Host SomeServer
    # Some temporary overwrite parameters
    Hostname 10.0.0.1

However, this does work:

Host SomeServer
    # Some temporary overwrite parameters
    Hostname 10.0.0.1
Host SomeServer
    Hostname 192.168.1.40
    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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .