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

Allow multiple nics #86

Open
domoran opened this issue Dec 22, 2022 · 1 comment · May be fixed by #125
Open

Allow multiple nics #86

domoran opened this issue Dec 22, 2022 · 1 comment · May be fixed by #125

Comments

@domoran
Copy link

domoran commented Dec 22, 2022

Description

For my network project, I need to generate a packer template for a firewall. To pre-configure it correctly, I need two NICs inside the packer template. Currently it is only possible to use one.

I am in the process of extending the hyperv plugin to support multiple nics. Feedback is welcome. Pull request will come.

Use Case(s)

Provisioning hyperv images for servers that require multiple nics, e.g. firewalls, routers, etc.

Potential configuration

I want to add the following block to the configuration:

network_adapter {
	name = "Adapter 1"                       // optional, name of the network card
	mac_address = "00dd12ed11dd"   // optional, mac address of the network card
	enable_mac_spoofing = true          // optional, allow the guest os to spoof the mac address for the network card
        vlan_id = "1"                                   // optional, vlan id for the network card
	switch_name = "wan"                     // optional, name of the switch
        switch_vlan_id = "1"                        // optional, VLan ID for the switch if generated
}

The old (embedded) settings will still be available to keep compatibility with old configurations. If old and new options are used at the same time a warning will be issued. In this case, old (embedded) options will be inherited to new defined adapters, e.g.

mac_address = "001122334455"
enable_mac_spoofing = true

network_adapter {
   name = "wan"
}

network_adapter {
   name = "lan"
   mac_address = "112233445566"
}

In this case both network adapters will inherit the enable_mac_spoofing value. The mac_address will be inherited to the adapter named "wan" but not to the one named "lan", since it defines mac_address itself.

Instead of inheriting the embedded settings the following behaviours would also be possible (please give feedback):

  • stop with an error "Use either the new network_adapter block or the embedded settings"
  • issue a warning and ignore the embedded settings
  • make the first network adapter from the embedded settings, make additional ones using the network_adapter block.

Potential References

Other plugins also feature the addition of multiple network adapters, e.g. proxmox or amazon.

@Emanuele94
Copy link

Hi, is there a way at this day to add multiple nic with Hyper-v Provider ? I can't find anything in the documentatio.

@galthaus galthaus linked a pull request Mar 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants