0

I use virt-manager to administer my virtual machines. I would like to communicate a virtual machine (Windows) with the host machine (GNU/Linux).

I use the default network interface, which is a bridge in NAT mode, with the network address 192.168.122.0/24. When I listen on the host 192.168.122.1 on port 12345, I check with my guest machine with netcat :

nc -vz 192.168.122.1 12345

I get the following answer :

Warning: forward host lookup failed for hostname: h_errno 1101: HOST_NOT_FOUND
hostname [192.168.122.1] 12345 (?): TIMEOUT

And I get the same answer on any interface.

But if I do the same on the external network gateway 192.168.0.1, I get :

gateway.lan [192.168.0.1] 12345 (?) open

How can I fix it ?

3
  • Try Bridged Mode for the Guest so Guest and Host are on the same subnet and see if that works.
    – anon
    Commented Aug 12, 2021 at 10:45
  • Yeah you have right, with a physical Bridge it works. I just realized that in reality the host machine is not part of the same subnet as the guest in NAT mode. Is there any way to make it work in this mode ?
    – anderson
    Commented Aug 12, 2021 at 15:35
  • You can try IP addressing in NAT mode. But I posted an answer as you have it working in Bridged.
    – anon
    Commented Aug 12, 2021 at 16:18

2 Answers 2

0

I use the default network interface, which is a bridge in NAT mode, with the network address 192.168.122.0/24. When I listen on the host 192.168.122.1 on port 12345, ... I get Warning: forward host lookup failed for hostname:

First: try in Bridged Mode to get everything on one subnet. That usually works fine.

Second: If you wish to revert to NAT, try IP addressing for communication between host and guest. I do this. Name addressing is more complicated.

I do prefer Bridged for this.

0

Under Red Hat distributions the default firewall used is firewall-cmd. To be able to access from the guest machine to the host machine simply open the specific port via the firewall :

sudo firewall-cmd --zone=libvirt --add-port=12345/tcp

Where libvirt is the area network for virtual machines using libvirt library (virt-manager or cockpit by example).

I did not check but i imagine that under debian distributions for example, just edit the nftables firewall.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .