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

Add ability to set MAC address of adapter #69

Open
Antoine-Gicquel opened this issue Apr 13, 2022 · 1 comment
Open

Add ability to set MAC address of adapter #69

Antoine-Gicquel opened this issue Apr 13, 2022 · 1 comment

Comments

@Antoine-Gicquel
Copy link
Contributor

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

It would be nice to make use of qemu's ability to set the mac address of a netdev. I think it would involve adding parameters in builder/qemu/step_run.go, and should be pretty straightforward. I currently am not skilled enough in Go / not familiar enough with the internals of Packer to feel confident about implementing this feature myself, but I would be pleased to help or to be guided at low level (like telling me which files to change precisely etc).

Use Case(s)

I would need it in order to control which IP address is given to the guest VM on a bridge (using dnsmasq for DHCP).

Potential configuration

source "qemu" "example" {
...
net_bridge = "virbr0"
net_mac = "00:00:00:00:00:00"
...
}

Potential References

Qemu documentation on setting a mac address with -netdev and -device ?

@Antoine-Gicquel
Copy link
Contributor Author

Antoine-Gicquel commented Apr 14, 2022

For now, I found a hacky workaround, setting net_device like so :
net_device = "virtio-net,mac=00:00:00:00:00:00"

It uses builder/qemu/step_run.go, line 252, to inject the argument in the qemu-system command.

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

1 participant