Closed ghost closed 4 months ago
Do you mean getting accurate tart ip
? You can use arp
resolver with --net-bridged
:
tart run --net-bridged="Wi-Fi" sonoma-base
tart ip --resolver=arp sonoma-base
The bridge interface on the host machine that Tart uses. It's currently named something along the lines of bridge100
, so it's hard to programmatically determine which one it is.
There is of course a hack-around of launching a VM, getting its IP and figuring it out based on that, but that hinges on the VM having correctly configured networking (not always the case) and it presents a significant overhead in the context of a scripting workflow.
Perhaps obtaining the interface name as opposed to its IP address would open more doors with less acrobatics.
I believe a new interface is created upon launching a VM so there is no way to know it in advance. You can see output of ifconfig
before and after launch of the VM and see a new interface is added. Will that work for you use case?
The specific use case I have is binding a web server to the bridge interface on the host, in order to serve resources over HTTP to the VM that are used during the installation process, without exposing the web server to other networks. This happens as part of an automated process and is a pretty common pattern in DevOps. Think cloud-init and similar.
If you are using Packer plugin you can look at HTTP server configuration otherwise there is also a way to connect to service running on the host via NAT. Does either of the options work for you?
I'd be great for scripting purposes to be able to obtain the IP of the bridge interface used by Tart. :)