I've looked through another few questions but none seem to quite fit mine.

I've got an Ubuntu 32 bit system running off of vagrant. It has a public interface (eth1) and a nat interface (eth0). The eth0 is needed to ssh into the machine as it is command line only, but can get rid of it if need be.

My problem is that my website can be accessed by directly on my local machine, but when I try and access it over the internet it doesn't work, same goes for SSH. Nothing seems to be able to break out of the VM sandbox. Does anyone have any tips?

Note: I've just tested and I can access it on my local network, but it doesn't work over the internet. I know that port forwarding works because I can point port 22 and 80 to my host machine and have apache and ssh work on a fresh install, it just seems to be the VM which is breaking things.

my interfaces file:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
# The contents below are automatically generated by Vagrant. Do not modify.
auto eth1
iface eth1 inet dhcp
    post-up route del default dev $IFACE
  • Can you show a more complete description of the network topology for your VM. What exactly does eth0 NAT? How is eth1 VM interface configured in the VM settings? – Tero Kilkanen May 4 '14 at 10:30
  • Vagrant does a lot of stuff automatically so it's a little hazy I'll post what is inside /etc/network/interfaces if that helps – user316500 May 4 '14 at 10:33
  • Well, it is important to know what networking mode is used for eth0 / eth1 in Vagrant side, and also to know what the exact NAT is. /etc/network/interfaces doesn't contain that information. – Tero Kilkanen May 4 '14 at 10:35
  • Ah I see. I've just had a look around. It seems eth0 is a requirement on all vagrant machines, and it handles the DHCP stuff. The eth1 is a network interface I bring up myself by having 'config.vm.network "public_network"' in my Vagrantfile. This is the public interface and I manually set its IP to This is the IP I can work the webserver from on my local network, but not online. Hopefully this helps, it appears I know far less about what is going on than I first thought. – user316500 May 4 '14 at 10:44

192.168.x.x addresses are assigned to private networks, and they cannot be accessed from the public Internet.

You should either create a port redirection rule on your router to forward your desired port to the VM, or you should give a public IP address to the interface and make sure your public network is configured properly.

  • I have a global address with noip which points to my router, and all port 80 traffic is being forwarded to my VM. I've tested forwarding it to my host machine and apache will work fine, but if I forward it to my VM with the same settings it will fail. – user316500 May 4 '14 at 22:29

I was running into the same problem: Linux guest on a MacOS X host, could be accessed from any machine on the network, but not from the outside, even though the router was setup correctly. I was able to solve it using the answer provided enter link description here.

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.