0

I have a Vagrant box (using Virtual Box) running locally on my laptop. My laptop (the host) is running Mac OS 10.11.6; the guest is running Ubuntu 16.04.

Currently, the guest is accessible from the host only, using the following stanza in the Vagrantfile:

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
   config.vm.network "private_network", ip: "192.168.13.37"

I want to make the Vagrant box accessible to other computers (on the home network only). Of course, it will only be accessible when my laptop is up and running on the home network and the vagrant box is running, but that's fine for my purposes.

I specifically want the vagrant box to be accessible at a fixed IP from the other computers on the home network. (It will be accessed from a laptop running Ubuntu 18.04 and another laptop running Windows 10, not that it matters.)

This commented-out stanza in the config file looks like it might be related to what I want:

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

However, searching online I couldn't find documentation or answers for vagrant describing the "predictable IP" part of my needs.

How can I configure this vagrant box to have an IP reachable from the rest of the home network (but only from the home network)?

1 Answer 1

0

I didn't solve exactly the question described above, but I found that by adding port forwarding for the particular service that I want accessible from other hosts on the home network, I can handle my use case.

It's not quite as clean since the ports are nonstandard, but it works.

I am running an https service, so the config lines I use are:

 config.vm.network "private_network", ip: "192.168.13.37" # as before

 config.vm.network "forwarded_port", guest: 443, host: 4443

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .