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

Possible to set or determine IP or MAC address for ephemeral instances? #15

Closed
getchardy opened this issue Oct 19, 2022 · 3 comments
Closed

Comments

@getchardy
Copy link

getchardy commented Oct 19, 2022

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!

@getchardy getchardy changed the title Set or determine IP or MAC address for ephemeral instances Possible to set or determine IP or MAC address for ephemeral instances? Oct 19, 2022
@s-u
Copy link
Owner

s-u commented Oct 19, 2022

@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
Copy link
Owner

s-u commented Oct 20, 2022

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 a nat 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
Copy link
Author

That is fantastic, being able to see the auto-assigned MAC is super helpful!

Many thanks!

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

No branches or pull requests

2 participants