Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up DHCP server IP for Vagrant

I am using Vagrant 1.1.2 on Mac OS X 10.7.5

I am running into an issue with the default networking setup. The network seems to be configured to use a DHCP server providing IPs from 10.0.2.? network, with the gateway being set to 10.0.2.2

Sadly, in the organization I work for, there actually exists a server at 10.0.2.2, which causes huge network communication delays.

How can I configure Vagrant's VirtualBox to use DHCP server providing IPs from a different network? The documentation at http://www.vagrantup.com/ completely ignores this issue, which unfortunately renders my Vagrant useless.

When I disconnect from the corporate network, Vagrant works as expected. So I am quite sure the issue is in the IP collision.

like image 851
Roman Zenka Avatar asked Mar 19 '13 22:03

Roman Zenka


People also ask

What is the vagrant IP address?

By default, Vagrant connect will use an IP address that looks available in the 172.16. 0.0/16 space. --ssh - Connects via SSH to an environment shared with vagrant share --ssh .

How do I change my IP address on vagrant?

To configure private or host-only networking in Vagrant with static IP address, open the Vagrantfile, find the following line and uncomment it. Here, 192.168. 121.60 is the IP address of the VM. Replace this with your own IP.

How do I set DHCP to private network?

Open a browser and go to https://192.168.0.1 (default) or the IP address you have assigned to the Gateway appliance private user interface. Click Manage Gateway appliance and then click the Private network tab. Select Run DHCP server (recommended) and reconfigure the settings for the private network if necessary.


1 Answers

That's more a VirtualBox issue so should have to get Vagrant to set a VirtualBox option for a different DHCP subnet like so:

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--natnet1", "192.168/16"]
  end
like image 88
cmur2 Avatar answered Sep 21 '22 04:09

cmur2