Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Add ability for public/bridged networking #185

Closed
caschbre opened this issue Aug 2, 2015 · 8 comments
Closed

Add ability for public/bridged networking #185

caschbre opened this issue Aug 2, 2015 · 8 comments
Labels

Comments

@caschbre
Copy link

caschbre commented Aug 2, 2015

It would be great if there was a configuration option in config.yml to allow for public/bridged networking. I often need to connect directly to my guest from a device other than the host for a variety of reasons, including testing from a mobile device. I am also starting to play with setting up my dev VMs on an ubuntu server and a bridged network would make it easier to connect from my laptop/desktop.

@geerlingguy
Copy link
Owner

This is definitely a feature I'll consider adding—networking configuration is not quite flexible with Drupal VM, but there's really no reason for that other than I almost never use non-private networking in my normal work.

See related: #176

@caschbre
Copy link
Author

I started toying with how to make this a configuration option. One thing I've run into is when setting up a public_network then NFS synced folder fails. Here's the error message I get when doing a vagrant up.

"NFS requires a host-only network to be created.
Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work."

@geerlingguy
Copy link
Owner

@caschbre can you add an additional network interface? If you just have one interface and switch it from private to public, then it would cause issues with NFS. But if you add another interface for public networking, it should be fine.

@caschbre
Copy link
Author

@geerlingguy I'm learning this stuff as I go. :) Can you elaborate on what that would entail? Is that something I do in the Vagrantfile?

@geerlingguy
Copy link
Owner

You would need to add an additional network configuration inside the Vagrantfile, like:

config.vm.network "public_network"

And put that right before the line that reads config.ssh.insert_key = false. Then do a vagrant up or vagrant reload, and you should have the primary network on your host bridged into the VM.

You can also specify a particular network interface or IP address for one of your host machine's network interfaces (e.g. bridge to WiFi, or a particular network adapter). See https://docs.vagrantup.com/v2/networking/public_network.html

@geerlingguy
Copy link
Owner

I'm thinking the simplest way to make this a configurable option in config.yml is to add that line with an if condition for whether a new configuration item like vagrant_enable_public_network is true. I should reiterate the warning on the Vagrant docs public network page, though—when you bridge the VM to your computer's network, anyone may be able to access the publicly-available ports, and easily log into the very-insecurely-configured vagrant user account and gain root access at least inside the VM.

This box (as is the case with most Vagrant configurations) is configured first for local development convenience, then for security, so keep that in mind :)

@caschbre
Copy link
Author

Ok, I think I "may" have this figured out. I was doing an IF/ELSE for the public or private network. But if I add the public_network as a line after the public network is created then it appears to work. Is it a correct assumption that it's creating two network connections then?

And I completely agree on the security. It should be private by default. I'm on my home network behind a firewall on my own server.

I'll see if I can get a pull request created for this.... at least as a start.

caschbre pushed a commit to caschbre/drupal-vm that referenced this issue Aug 28, 2015
@geerlingguy
Copy link
Owner

👍

ravbaba pushed a commit to ravbaba/drupal-vm that referenced this issue Sep 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants