Possible to set or determine IP or MAC address for ephemeral instances?
getchardy opened this issue · 3 comments
getchardy commented
I am using the --ephemeral
flag when running for macosvm
in a GitLab Runner custom executor. If 2 jobs start at the same time, is there a trick to mapping the process ID with the IP or MAC address that gets assigned to the instance?
Is it possible to specify a MAC address via config file or command line argument? (Then I could identify the IP using arp -a
.)
Thanks for your work on this project!
s-u commented
@getchardy very good question and idea! As far as I can tell the VZ framework allows the specification of a MAC address, so that should be easy enough to add.
s-u commented
Ok, I have added a few features in 2b50b39 related to this:
macosvm
prints the MAC address of the interfaces at startup, e.g.:2022-10-20 11:51:12.961 macosvm[7301:114344] + network: ether 12:0e:05:bb:82:96
- The network specification in the
json
file supports a dictionary entry"mac"
with the MAC address, so a network specification may look like this:"networks":[{"type":"nat","mac":"12:34:56:aa:bb:cc"}]
- The command line argument
--net nat:<MAC>
can be used to add anat
network with specific MAC address - Finally a new argument
--mac <MAC>
overrides the MAC address of first network in the configuration. It is processed last after all arguments and the configuration file so this is a way to unconditionally override a MAC address on the command line. This is likely the most useful of the lot if you are using--ephemeral
.
getchardy commented
That is fantastic, being able to see the auto-assigned MAC is super helpful!
Many thanks!