Merge pull request #6538 from mitchellh/sethvargo/pr-6325

Make DHCP IP configurable
This commit is contained in:
Seth Vargo 2015-11-18 16:41:30 -08:00
commit 96a815e84e
2 changed files with 11 additions and 2 deletions

View File

@ -249,14 +249,15 @@ 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
ip = IPAddr.new(options[:ip])
if ip.ipv4?

View File

@ -43,6 +43,14 @@ 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`.
You can also specify the DHCP IP:
```ruby
Vagrant.configure("2") do |config|
config.vm.network "private_network", type: "dhcp", dhcp_ip: "192.168.0.100"
end
```
## Static IP
You can also specify a static IP address for the machine. This lets you