..and it was so i've discovered this official best practice to port-forward services on a VirtualBox guest
In this example (exactly extracted from the doc), we are going to portforwarding the SSH service, from our HOST 8888 port, to the GUEST (vm name: "Puppet Test Machine") on 22 port:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zmo@naropa:~$ VBoxManage modifyvm "Puppet Test Machine" --natpf1 "sshService,tcp,,8888,,22" |
In this way, our HOST will keep the forward on each interfaces. Anyway, it's possible to bind a specific interface though.
Now that we have our forward ready, we can connect the loopback on the given port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zmo@naropa:~$ ssh -p 8888 root@localhost | |
Last login: Wed Jan 2 14:31:36 2013 from 10.0.2.2 | |
Welcome to puppet! | |
[root@puppet ~]# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zmo@naropa:~$ VBoxManage showvminfo "Puppet Test Machine" | grep ssh | |
NIC 1 Rule(0): name = sshService, protocol = tcp, host ip = , host port = 8888, guest ip = , guest port = 22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zmo@naropa:~$ VBoxManage modifyvm "Puppet Test Machine" --natpf1 delete "sshService |