I have a virtual machine (Ubuntu) and I need to send data through socket communication to my host PC (Ubuntu as well).

Is there a way to do it? I found out that the localhost of the PC and VM are the same ( but if I try to simply create a server on the VM and a receiving client on the PC, it does not receive anything...

Thanks in advance, Luigi

1 Answer 1


You can see the ip address of your VM/guest running this from your host (example for a VM called ubuntu16.04)

$ virsh  domifaddr ubuntu16.04
 Name       MAC address          Protocol     Address
-----------------------------------------------------------------------    --------
 vnet0      52:54:00:d6:f2:bc    ipv4

then use that ip address to send/receive data between host and VM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.