Are you trying to resolve Guest unable to reach host using macvtap interface?
This guide is for you.
Generally, guest virtual machines can communicate with other guests. But at times a guest will not be able to connect to the host machine after being configured to use a macvtap network interface.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve issues of guest virtual machines.
Nature of the error, Guest unable to reach host using macvtap interface ?
When we configure a guest virtual machine to use a type='direct' network interface such as macvtap, despite having the ability to communicate with other guests and other external hosts on the network, the guest cannot communicate with its own host.
However, this is actually not an error as it is the defined behavior of macvtap. Because of the way in which the host's physical Ethernet is attached to the macvtap bridge, traffic into that bridge from the guests that is forwarded to the physical interface cannot be bounced back up to the host's IP stack.
Additionally, traffic from the host's IP stack that is sent to the physical interface cannot be bounced back up to the macvtap bridge for forwarding to the guests.
What to do when the Guest unable to reach host using macvtap interface ?
You can apply the tips given below to fix this error.
1. Creating a separate macvtap interface for the host
We can create a separate macvtap interface for host use and give it the IP configuration previously on the physical ethernet. In this way, the host would be an equal peer attached to the macvlap bridge and thus guest and host could communicate directly.
2. Using libvirt for creating an isolated network
Use libvirt to create an isolated network and create a second interface for each guest virtual machine that is connected to this network. The host and guests can then directly communicate over this isolated network, while also maintaining compatibility with NetworkManager.
Following are the steps for creating an isolated network with libvirt:
i. First, we need to add and save the following XML in the /tmp/isolated.xml file.
If the 192.168.254.0/24 network is already in use elsewhere on our network, we can choose a different network:
<ip address='192.168.254.1' netmask='255.255.255.0'>
<range start='192.168.254.2' end='192.168.254.254'/>
ii. Then create the network with the following command:
$ virsh net-define /tmp/isolated.xml
iii. . After that, we need to set the network to autostart with the following command:
$ virsh net-autostart isolated
iv. And start the network with the following command:
$ virsh net-start isolated
v. Now, edit the configuration of each guest that uses macvtap for its network connection using the following command:
$ virsh edit name_of_guest
Add a new <interface> in the <devices> section similar to the following (note the <model type=’virtio’/> line is optional to include):
<interface type='network' trustGuestRxFilters='yes'>
vi. Finally, shut down, then restart each of these guests.
Since this new network is isolated to only the host and guests, all other communication from the guests will use the macvtap interface.
[Need urgent Assistance in fixing missing packages on Linux Servers? We are happy to help you! ]