Guest-to-host

This section describes a configuration for a virtio-net vdev in a guest communicating with a network driver in the hypervisor host.

The figure below illustrates a peer-to-peer connection between the virtio-net vdev in a guest and the io-sock driver mods-vdevpeer-net.so in the hypervisor host.

Figure 1Guest-to-host communication between a virtio-net vdev and a peer node provided by the mods-vdevpeer-net.so driver.


Configure a virtio-net vdev for guest-to-host

The following excerpt shows the virtio-net vdev configuration in the *.qvmconf file for the VM hosting the guest.

For a QNX guest on an ARM board, configure a virtio-net vdev as follows:
system qnx80-arm-guest
...
# The loc and intr gic options are for ARM only. The guest will see the
# virtio-net vdev as a memory-mapped I/O device at the specified location.

vdev virtio-net
	loc 0x1c0c0000
	intr gic:40
	mac aa:aa:aa:aa:aa:aa
	name p2p
	peer /dev/vdevpeers/vp0
	peerfeats checksum
where:
qnx80-arm-guest
The system name of the VM for the guest (see the system option for more details), also specified by the second last token in the vdevpeer-net peer option (peer=/dev/qvm/qnx80-arm-guest/p2p).
loc 0x1c0c0000
The base address of the device registers.
intr gic:40
The interrupt number of the current vdev (see Common vdev options in the Virtual Device Reference chapter).
mac aa:aa:aa:aa:aa:aa
The locally assigned MAC address of the node in the guest.
name p2p
The name of the node in the guest, also specified by the last token in the vdevpeer-net peer option (peer=/dev/qvm/qnx80-arm-guest/p2p).
peer /dev/vdevpeers/vp0
The path to the node in the host, also specified by the vdevpeer-net bind option (bind=/dev/vdevpeers/vp0).
peerfeats checksum
The VIRTIO Network feature bits supported by the peer (for more information, go to the note at the end of this section and Using the peerfeats option in the vdev virtio-net entry).

Start vdevpeer-net

The following excerpt shows the vdevpeer-net driver startup options that enable the hypervisor host to connect to a node in the guest.

When starting io-sock in the host, specify the following options and configuration for the vdevpeer-net driver:
io-sock -m vdevpeer-net
ifconfig vp0 create
vpctl vp0 peer=/dev/qvm/qnx80-arm-guest/p2p bind=/dev/vdevpeers/vp0 mac=a0b0c0d0e0f0
where:
peer=vdev_path
The path to a virtio-net vdev in the guest, inside the /dev/qvm/ directory. The remainder of the path is specified by the virtio-net vdev system option for the guest's directory (qnx80-arm-guest), and inside this directory, the node in the guest, specified by the vdev's name option (p2p).
bind=host_node_path
The path to the node in the host, inside the /dev/vdevpeers/ directory. In this case the default prefix vp is used for node zero (vp0).
mac=host_mac_address
The MAC address for the node in the hypervisor host.

Enable the guest interface

This subsection provides instructions for enabling the interface. Suppose that you have already enabled an interface on the host, as follows:
ifconfig vp0 up
ifconfig vp0 192.168.1.1
where vp0 is the peer-to-peer interface on the host, and 192.168.1.1 is its address.
You must now enable the interface on the guest and assign it a static IP address in the same subnet as the host. For example, for a QNX guest:
ifconfig vtnet0 192.168.1.2
where vtnet0 is the name of the interface on the guest, and 192.168.1.2 is an address in the same subnet as the host.
For a Linux guest:
sudo ifconfig enp0s3f0 up
sudo ifconfig enp0s3f0 192.168.1.2
where enp0s3f0 is the name of the interface on the Linux guest, and 192.168.1.2 is an address in the same subnet as the host.
Note:
If you specify peerfeats checksum or peerfeats guest-checksum for the peer interface on the guest, you must ensure that the checksum settings for the interface on the host match those for the interface on the guest. For example, to disable checksums for TCP and UDP on the node, configure it as follows:
ifconfig vp0 -rxcsum -txcsum -rxcsum6 -txcsum6
Page updated: