0

I have a Linux server running Ubuntu 22.04., and I am able to connect to it via ssh on LAN (ssh user@192.168.X.XX), but I am unable to connect via WAN. So if I try to run ssh -p 22 user@<router ext.ip>, I always get the following error code (I have already set up port forwarding):

  Unable to negotiate with <IP address> port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1  

But, since my router does not have constant IP address, I have set up dynamic DNS and even if I try ssh -p 22 user@XXXX.ddns.net, I am still getting the same error code.

What I have already tried

  1. this answer from Unix & Linux SE
    But then I am getting this error:
Unable to negotiate with <IP address> port 22: no matching cipher found. Their offer: 
3des-cbc

And If I try to force 3des-cbc with ssh -c 3des-cbc user@XXX.ddns.net, then I, once again, get this error:

Unable to negotiate with <IP address> port 22: no matching key exchange method found. 
Their offer: diffie-hellman-group1-sha1
  1. Update ~/.ssh/config and /etc/ssh/ssh_config with
Host XX.XX.XX.XX
    Ciphers 3des-cbc
    KexAlgorithms +diffie-hellman-group1-sha1

However, that is also not giving any result (the same error msg)
3. Update / Reinstall / Stop - Start service / Disable - Enable service
This is also not working.

NOTE: I am using openssh-server, version (1:8.9p1-3).

What should I do now?

hra-ved
  • 101
  • "that is also not giving any result (the same error msg)" -- which "same error"? You've posted two different errors. – bxm Jul 11 '22 at 17:16
  • 2
  • You're connecting to the wrong external address, or 2. You're using different clients for the internal and external connections attempt that are configured differently, or 3. Your router is offering port 22 for a different purpose overriding your port forward
  • – Chris Davies Jul 11 '22 at 17:32
  • If you catefully disable the ssh service, what happens when you try to connect (a) from your LAN, (b) remotely? – Chris Davies Jul 11 '22 at 21:44
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jul 14 '22 at 13:40