vagrant-smartos / vagrant-smartos-zones

Manage SmartOS local zones in Vagrant
MIT License
54 stars 9 forks source link

Zone network too common #30

Closed tylerflint closed 9 years ago

tylerflint commented 9 years ago

Currently, the zone network is 10.0.0.0/8 which is also a very common private address space. To potentially reduce collisions, this should be switched initially to 172.16.0.0/12. Ideally, this can be configurable.

sax commented 9 years ago

I think this makes more sense to be configurable. I'm pretty sure that as soon as I hard-coded it to 172 it would cause problems for someone else.

Do you want to put together a pull request? Otherwise I'll assign this to myself.

tylerflint commented 9 years ago

I agree, a configurable option seems to be the best solution. I'm trying to think about how best to expose this... We could simply allow one of three networks: 10.0.0.0/8, 172.168.0.0/12, or 192.168.0.0/16. Hmmm... I wonder if I could parse a cidr and make that work...

sax commented 9 years ago

There is a cidr gem, though if my memory is correct its API is a little backwards from what we'd want here. Still usable though.

I agree that setting the configuration to a network using cidr notation seems most useful. Then when creating a zone we can pick an address on that network. I remember we talked a while ago about the plugin needing to keep track of IPs that it assigns... not sure if we're at the point of needing that yet, or if we should still assign .1 and .2 arbitrarily.

sax commented 9 years ago

I'm going to play around with making this dynamic based on configuration. I was going to add the following zone configuration option:

config.zone.network = '172.16.0.0/16'

But I just realized that this might be better as a plugin-level configuration:

vagrant zones config network 172.16.0.0/16

That way you can change it depending on your current location, without having to check it into your Vagrantfile.

sax commented 9 years ago

It was the https://rubygems.org/gems/netaddr gem that I was thinking of. It's pretty nice, actually.