Skip to content

HTTPIP on Windows gets IP address from wrong Ethernet adapter #10168

@Weilbyte

Description

@Weilbyte

Overview of the Issue

When using Packer on Windows, the {{ .HTTPIP }} variable picks up the wrong IP address. My ipconfig looks like this below:

Windows IP Configuration


Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::4db:cb2a:a777:7cd2%26
   IPv4 Address. . . . . . . . . . . : 172.25.16.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::20b0:da9b:6cb1:e6b%32
   IPv4 Address. . . . . . . . . . . : 172.18.96.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : localdomain
   IPv4 Address. . . . . . . . . . . : 10.0.30.44
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.30.1

The last adapter, Ethernet is the one that should be picked as that is the only one accessible by my local server where the VM is provisioned. However Packer insists on using 172.25.16.1 for HTTPIP. This can probably be avoided by specifying bind address to the correct one, but then this configuration becomes specific to the machine it runs on as the bind address would need to be changed.

Reproduction Steps

  1. Have some vEthernet adapters, usually from a WSL/WSL2 installation.
  2. Use the HTTPIP variable.
  3. The HTTPIP variable is the IP address of the vEthernet adapters.

Packer version

Packer v1.6.4

Simplified Packer Buildfile

Shouldn't be buildfile specific.

{
      "boot_command": [
        "<enter><enter><f6><esc><wait> ",
        "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
        "<enter>"
      ],
}

Operating system and Environment details

Running from Windows 10 machine.
Using Proxmox builder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions