Tutorial: Acceso Remoto a ProxmoxVE vía SSH Reverse Tunnel
Escenario
- ProxmoxVE en tu LAN:
TU_IP_PROXMOX_LAN - VPS (mi servidor OpenClaw):
IP_DEL_VPS - IP pública de tu casa:
TU_IP_PUBLICA(no la necesitamos) - Objetivo: Acceder al panel de Proxmox (
https://TU_IP_PROXMOX_LAN:8006) desde cualquier lugar
1. Generar Clave SSH en Proxmox
Ejecutá esto en tu máquina con Proxmox (como root o con sudo):
ssh-keygen -t ed25519
Apretá Enter para todas las preguntas (ruta por defecto, sin passphrase si querés que arranque automático después).
La clave pública se guarda en: ~/.ssh/id_ed25519.pub
Mostrala con:
cat ~/.ssh/id_ed25519.pub
Output ejemplo:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAoWK8pA+Dzru4rrK08dTITccSZpqgIHvDre1gKVeXQ2 root@pve
Esa línea se la pasás a quien administre el VPS para que la agregue al ~/.ssh/authorized_keys.
2. Agregar la Clave Pública al VPS
En el VPS (IP_DEL_VPS), como el usuario admin:
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAoWK8pA+Dzru4rrK08dTITccSZpqgIHvDre1gKVeXQ2 root@pve" >> ~/.ssh/authorized_keys
Si el directorio ~/.ssh no existe, crealo primero:
mkdir -p ~/.ssh && chmod 700 ~/.ssh
Ahora desde el Proxmox ya podés probar conexión SSH simple:
ssh USUARIO@IP_DEL_VPS
Debería entrar sin pedir contraseña.
3. Configurar el Servidor SSH del VPS (GatewayPorts)
Por defecto, los puertos de un reverse tunnel SSH solo escuchan en localhost. Para que escuchen en la IP pública, hay que habilitar GatewayPorts en el VPS.
En el VPS, editar /etc/ssh/sshd_config como root:
sudo nano /etc/ssh/sshd_config
Buscá las líneas:
#GatewayPorts no
#AllowTcpForwarding yes
Cambialas a:
GatewayPorts yes
AllowTcpForwarding yes
Guardá, y reiniciá el servicio SSH:
sudo systemctl restart ssh
🔍 Verificación: Después de reiniciar, confirmá que quedó:
«`bash
grep -i «GatewayPorts» /etc/ssh/sshd_configDebe mostrar: GatewayPorts yes
«`
4. Abrir el Puerto en el Firewall del VPS
Si el VPS usa UFW (como en este caso), solo el puerto 22 está abierto por defecto.
Abrí el puerto que vas a usar para el túnel:
sudo ufw allow 8006/tcp
sudo ufw reload
🔍 Verificación:
bash
sudo ufw status
Debe mostrar8006/tcp ALLOW Anywhere
5. Crear el Túnel SSH Reverso (Modo Manual)
En tu Proxmox, ejecutá:
ssh -R 0.0.0.0:8006:TU_IP_PROXMOX_LAN:8006 -N USUARIO@IP_DEL_VPS
Flags:
– -R 0.0.0.0:8006:TU_IP_PROXMOX_LAN:8006 — Reverse tunnel: el VPS escucha en puerto 8006 (todas las interfaces) y reenvía a TU_IP_PROXMOX_LAN:8006
– -N — No ejecuta comandos, solo mantiene el túnel
– USUARIO@IP_DEL_VPS — Usuario e IP del VPS
Mientras esta terminal esté abierta, desde cualquier lugar podés acceder a:
http://IP_DEL_VPS:8006
Para cerrarlo, apretá Ctrl + C.
6. Hacerlo Permanente con autossh + systemd
Para que el túnel arranque solo cuando el Proxmox se reinicie y se reconecte automáticamente si se cae.
6.1 Instalar autossh
En tu Proxmox:
apt update && apt install -y autossh
6.2 Crear el servicio systemd
Crear el archivo de servicio:
sudo nano /etc/systemd/system/proxmox-tunnel.service
Contenido:
[Unit]
Description=SSH Reverse Tunnel to VPS for Proxmox
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
Environment=AUTOSSH_GATETIME=0
ExecStart=/usr/bin/autossh -M 0 \
-o "ServerAliveInterval=30" \
-o "ServerAliveCountMax=3" \
-o "ExitOnForwardFailure=yes" \
-o "StrictHostKeyChecking=accept-new" \
-R 0.0.0.0:8006:TU_IP_PROXMOX_LAN:8006 \
-N USUARIO@IP_DEL_VPS
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
6.3 Habilitar e iniciar el servicio
sudo systemctl daemon-reload
sudo systemctl enable proxmox-tunnel.service
sudo systemctl start proxmox-tunnel.service
6.4 Verificar que funciona
sudo systemctl status proxmox-tunnel.service
Deberías ver algo como:
● proxmox-tunnel.service - SSH Reverse Tunnel to VPS for Proxmox
Active: active (running)
Y en el VPS, verificá que el puerto está escuchando:
ss -tlnp | grep 8006
Debe mostrar:
LISTEN 0 128 0.0.0.0:8006 0.0.0.0:*
7. Probar el Acceso Remoto
Desde cualquier dispositivo FUERA de tu red local (celular con datos, laptop en un café, etc.):
http://IP_DEL_VPS:8006
Te va a aparecer la pantalla de login de Proxmox. Usás tu usuario y contraseña local de Proxmox.
Resumen de Comandos Rápidos
| Acción | Comando (dónde ejecutarlo) |
|---|---|
| Generar clave SSH | ssh-keygen -t ed25519 (en Proxmox) |
| Túnel manual | ssh -R 0.0.0.0:8006:TU_IP_PROXMOX_LAN:8006 -N USUARIO@IP_DEL_VPS (en Proxmox) |
| Ver estado del túnel | sudo systemctl status proxmox-tunnel.service (en Proxmox) |
| Ver puerto en VPS | ss -tlnp \| grep 8006 (en VPS) |
| Abrir puerto en firewall | sudo ufw allow 8006/tcp (en VPS) |
Notas de Seguridad
- El túnel solo expone el puerto 8006 de Proxmox — no toda tu red.
- Para mayor seguridad, combiná con WireGuard o al menos usá un puerto no estándar (ej:
-R 0.0.0.0:24456:TU_IP_PROXMOX_LAN:8006). - Si querés solo para vos, podés limitar el acceso por IP en UFW del VPS:
bash
sudo ufw allow from TU_IP_PUBLICA to any port 8006 - Proxmox ya tiene su propio login, pero asegurate de tener contraseña fuerte.