ssh login problem on ubuntu VM

himself

New Member
Jun 16, 2022
5
2
1
Hi all,

i have some weired behaviour from a ubuntu VM (20.04). I can randomly ssh into the VM, then it stopps working.
I do not see any hint in the logs what is going wrong.

i set up ssh had some issues and changed the port to 222. If i restart the VM it randomly starts working on that port. Then it stops working. I can not even enter the password if i try to reconnect.
Output of ssh -vvv on the correct port 222 if i try to connect:

Code:
ssh user@192.168.178.29 -p 222 -vvv
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1n  15 Mar 2022
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.178.29 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'
debug2: ssh_connect_direct
debug1: Connecting to 192.168.178.29 [192.168.178.29] port 222.
debug1: connect to address 192.168.178.29 port 222: Connection refused
ssh: connect to host 192.168.178.29 port 222: Connection refused

if i try from within the proxmox it works sometimes.

If i wouldn't experience the diffrence between working within the proxmoxx setup and from outside (Same network by the way) i would guess on 2 instances of ssh being active.

The auth.log doesn't hold any infomation about the ssh attempts.

For any help i would be really gratefull.

BTW it shows the behaviour with all install i tried.
 
Hi,
can you access the port telnet 192.168.178.29 222 or does it run into a timeout? Do you have the firewall enabled?
 
What do you mean with "If i try from within proxmox it works sometimes" ? Is that login into the vm using the proxmox-console?

If it's the console it does not use SSH
 
if your on the host machine which hosts the VM you can do the command "qm enter $VMID " in the CLI

have you tried connecting to port 22 again after not being able on port 222 ? to see if the configuration changes ?

there's also a possibility that is the ssh service that stops because of some error ?

also make sure to edit the /etc/ssh/sshd_config* and NOT /etc/ssh/ssh_config for this purpose.
 
Last edited:
Hi

@shrdlicka: do not know if this is a timeout guess its more not allowed?
Code:
telnet 192.168.178.29 222
Trying 192.168.178.29...
telnet: Unable to connect to remote host: Connection refused

Firewall is disabled.

@E_Mouws: What i wanted to say is that if i ssh from on virtual machine on the proxmoxx Node into the specific VM it works. I only see this issue from outside. That is why i changed the port because i thoughth all the port 22 causes the confusion ... not the case obviously.

@D0K:
i checked this already.
ssh is running and working from inside the node.

All machines are in the same network 192.168.178.xxx.

I think the issue is related to proxmox, not the VM as it works within the node.

Thanks for your replies
 
Since it works from within Proxmox but not from outside.
Has your VM the right settings for the gateway ? Can it ping to the outside ?
 
Yes, connectivity of the VM is ok. Local as well as Internet. So i do not think it is related to th enetwork settings i used. Anyway i will post them so you can have a look at it. I can also ping the VM from any machine in the network.

Code:
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens18:
      addresses:
      - 192.168.178.29/24
      gateway4: 192.168.178.1
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
  version: 2

What i noticed while checking for the configuration is a file networks, holding this info:

Code:
# symbolic names for networks, see networks(5) for more information
link-local 169.254.0.0

I have no clue where this is comming from and what it is needed for.

Besides there are some other network related folders (networkd-dispatcher) network and of course netplan where i took the config from.

I am not sure if this might have an impact on the ssh-server behaviour.


SSH from the VM to any other machine in the network works. Issue seems to be one directional.
 
Is a firewall active? If so; can you post the configuration?
Also please configuration from "netstat -tulpn"
 
No. Firewall in Proxmox is not active:

netstat says:

Code:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      650/systemd-resolve
tcp        0      0 0.0.0.0:222             0.0.0.0:*               LISTEN      1072/sshd: /usr/sbi
tcp6       0      0 :::222                  :::*                    LISTEN      1072/sshd: /usr/sbi
tcp6       0      0 :::6720                 :::*                    LISTEN      1/init
udp        0      0 127.0.0.53:53           0.0.0.0:*                           650/systemd-resolve
udp        0      0 0.0.0.0:3671            0.0.0.0:*                           671/knxd
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!