Private Networks

Network identifier: private_network

Private networks allow you to access your guest machine by some address that is not publicly accessible from the global internet. In general, this means your machine gets an address in the private address space.

Multiple machines within the same private network (also usually with the restriction that they're backed by the same provider) can communicate with each other on private networks.

Guest operating system support. Private networks generally require configuring the network adapters on the guest machine. This process varies from OS to OS. Vagrant ships with knowledge of how to configure networks on a variety of guest operating systems, but it is possible if you're using a particularly old or new operating system that private networks won't properly configure.


The easiest way to use a private network is to allow the IP to be assigned via DHCP.

Vagrant.configure("2") do |config| "private_network", type: "dhcp"

This will automatically assign an IP address from the reserved address space. The IP address can be determined by using vagrant ssh to SSH into the machine and using the appropriate command line tool to find the IP, such as ifconfig.

Static IP

You can also specify a static IP address for the machine. This lets you access the Vagrant managed machine using a static, known IP. The Vagrantfile for a static IP looks like this:

Vagrant.configure("2") do |config| "private_network", ip: ""

It is up to the users to make sure that the static IP doesn't collide with any other machines on the same network.

While you can choose any IP you'd like, you should use an IP from the reserved private address space. These IPs are guaranteed to never be publicly routable, and most routers actually block traffic from going to them from the outside world.

For some operating systems, additional configuration options for the static IP address are available such as setting the default gateway or MTU.

Warning! Do not choose an IP that overlaps with any other IP space on your system. This can cause the network to not be reachable.

Disable Auto-Configuration

If you want to manually configure the network interface yourself, you can disable Vagrant's auto-configure feature by specifying auto_config:

Vagrant.configure("2") do |config| "private_network", ip: "",
    auto_config: false

If you already started the Vagrant environment before setting auto_config, the files it initially placed there will stay there. You'll have to remove those files manually or destroy and recreate the machine.