Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Guest IP doesn't get resolved if first network interface is not Shared #185

Closed
alh84001 opened this issue May 28, 2015 · 4 comments
Closed

Comments

@alh84001
Copy link

Now I know this goes contrary to all the docs, but unfortunately I have a requirement which I can't get around of, where I must have a bridged adapter defined as the first guest network adapter. This causes the guest IP to never be resolved even if I add Shared network as a second adapter. I have this successfully running with VirtualBox so it would be nice to have it supported in Parallels as well.

The root cause is in the VagrantPlugins::Parallels:Driver:PD_8.read_mac_address which takes the first adapter MAC which it assumes belongs to the Shared network adapter and which is later used to look into Parallels DHCP leases to get the IP. However, bridged adapters don't get IP address assigned from Parallels, and their IP won't be listed there.

The fix with the least impact to any existing code out there would be to filter out any bridge MACs (e.g. prlctl ..... --info) before returning the first one.

@legal90
Copy link
Collaborator

legal90 commented May 28, 2015

This is really strange case :)
@alh84001 How do you change the type and order of network interfaces? Are you doing it manually, after the first vagrant up?

@alh84001
Copy link
Author

Tell me about it :)

I redefine the first adapter and add shared network with provider customizations. I could then forward any ports using prlctl as well. But since I don't need to forward any ports I think DHCP private network would work equally as well, but I am wary of any dependencies on shared networking.

Example:

    config.vm.provider :parallels do |prl, config_override|
      config_override.vm.network :public_network, adapter: 0
      # on of the two bellow
      prl.customize ["set", :id, "--device-add", "net", "--type", "shared"]
      config_override.vm.network :private_network
    end

legal90 added a commit that referenced this issue Jun 5, 2015
In some custom cases shared adapter can have an index different from "0"
#185
@legal90
Copy link
Collaborator

legal90 commented Jun 5, 2015

I've added the workaround for cases like yours in v1.3.13. Now MAC of "Shared" adapter will be properly detected even if it is not the first.

But please be aware that such adapter re-ordering is not a supported case, because Vagrant configures only private_network and private_network interfaces in the guest OS. It means that if you move "Shared" to some other place, you will have to configure it from the guest side manually (or use custom pre-configured boxes). Otherwise, you will get "virtual machine boot timeout"

P.s. @alh84001 So, if you really need this trick, you can use these lines in Vagrantfile instead of mentioned above:

    config.vm.provider :parallels do |prl, config_override|
      config_override.vm.network :public_network, adapter: 0
      prl.network_adapter(1, :shared)
    end

@legal90 legal90 closed this as completed Jun 5, 2015
@alh84001
Copy link
Author

Sorry for the late reply, saw it before, but stuff got in the way.

Many, many thanks for adding the option.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants