From 004fe0e7bb0c17c4f0e0bc801440a6456d7b979d Mon Sep 17 00:00:00 2001 From: Tristan Rivoallan Date: Fri, 25 Sep 2015 18:11:22 +0200 Subject: [PATCH] Make DHCP IP configurable This makes it possible to have DHCP attribute IPs to guests under various subnets --- plugins/providers/virtualbox/action/network.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/providers/virtualbox/action/network.rb b/plugins/providers/virtualbox/action/network.rb index cf5ca3b47..f29111dd9 100644 --- a/plugins/providers/virtualbox/action/network.rb +++ b/plugins/providers/virtualbox/action/network.rb @@ -249,14 +249,16 @@ module VagrantPlugins auto_config: true, mac: nil, nic_type: nil, - type: :static + type: :static, + dhcp_ip: "172.28.128.1" }.merge(options) # Make sure the type is a symbol options[:type] = options[:type].to_sym # Default IP is in the 20-bit private network block for DHCP based networks - options[:ip] = "172.28.128.1" if options[:type] == :dhcp && !options[:ip] + options[:ip] = options[:dhcp_ip] if options[:type] == :dhcp && !options[:ip] + ip = IPAddr.new(options[:ip]) if ip.ipv4?