macosvm icon indicating copy to clipboard operation
macosvm copied to clipboard

How to set ip address

Open marintrooper23 opened this issue 1 year ago • 4 comments

Hello! How do I assign an IP address to a virtual machine? For example, I may have the address 10.243.212.112 distributed to a guest machine on my host machine. How do I assign it?

marintrooper23 avatar Aug 13 '24 05:08 marintrooper23

The VM framework is assigning IP addresses automatically in the 192.168.64/24 subnet, so the VM is accessible at 192.168.64.xx where xx is incremental. You can find the IP address with arp -an. By default everything else is NATed so the guest can reach to the host and outside.

If you need a more complex networking setup, then you can use the unix target -- have a look at the slirp proxy (see networking in the README) which can give you a lot more control about how you expose the guest.

s-u avatar Aug 13 '24 05:08 s-u

Can you show an example of how to run with a unix parameter?

marintrooper23 avatar Aug 13 '24 06:08 marintrooper23

For example, i run ./slirp_unix -p /opt/Management/macosvm/etalon -f 12345:12345 Then I run my vm: macosvm --net unix:"/opt/Management/macosvm/etalon" -g vm_sonoma.json How can i get access into my vm from outside network?

marintrooper23 avatar Aug 13 '24 07:08 marintrooper23

In your example above simply with host:12345 where host is the IP address of the host since the proxy is proxying all traffic on the 12345 port to the VM.

For example, if you use slirp_unix -f 1022:22 then ssh -p 1022 host from the outside will connect to the ssh of VM instead of the host.

s-u avatar Aug 16 '24 02:08 s-u