Closed akozyreva closed 2 years ago
Hum, that's why I came to the SDK today. :+1: I don't know yet but, assuming you'd have installed the guest additions, the following would work
vboxmanage guestproperty enumerate "Alpine 01" | grep VirtualBox/GuestInfo/Net/1/V4/IP
Let's see if there is a guestproperty object somewhere.
import virtualbox
vbox = virtualbox.VirtualBox()
machine = vbox.find_machine("Alpine 01")
for a in machine.enumerate_guest_properties("/VirtualBox/GuestInfo/Net/1/V4/IP"):
print(a)
Yields
['/VirtualBox/GuestInfo/Net/1/V4/IP']
['192.168.57.10']
[1638084766103149000]
['']
Closing this, thanks @alainpannetier!
ENVIRONMENT
master
branch?SUMMARY
I have installed Ubuntu Server in Virtualbox. I can run this machine, using code from documentation.
Then I need to retrieve somehow public IP from that machine. Inside of virtualbox I can run
ifconfig
and get public IP. How can I do it viavirtualbox-python
package?