I've setup an Ubuntu Server 18.04 VM in VirutalBox on my Lenovo laptop (which is running Ubuntu Desktop 18.04). When the VM boots up using NAT for networking, it does get an IP and it can get out to the internet (PING google, etc):

However, I cannot get in to the VM via SSH, nor does PING work or anything else - nothing inbound to the VM is being allowed. I tried to disable UFW like so: systemctl stop ufw ...which did disable UFW, but still nothing inbound is being allowed at all.

I then tried setting the NIC to use "Bridged" networking, but it cannot get an IP from DHCP (not sure why). I'm fine with using either IP, it doesn't matter. I just need inbound connectivity. How can I get it?

  • Thanks, @guiverc. I've corrected the versions now. – KidACrimson Feb 6 at 13:50
  • Personally, I'm not clear on what you mean by "in to the VM". That begs the question "from where?" From the host, the LAN, the internet? Please clarify. Thank you for helping us help you! – Elder Geek Feb 13 at 17:52
  • 1
    Thanks, will do. What I mean is strictly SSH from the host OS into the VM. – KidACrimson Feb 14 at 18:16

Make sure that sshd.service is enabled and listening on desired port on the VM. Also make sure that ssh ports are open in the firewall on both the host machine and the virtual machine. Or the firewall turned off on each.

If you use NAT then you must setup port forwarding on on the VM NIC through the VM Manager 'Machine->Settings->Network' Under advanced. Or by using vboxmange in terminal.

vboxmanage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"

If you use bridged mode for the VM NIC, then it will receive an IP address from your router. The same router that your host machine receives from. And there will be no need for port forwarding. Default NAT internal address will be in the 10.0.*.* range. Bridged address will be in range of your LAN router. Most home routers default to the range of

Oracle® VM VirtualBox®

| improve this answer | |
  • Thanks, @da_kingpin. I am positive that the sshd service is indeed active/running and listening in the VM. I will try the NAT commands... – KidACrimson Feb 12 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.