Change SSH port on Proxmox VE cluster

bryambalan

Member
Jul 25, 2020
15
0
21
27
Hi guys, I have the following problem:

I wanted to change the default SSH port from 22 to 2222, and I was able to do so by editing the sshd_config files.

However, even after changing the SSH port, when I try to migrate a VM between NODE_X and NODE_Y using ProxMox, it still uses port 22 and the command fails.

I tried changing it in the ssh_config file as well, but ProxMox still uses port 22 for VM migration.

I would like to know if there is any configuration that needs to be done in the ProxMox configuration files to change the default SSH port and make it work when migrating a VM between nodes.
 
From the top of my head:
you need to configure your SSH client (/root/.ssh/config) as well and set special entries for the IP and the hostname of your other nodes, e.g.

Code:
Host proxmox1 proxmox2 proxmox3
    Port 2222
 
  • Like
Reactions: Ldfa and dar_ek
For others who might look up this information too:

You should not only add the hostnames but also the IP addresses here, so the config file might look like this on proxmox 1:
Code:
Host proxmox2 proxmox3
    Port 2222

Host 192.168.0.2 192.168.0.3
    Port 2222

The interface which is used for VM migrations should be set up accordingly to your needs too. You can do that in Datacenter -> Options -> Migration Settings. Don't forget to put the IP addresses for the selected migration interface into your /root/.ssh/config on all nodes as well.

If there is a point-to-point connection between your PMX nodes you can also disable security on the migration interface by replacing the secure with insecure in the file /etc/pve/datacenter.cfg Source. This will increase the migration speed massively.

Disclaimer:
⚠️⚠️⚠️ You should know what you do when you disable encryption – You have been warned! ⚠️⚠️⚠️
 
Last edited:

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!