I ask this just for curiosity, since the problem can be avoided by using for example port number 2231 instead...
Can someone explain why exaclty port number 2230 cannot be used to preroute SSH traffic to VM's port 22? I cannot find any reference that this particular port number would be used by some service on PVE or even assigned as standard port for some service.
So I have added rules like this to PVE's
After changing this file, I run
I have my own naming-scheme for port numbers to keep everything under control (basically number will start with '2' and then VM-ID will follow), so this is why I have "strange" port numbers for services. I have tens of such rules in the interfaces file and I have used same method every time I have created a new VM. However port number 2230 is now the first that just does not work: Connecting with SSH just times out.
Firewall cannot be an issue: there is rules only on VM level and those allow connection from limited public IP's (to destination port 22). Connection starts to work if I change the rule above to use
I tried to use puTTY and WinSCP for connection from outside (to server.example.com), I also tried telnetting that port and that also results as time-out. I am able to connect to VM internal IP address with port 22 all the time (from other VM on the same network), so this must be an issue with PVE?
I don't have another PVE server setup like this one so I cannot test does this problem occur always in PVE.
Can someone explain why exaclty port number 2230 cannot be used to preroute SSH traffic to VM's port 22? I cannot find any reference that this particular port number would be used by some service on PVE or even assigned as standard port for some service.
So I have added rules like this to PVE's
/etc/network/interfaces so that I can connect directly to a VM by using same domain name (server.example.com) and different port number for each VM:
Code:
#SERVICE NAME, Description
post-up iptables -t nat -A PREROUTING -p tcp -d [PUBLIC-IP-ADDRESS] --dport 2230 -i vmbr0 -j DNAT --to-destination [INTERNAL-IP-ADDRESS]:22
post-down iptables -t nat -D PREROUTING -p tcp -d [PUBLIC-IP-ADDRESS] --dport 2230 -i vmbr0 -j DNAT --to-destination [INTERNAL-IP-ADDRESS]:22
systemctl restart networking on PVEI have my own naming-scheme for port numbers to keep everything under control (basically number will start with '2' and then VM-ID will follow), so this is why I have "strange" port numbers for services. I have tens of such rules in the interfaces file and I have used same method every time I have created a new VM. However port number 2230 is now the first that just does not work: Connecting with SSH just times out.
Firewall cannot be an issue: there is rules only on VM level and those allow connection from limited public IP's (to destination port 22). Connection starts to work if I change the rule above to use
--dport 2231 (or someting else) instead - and breaks again if I change --dport 2230.I tried to use puTTY and WinSCP for connection from outside (to server.example.com), I also tried telnetting that port and that also results as time-out. I am able to connect to VM internal IP address with port 22 all the time (from other VM on the same network), so this must be an issue with PVE?
I don't have another PVE server setup like this one so I cannot test does this problem occur always in PVE.