Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

config.winrm.host + config.vm.network static ip conflict? #9814

Open
doomnuggets opened this issue May 9, 2018 · 3 comments
Open

config.winrm.host + config.vm.network static ip conflict? #9814

doomnuggets opened this issue May 9, 2018 · 3 comments

Comments

@doomnuggets
Copy link

doomnuggets commented May 9, 2018

What am I trying to do here...?

I'm currently experimenting with Windows Server 2012 R2 automation and attempted to configure winrm with SSL enabled as my provisioner. As pointed out by the issue 9187 I'm forced to explicitly define a host parameter to circumvent an error.

Thus I changed my network adapters:

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.26  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 2a00:9fe0:205:4500:e1c1:ff7b:e7b5:182e  prefixlen 64  scopeid 0x0<global>
        inet6 2a00:9fe0:205:4500::24  prefixlen 128  scopeid 0x0<global>
        inet6 fe80::a55:74a4:3902:7da0  prefixlen 64  scopeid 0x20<link>
        ether 9c:b6:d0:fa:d7:cb  txqueuelen 1000  (Ethernet)
        RX packets 821430  bytes 1082954017 (1.0 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 252856  bytes 63691135 (60.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.111.1  netmask 255.255.255.0  broadcast 192.168.111.255
        ether 9c:b6:d0:fa:d7:cb  txqueuelen 1000  (Ethernet)

My goal is to set a static IP for the guest VM to 192.168.111.10, but the combination of config.winrm.host = "192.168.111.10" and windows_server.vm.network "public_network", ip: "192.168.111.10", bridge: ENV['VAGRANT_BRIDGE'] doesn't correctly assign a static IP to my guest when running vagrant up. The environment variable VAGRANT_BRIDGE is set to wlp2s0 (since vagrant doesn't seem to recognize my virtual adapter wlp2s0:0 before vagrant up is called).

Vagrant version

Vagrant version: 2.1.1

Host operating system

Fedora 27

Guest operating system

Windows Server 2012 R2 (x64)

Vagrantfile

  config.vm.define "windows_server" do |windows_server|
    windows_server.vm.box = "packer/box/windows-server-2012-r2-x64.box"
    windows_server.vm.network "public_network", ip: "192.168.111.10", bridge: ENV['VAGRANT_BRIDGE']
    windows_server.vm.guest = "windows"
    windows_server.vm.network "forwarded_port", guest: 5986, host: 5986, host_ip: "192.168.111.1", auto_correct: true, guest_ip: '192.168.111.10'
    windows_server.vm.communicator = "winrm"
    windows_server.winrm.username = "Administrator"
    windows_server.winrm.host = "192.168.111.10"
    windows_server.winrm.port = 5986
    windows_server.winrm.guest_port = 5986
    windows_server.winrm.transport = "ssl"
    windows_server.winrm.timeout = 3600
    windows_server.vm.provider "virtualbox" do |virtualbox|
      virtualbox.name = "Windows Server 2012 R2"
      virtualbox.cpus = 4
      virtualbox.memory = 4096
    end
end

Debug output

See the gist

Expected behavior

Vagrant should've set the static IP (192.168.111.10) on the Windows Server guest.

Actual behavior

Vagrant picked an IP from the wrong subnet, instead of the correct subnet 192.168.111.1/24 it requested an arbitrary IP (most likely via DHCP) from 192.168.0.1/24.

References

@doomnuggets
Copy link
Author

I'm unsure if this is even an issue with vagrant on it's own or if my network configuration is just terrible.
Can somebody confirm this is a common issue?

@TonyApuzzo
Copy link
Contributor

I have been having vaguely similar problems with Vagrant since 2.1.0 with CentOS guest not paying attention to ip settings (in fact I keep getting duplicate IPs assigned with External Switches) But you are doing enough differently than me that our issues could be entirely separate. Sorry.

@doomnuggets
Copy link
Author

@TonyApuzzo welp, good luck. I'm sure the Linux side of vagrant is at least possible to troubleshoot unlike this Windows abomination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants